# HG changeset patch # User Matti Hamalainen # Date 1488369368 -7200 # Node ID 0303db4df28f59319870f5951afb66f5f1677e20 # Parent 2b2fa62cfea52e9e31e4a0df0d22b69085e86e79 Improve build system. diff -r 2b2fa62cfea5 -r 0303db4df28f Makefile --- a/Makefile Wed Mar 01 13:50:50 2017 +0200 +++ b/Makefile Wed Mar 01 13:56:08 2017 +0200 @@ -1,21 +1,29 @@ # Settings, directories RUN=Ristipolku.class +JARFILE=Ristipolku.jar -RESOURCES=graphics/*.png graphics/*.jpg graphics/font.ttf sounds/*.wav +SRC=game +RESOURCES=\ + graphics/*.png \ + graphics/*.jpg \ + graphics/font.ttf \ + sounds/*.wav -CLASSES=game/G.class \ - game/Piece.class game/PieceType.class \ - game/Engine.class game/Interpolate.class \ - game/ResourceLoader.class \ - game/Sound.class game/SoundManager.class \ - game/IDMPoint.class game/IDMWidget.class \ - game/IDMButton.class game/IDMContainer.class \ - game/AnimatedPointElement.class +CLASSES=G.class \ + Piece.class PieceType.class \ + Engine.class Interpolate.class \ + ResourceLoader.class \ + Sound.class SoundManager.class \ + IDMPoint.class IDMWidget.class \ + IDMButton.class IDMContainer.class \ + AnimatedPointElement.class # Utils -JAVAC=javac -g -Xlint:unchecked +JAVAC=javac +JAVAC_FLAGS=-g -Xlint:unchecked APPLETVIEWER=aoss appletviewer + ### ### Targets ### @@ -23,11 +31,11 @@ all: $(TARGETS) -game/%.class: game/%.java - $(JAVAC) $< +$(SRC)/%.class: $(SRC)/%.java + $(JAVAC) $(JAVAC_FLAGS) $< -Ristipolku.class: Ristipolku.java $(CLASSES) - $(JAVAC) $< +Ristipolku.class: Ristipolku.java $(addprefix $(SRC)/,$(CLASSES)) + $(JAVAC) $(JAVAC_FLAGS) $< run: $(RUN) @@ -37,11 +45,11 @@ ### ### Package ### -Ristipolku.jar: $(RUN) $(RESOURCES) - jar cvfm $@ manifest.txt $+ game/*.class +$(JARFILE): $(RUN) $(RESOURCES) + jar cvfm $@ manifest.txt $+ $(SRC)/*.class -upload: Ristipolku.jar +upload: $(JARFILE) @scp $+ ccr@tnsp.org:tnsp/ristipolku/ $(RM) $< @@ -50,7 +58,7 @@ ### Cleanup ### clean: - $(RM) $(TARGETS) *.class game/*.class + $(RM) $(TARGETS) *.class $(SRC)/*.class srcclean: clean