720a8fb7 |
1 | # -*- makefile -*- |
2 | # |
3 | # This file describes which puzzle binaries are made up from which |
4 | # object and resource files. It is processed into the various |
5 | # Makefiles by means of a Perl script. Makefile changes should |
6 | # really be made by editing this file and/or the Perl script, not |
7 | # by editing the actual Makefiles. |
8 | |
9 | !name puzzles |
10 | |
11 | !makefile gtk Makefile |
4e7ef6e6 |
12 | !makefile vc Makefile.vc |
cb0c7d4a |
13 | !makefile wce Makefile.wce |
eb2ad6f1 |
14 | !makefile cygwin Makefile.cyg |
9494d866 |
15 | !makefile osx Makefile.osx |
2c930807 |
16 | !makefile nestedvm Makefile.nestedvm |
720a8fb7 |
17 | |
fa2cb13d |
18 | !srcdir icons/ |
19 | |
dc3de726 |
20 | WINDOWS_COMMON = printing |
821ab2c6 |
21 | + user32.lib gdi32.lib comctl32.lib comdlg32.lib winspool.lib |
dc3de726 |
22 | WINDOWS = windows WINDOWS_COMMON |
dafd6cf6 |
23 | COMMON = midend drawing misc malloc random version |
dafd6cf6 |
24 | GTK = gtk printing ps |
3f98cd5a |
25 | # Objects needed for auxiliary command-line programs. |
26 | STANDALONE = nullfe random misc malloc |
dafd6cf6 |
27 | |
3f98cd5a |
28 | ALL = list |
720a8fb7 |
29 | |
3f98cd5a |
30 | # First half of list.c. |
31 | !begin >list.c |
32 | /* |
33 | * list.c: List of pointers to puzzle structures, for monolithic |
34 | * platforms. |
35 | * |
36 | * This file is automatically generated by mkfiles.pl. Do not edit |
37 | * it directly, or the changes will be lost next time mkfiles.pl runs. |
38 | * Instead, edit Recipe and/or its *.R subfiles. |
39 | */ |
40 | #include "puzzles.h" |
41 | #define GAMELIST(A) \ |
42 | !end |
8317499a |
43 | |
3f98cd5a |
44 | # Now each .R file adds part of the macro definition of GAMELIST to list.c. |
45 | !include *.R |
9b265feb |
46 | |
3f98cd5a |
47 | # Then we finish up list.c as follows: |
48 | !begin >list.c |
8317499a |
49 | |
3f98cd5a |
50 | #define DECL(x) extern const game x; |
51 | #define REF(x) &x, |
52 | GAMELIST(DECL) |
53 | const game *gamelist[] = { GAMELIST(REF) }; |
54 | const int gamecount = lenof(gamelist); |
55 | !end |
699b896a |
56 | |
fb539d1b |
57 | # Unix standalone application for special-purpose obfuscation. |
58 | obfusc : [U] obfusc STANDALONE |
59 | |
dc3de726 |
60 | puzzles : [G] windows[COMBINED] WINDOWS_COMMON COMMON ALL noicon.res |
61 | |
9494d866 |
62 | # Mac OS X unified application containing all the puzzles. |
a96edf8a |
63 | Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL |
fccfd04d |
64 | # For OS X, we must create the online help and include it in the |
08f7c1b2 |
65 | # application bundle.) Also we add -DCOMBINED to the compiler flags |
66 | # so as to inform the code that we're building a single binary for |
c4a7369d |
67 | # all the puzzles. Then I've also got some code in here to build a |
68 | # distributable .dmg disk image. |
fccfd04d |
69 | !begin osx |
70 | Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html |
71 | Puzzles.app/Contents/Resources/Help/index.html: \ |
8709d5d9 |
72 | Puzzles.app/Contents/Resources/Help osx-help.but puzzles.but |
73 | cd Puzzles.app/Contents/Resources/Help; \ |
74 | halibut --html ../../../../osx-help.but ../../../../puzzles.but |
fccfd04d |
75 | Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources |
76 | mkdir -p Puzzles.app/Contents/Resources/Help |
c4a7369d |
77 | |
78 | release: Puzzles.dmg |
79 | Puzzles.dmg: Puzzles |
80 | rm -f raw.dmg |
81 | hdiutil create -megabytes 5 -layout NONE raw.dmg |
82 | hdid -nomount raw.dmg > devicename |
83 | newfs_hfs -v "Simon Tatham's Puzzle Collection" `cat devicename` |
84 | hdiutil eject `cat devicename` |
85 | hdid raw.dmg | cut -f1 -d' ' > devicename |
86 | cp -R Puzzles.app /Volumes/"Simon Tatham's Puzzle Collection" |
87 | hdiutil eject `cat devicename` |
88 | rm -f Puzzles.dmg |
89 | hdiutil convert -format UDCO raw.dmg -o Puzzles.dmg |
90 | rm -f raw.dmg devicename |
fccfd04d |
91 | !end |
9494d866 |
92 | |
97098757 |
93 | # Version management. |
94 | !begin vc |
95 | version.obj: *.c *.h |
96 | cl $(VER) $(CFLAGS) /c version.c |
97 | !end |
98 | !specialobj vc version |
cb0c7d4a |
99 | !begin wce |
100 | version.obj: *.c *.h |
101 | $(CC) $(VER) $(CFLAGS) /c version.c |
102 | !end |
103 | !specialobj wce version |
97098757 |
104 | !begin cygwin |
36d01ffa |
105 | version.o: FORCE; |
97098757 |
106 | FORCE: |
107 | $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c |
108 | !end |
109 | !specialobj cygwin version |
110 | # For Unix, we also need the gross MD5 hack that causes automatic |
111 | # version number selection in release source archives. |
112 | !begin gtk |
68fc254b |
113 | version.o: version.c version2.def |
114 | $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version2.def` -c version.c |
115 | version2.def: FORCE |
118fcd8b |
116 | if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \ |
68fc254b |
117 | cat version.def > version2.def.new; \ |
c1f500c0 |
118 | elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \ |
68fc254b |
119 | echo "-DREVISION=`svnversion .`" >version2.def.new; \ |
120 | else \ |
121 | echo "$(VER)" >version2.def.new; \ |
122 | fi && \ |
123 | if diff -q version2.def.new version2.def; then \ |
124 | rm version2.def.new; \ |
97098757 |
125 | else \ |
68fc254b |
126 | mv version2.def.new version2.def; \ |
97098757 |
127 | fi |
68fc254b |
128 | .PHONY: FORCE |
97098757 |
129 | !end |
130 | !specialobj gtk version |
2c930807 |
131 | !begin nestedvm |
68fc254b |
132 | version.o: version.c version2.def |
133 | $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version2.def` -c version.c |
134 | version2.def: FORCE |
2c930807 |
135 | if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \ |
68fc254b |
136 | cat version.def > version2.def.new; \ |
2c930807 |
137 | elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \ |
68fc254b |
138 | echo "-DREVISION=`svnversion .`" >version2.def.new; \ |
139 | else \ |
140 | echo "$(VER)" >version2.def.new; \ |
141 | fi && \ |
142 | if diff -q version2.def.new version2.def; then \ |
143 | rm version2.def.new; \ |
2c930807 |
144 | else \ |
68fc254b |
145 | mv version2.def.new version2.def; \ |
2c930807 |
146 | fi |
68fc254b |
147 | .PHONY: FORCE |
2c930807 |
148 | !end |
149 | !specialobj nestedvm version |
97098757 |
150 | # For OS X, this is made more fiddly by the fact that we don't have |
151 | # md5sum readily available. We do, however, have `md5 -r' which |
152 | # generates _nearly_ the same output, but it has no check function. |
153 | !begin osx |
68fc254b |
154 | version.ppc.o: version.c version2.def |
f95da860 |
155 | $(CC) -arch ppc $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version2.def` -c version.c -o $@ |
68fc254b |
156 | version.i386.o: version.c version2.def |
f95da860 |
157 | $(CC) -arch i386 $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version2.def` -c version.c -o $@ |
68fc254b |
158 | version2.def: FORCE |
97098757 |
159 | if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \ |
68fc254b |
160 | cat version.def > version2.def.new; \ |
c1f500c0 |
161 | elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \ |
68fc254b |
162 | echo "-DREVISION=`svnversion .`" >version2.def.new; \ |
97098757 |
163 | else \ |
68fc254b |
164 | echo "$(VER)" >version2.def.new; \ |
165 | fi && \ |
166 | if diff -q version2.def.new version2.def; then \ |
167 | rm version2.def.new; \ |
d68d8560 |
168 | else \ |
68fc254b |
169 | mv version2.def.new version2.def; \ |
97098757 |
170 | fi |
68fc254b |
171 | .PHONY: FORCE |
26a9ad56 |
172 | !end |
97098757 |
173 | !specialobj osx version |
fd38f463 |
174 | |
175 | # make install for Unix. |
176 | !begin gtk |
177 | install: |
3f98cd5a |
178 | for i in $(GAMES); do \ |
0d336b11 |
179 | $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \ |
180 | || exit 1; \ |
fd38f463 |
181 | done |
182 | !end |
2c930807 |
183 | !begin nestedvm |
184 | .PRECIOUS: %.class |
185 | %.class: %.mips |
186 | java -cp $(NESTEDVM)/build:$(NESTEDVM)/upstream/build/classgen/build \ |
187 | org.ibex.nestedvm.Compiler -outformat class -d . \ |
188 | PuzzleEngine $< |
189 | mv PuzzleEngine.class $@ |
190 | |
191 | org: |
192 | mkdir -p org/ibex/nestedvm/util |
193 | cp $(NESTEDVM)/build/org/ibex/nestedvm/{Registers,UsermodeConstants,Runtime*}.class org/ibex/nestedvm |
194 | cp $(NESTEDVM)/build/org/ibex/nestedvm/util/{Platform*,Seekable*}.class org/ibex/nestedvm/util |
195 | echo "Main-Class: PuzzleApplet" >applet.manifest |
196 | |
197 | PuzzleApplet.class: PuzzleApplet.java org |
198 | javac -source 1.3 -target 1.3 PuzzleApplet.java |
199 | |
200 | %.jar: %.class PuzzleApplet.class org |
201 | mv $< PuzzleEngine.class |
202 | jar cfm $@ applet.manifest PuzzleEngine.class PuzzleApplet*.class org |
203 | echo '<applet archive="'$@'" code="PuzzleApplet" width="700" height="500"></applet>' >$*.html |
204 | mv PuzzleEngine.class $< |
205 | !end |