include Makefile.inc

BINDINGS=java

all: $(BINDINGS)

$(JAVA_LIBRARY): $(OBJECTS) $(C_WRAPPER_OBJECTS) $(JAVA_OBJECTS)
	$(CXX) -shared $(CPPFLAGS) $(CFLAGS_JAVA_LIBRARY) $(LDFLAGS) $^ -o $@ $(LIB_JAVA_LIBRARY)

$(JAVA_OBJECTS): $(JAVA_WRAPS) $(HEADERS)
	$(CXX) -c $(CPPFLAGS) $(CFLAGS_JAVA_LIBRARY) $(JAVA_WRAPS) -o $@
	
$(JAVA_WRAPS) $(JAVA_BINDINGS): $(SWIG_INTERFACE) $(HEADERS)
	mkdir -p $(JAVA_OUTPUT_PATH)
	$(SWIG) -c++ -Isdk/include -java -package $(JAVA_PACKAGE_NAME) -outdir $(JAVA_OUTPUT_PATH) -o $(JAVA_WRAPS) -DHAVE_LIBUV $(SWIG_INTERFACE)

$(OBJECTS) $(C_WRAPPER_OBJECTS): $(HEADERS)

clean:
	rm -f $(OBJECTS) $(C_WRAPPER_OBJECTS)
	rm -f $(PYTHON_OBJECTS) $(PYTHON_WRAPS) $(PYTHON_HEADERS) $(PYTHON_BINDINGS) $(PYTHON_LIBRARY) python/*.pyc
	rm -f $(JAVA_OBJECTS) $(JAVA_WRAPS) $(JAVA_HEADERS) $(JAVA_BINDINGS) $(JAVA_LIBRARY)
	rm -f $(JAVA_OUTPUT_PATH)/*.class $(JAVA_BASE_OUTPUT_PATH)/*.class
