annotate Makefile @ 205:76972d900783 default tip

Fix verbose build echos.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 29 Feb 2024 21:49:56 +0200
parents dd2caf5321ba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
1 ###
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
2 ### Settings, directories
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
3 ###
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
4 # Utils
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
5 JAVA = java
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
6 JAVA_FLAGS +=
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
7 JAVAC = javac
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
8 JAVAC_FLAGS += -g -Xlint:unchecked
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
9 JAVAC_FLAGS += -Xlint:deprecation
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
10
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
11
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
12 MAINCLASS=Ristipolku.class
165
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
13 JARFILE=Ristipolku.jar
13
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
14
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
15 SRC=game/
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
16
165
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
17 RESOURCES=\
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
18 graphics/*.png \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
19 graphics/*.jpg \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
20 graphics/font.ttf \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
21 sounds/*.wav
13
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
22
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
23
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
24 ###
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
25 ### Functions and compilation/link commands
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
26 ###
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
27 ifneq ($(V),1)
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
28 DO_CMD=/bin/echo -E " $(1) $(2)" && $(3)
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
29 else
205
76972d900783 Fix verbose build echos.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
30 DO_CMD=/bin/echo -E "$(3)" && $(3)
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
31 endif
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
32 DO_MKDIR=if test ! -z "$(1)" -a ! -d "$(1)"; then /bin/echo -E " MKDIR $(1)"; mkdir -p "$(1)"; fi
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
33
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
34
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
35 COMPILE_JAVA_OBJ = \
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
36 @$(call DO_MKDIR,$(OBJPATH)) ; \
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
37 $(call DO_CMD,JAVAC,$<,$(JAVAC) $(JAVAC_FLAGS) $< $(1))
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
38
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
39
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
40 ###
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
41 ### Targets and generic rules
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
42 ###
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
43 TARGETS = $(MAINCLASS)
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
44
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
45 all: $(TARGETS)
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
46
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
47
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
48 $(SRC)%.class: $(SRC)%.java
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
49 $(call COMPILE_JAVA_OBJ,)
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
50
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
51
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
52 ###
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
53 ### Class depencies
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
54 ###
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
55 $(SRC)IDMWidget.class: $(SRC)IDMPoint.class
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
56
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
57 $(SRC)IDMButton.class: $(SRC)IDMWidget.class
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
58
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
59 $(SRC)IDMContainer.class: $(SRC)IDMWidget.class
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
60
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
61 $(SRC)IDMWindow.class: $(SRC)IDMWidget.class
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
62
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
63 $(SRC)Engine.class: $(addprefix $(SRC),\
165
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
64 Piece.class PieceType.class \
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
65 Interpolate.class \
165
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
66 ResourceLoader.class \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
67 Sound.class SoundManager.class \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
68 IDMPoint.class IDMWidget.class \
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
69 IDMButton.class IDMContainer.class \
182
88b364dfd501 Rememeber to add the new class to build system ..
Matti Hamalainen <ccr@tnsp.org>
parents: 165
diff changeset
70 IDMWindow.class \
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
71 AnimatedPointElement.class)
165
0303db4df28f Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 162
diff changeset
72
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
73 Ristipolku.class: Ristipolku.java $(addprefix $(SRC),\
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
74 Engine.class)
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
75 $(call COMPILE_JAVA_OBJ,)
9
a7751971c2a3 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 2
diff changeset
76
1
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
197
f3302a2d7815 Convert to a Java application, instead of browser applet,
Matti Hamalainen <ccr@tnsp.org>
parents: 193
diff changeset
78 run: $(MAINCLASS)
f3302a2d7815 Convert to a Java application, instead of browser applet,
Matti Hamalainen <ccr@tnsp.org>
parents: 193
diff changeset
79 @$(JAVA) $(JAVA_FLAGS) $(patsubst %.class,%,$<)
1
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
12
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
82 ###
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
83 ### Package
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
84 ###
193
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
85 $(JARFILE): $(MAINCLASS) $(RESOURCES)
60871afc2702 Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 189
diff changeset
86 jar cvfm $@ manifest.txt $(MAINCLASS) $(RESOURCES) $(SRC)*.class
13
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
87
12
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
88
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
89 ###
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
90 ### Cleanup
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
91 ###
1
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 clean:
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
93 -$(RM) $(TARGETS) *.class $(SRC)*.class
1
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
200
f6f8fd893c49 s/srcclean/distclean/g
Matti Hamalainen <ccr@tnsp.org>
parents: 197
diff changeset
96 distclean: clean
204
dd2caf5321ba Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 200
diff changeset
97 -$(RM) *~ game/*~ graphics/*~
12
c4cd811813ef Work on Makefile.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
98
1
44f1e7b47fcf Preliminary work ... puuh.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 # dummy