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