Skip to content

Commit

Permalink
Making Java Makefile cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-morra-zefr committed Feb 8, 2017
1 parent f40d320 commit 48ee9aa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions java/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ifeq ($(UNAME), Darwin)
INSTALL_PATH = /Library/Java/Extensions
endif

LOCAL_LIBRARY = target/$(SHARED_LIBRARY)
jni_SRCS = $(shell find src/main/c++ -name "*.cc")
jni_OBJS = $(jni_SRCS:.cc=.o)

Expand All @@ -32,14 +33,14 @@ all:
test:
cd ..; $(MAKE) test

things: pom_version target/$(SHARED_LIBRARY)
things: pom_version $(LOCAL_LIBRARY)

pom_version: pom.xml
ver=$$(grep AC_INIT ../configure.ac | cut -d '[' -f 3 | cut -d ']' -f 1) && \
newVer=$$(perl -e "@a=split('\.', '$$ver'); \$$a[2]++; print(join('.', @a))") && \
perl -pi -e "s/(\s*)<version>.*-SNAPSHOT/\1<version>$$newVer-SNAPSHOT/" pom.xml

target/$(SHARED_LIBRARY): $(jni_OBJS) ../vowpalwabbit/main.o ../vowpalwabbit/libvw.a ../vowpalwabbit/liballreduce.a
$(LOCAL_LIBRARY): $(jni_OBJS) ../vowpalwabbit/main.o ../vowpalwabbit/libvw.a ../vowpalwabbit/liballreduce.a
mkdir -p target;
$(CXX) -shared $(FLAGS) -o $@ $^ $(VWLIBS) $(STDLIBS) $(JAVA_INCLUDE)

Expand All @@ -52,9 +53,9 @@ target/$(SHARED_LIBRARY): $(jni_OBJS) ../vowpalwabbit/main.o ../vowpalwabbit/lib
-include $(jni_SRCS:.cc=.o)

install: target/$(SHARED_LIBRARY)
cp target/$(SHARED_LIBRARY) $(INSTALL_PATH);
cp $(LOCAL_LIBRARY) $(INSTALL_PATH);

.PHONY: clean
clean:
rm -f target/$(SHARED_LIBRARY)
rm -f $(LOCAL_LIBRARY)
rm -f $(jni_SRCS:.cc=.o)

0 comments on commit 48ee9aa

Please sign in to comment.