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