Skip to content

Commit

Permalink
java: Improve build rules
Browse files Browse the repository at this point in the history
* Fix builds in subdirectories:
  * Add srcdir to Manifest.txt.
  * Remove srcdir from piccolo2d-core-3.0.jar and piccolo2d-extras-3.0.jar.

* Add dependency of SCROLLVIEW_CLASSES on SCROLLVIEW_LIBS.
  The SCROLLVIEW_LIBS are now automatically fetched when needed.

* Add .PHONY target for fetch-jars.

* Improve rule for clean target.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Dec 11, 2016
1 parent 49401e6 commit 92f2eda
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions java/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ SCROLLVIEW_CLASSES = \
com/google/scrollview/ScrollView.class

SCROLLVIEW_LIBS = \
$(srcdir)/piccolo2d-core-3.0.jar \
$(srcdir)/piccolo2d-extras-3.0.jar
piccolo2d-core-3.0.jar \
piccolo2d-extras-3.0.jar

CLASSPATH = $(srcdir)/piccolo2d-core-3.0.jar:$(srcdir)/piccolo2d-extras-3.0.jar
CLASSPATH = piccolo2d-core-3.0.jar:piccolo2d-extras-3.0.jar

ScrollView.jar : $(SCROLLVIEW_CLASSES)
$(JAR) cfm $@ Manifest.txt com/google/scrollview/*.class \
$(JAR) cfm $@ $(srcdir)/Manifest.txt com/google/scrollview/*.class \
com/google/scrollview/events/*.class com/google/scrollview/ui/*.class

$(SCROLLVIEW_CLASSES) : $(SCROLLVIEW_FILES)
$(SCROLLVIEW_CLASSES) : $(SCROLLVIEW_FILES) $(SCROLLVIEW_LIBS)
$(JAVAC) -encoding UTF8 -sourcepath $(srcdir) -classpath $(CLASSPATH) $(SCROLLVIEW_FILES) -d $(builddir)

fetch-jars :
.PHONY: fetch-jars
fetch-jars $(SCROLLVIEW_LIBS):
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-core/3.0/piccolo2d-core-3.0.jar > piccolo2d-core-3.0.jar
curl -L http://search.maven.org/remotecontent?filepath=org/piccolo2d/piccolo2d-extras/3.0/piccolo2d-extras-3.0.jar > piccolo2d-extras-3.0.jar

Expand All @@ -64,7 +65,7 @@ uninstall:
endif

clean :
rm -f ScrollView.jar *.class $(srcdir)/*.class
rm -f ScrollView.jar $(SCROLLVIEW_CLASSES)

# all-am does nothing, to make the java part optional.
all all-am install :

0 comments on commit 92f2eda

Please sign in to comment.