Miscellaneous fixes. Correct a comparison of y with w causing
[sgt/puzzles] / Recipe
... / ...
CommitLineData
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 cygwin Makefile.cyg
14!makefile osx Makefile.osx
15
16WINDOWS = windows printing
17 + user32.lib gdi32.lib comctl32.lib comdlg32.lib winspool.lib
18COMMON = midend drawing misc malloc random version
19NET = net tree234 dsf
20NETSLIDE = netslide tree234
21MINES = mines tree234
22FLIP = flip tree234
23PEGS = pegs tree234
24UNTANGLE = untangle tree234
25SLANT = slant dsf
26MAP = map dsf
27LOOPY = loopy tree234 dsf
28LIGHTUP = lightup combi
29TENTS = tents maxflow
30
31ALL = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle
32 + MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT
33 + LIGHTUP MAP LOOPY inertia TENTS
34
35GTK = gtk printing ps
36
37net : [X] GTK COMMON NET
38netslide : [X] GTK COMMON NETSLIDE
39cube : [X] GTK COMMON cube
40fifteen : [X] GTK COMMON fifteen
41sixteen : [X] GTK COMMON sixteen
42rect : [X] GTK COMMON rect
43pattern : [X] GTK COMMON pattern
44solo : [X] GTK COMMON solo
45twiddle : [X] GTK COMMON twiddle
46mines : [X] GTK COMMON MINES
47samegame : [X] GTK COMMON samegame
48flip : [X] GTK COMMON FLIP
49guess : [X] GTK COMMON guess
50pegs : [X] GTK COMMON PEGS
51dominosa : [X] GTK COMMON dominosa
52untangle : [X] GTK COMMON UNTANGLE
53blackbox : [X] GTK COMMON blackbox
54slant : [X] GTK COMMON SLANT
55lightup : [X] GTK COMMON LIGHTUP
56map : [X] GTK COMMON MAP
57loopy : [X] GTK COMMON LOOPY
58inertia : [X] GTK COMMON inertia
59tents : [X] GTK COMMON TENTS
60
61# Auxiliary command-line programs.
62STANDALONE = nullfe random misc malloc
63
64solosolver : [U] solo[STANDALONE_SOLVER] STANDALONE
65patternsolver : [U] pattern[STANDALONE_SOLVER] STANDALONE
66mineobfusc : [U] mines[STANDALONE_OBFUSCATOR] tree234 STANDALONE
67slantsolver : [U] slant[STANDALONE_SOLVER] dsf STANDALONE
68mapsolver : [U] map[STANDALONE_SOLVER] dsf STANDALONE m.lib
69lightupsolver : [U] lightup[STANDALONE_SOLVER] combi STANDALONE
70tentssolver : [U] tents[STANDALONE_SOLVER] maxflow STANDALONE
71
72solosolver : [C] solo[STANDALONE_SOLVER] STANDALONE
73patternsolver : [C] pattern[STANDALONE_SOLVER] STANDALONE
74mineobfusc : [C] mines[STANDALONE_OBFUSCATOR] tree234 STANDALONE
75slantsolver : [C] slant[STANDALONE_SOLVER] dsf STANDALONE
76mapsolver : [C] map[STANDALONE_SOLVER] dsf STANDALONE
77lightupsolver : [C] lightup[STANDALONE_SOLVER] combi STANDALONE
78tentssolver : [C] tents[STANDALONE_SOLVER] maxflow STANDALONE
79
80# The Windows Net shouldn't be called `net.exe' since Windows
81# already has a reasonably important utility program by that name!
82netgame : [G] WINDOWS COMMON NET
83netslide : [G] WINDOWS COMMON NETSLIDE
84cube : [G] WINDOWS COMMON cube
85fifteen : [G] WINDOWS COMMON fifteen
86sixteen : [G] WINDOWS COMMON sixteen
87rect : [G] WINDOWS COMMON rect
88pattern : [G] WINDOWS COMMON pattern
89solo : [G] WINDOWS COMMON solo
90twiddle : [G] WINDOWS COMMON twiddle
91mines : [G] WINDOWS COMMON MINES
92samegame : [G] WINDOWS COMMON samegame
93flip : [G] WINDOWS COMMON FLIP
94guess : [G] WINDOWS COMMON guess
95pegs : [G] WINDOWS COMMON PEGS
96dominosa : [G] WINDOWS COMMON dominosa
97untangle : [G] WINDOWS COMMON UNTANGLE
98blackbox : [G] WINDOWS COMMON blackbox
99slant : [G] WINDOWS COMMON SLANT
100lightup : [G] WINDOWS COMMON LIGHTUP
101map : [G] WINDOWS COMMON MAP
102loopy : [G] WINDOWS COMMON LOOPY
103inertia : [G] WINDOWS COMMON inertia
104tents : [G] WINDOWS COMMON TENTS
105
106# Mac OS X unified application containing all the puzzles.
107Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL
108# For OS X, we must create the online help and include it in the
109# application bundle.) Also we add -DCOMBINED to the compiler flags
110# so as to inform the code that we're building a single binary for
111# all the puzzles. Then I've also got some code in here to build a
112# distributable .dmg disk image.
113!begin osx
114CFLAGS += -DCOMBINED
115Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
116Puzzles.app/Contents/Resources/Help/index.html: \
117 Puzzles.app/Contents/Resources/Help osx-help.but puzzles.but
118 cd Puzzles.app/Contents/Resources/Help; \
119 halibut --html ../../../../osx-help.but ../../../../puzzles.but
120Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
121 mkdir -p Puzzles.app/Contents/Resources/Help
122
123release: Puzzles.dmg
124Puzzles.dmg: Puzzles
125 rm -f raw.dmg
126 hdiutil create -megabytes 5 -layout NONE raw.dmg
127 hdid -nomount raw.dmg > devicename
128 newfs_hfs -v "Simon Tatham's Puzzle Collection" `cat devicename`
129 hdiutil eject `cat devicename`
130 hdid raw.dmg | cut -f1 -d' ' > devicename
131 cp -R Puzzles.app /Volumes/"Simon Tatham's Puzzle Collection"
132 hdiutil eject `cat devicename`
133 rm -f Puzzles.dmg
134 hdiutil convert -format UDCO raw.dmg -o Puzzles.dmg
135 rm -f raw.dmg devicename
136!end
137
138# The `nullgame' source file is a largely blank one, which contains
139# all the correct function definitions to compile and link, but
140# which defines the null game in which nothing is ever drawn and
141# there are no valid moves. Its main purpose is to act as a
142# template for writing new game definition source files. I include
143# it in the Makefile because it will be worse than useless if it
144# ever fails to compile, so it's important that it should actually
145# be built on a regular basis.
146nullgame : [X] GTK COMMON nullgame
147nullgame : [G] WINDOWS COMMON nullgame
148
149# Version management.
150!begin vc
151version.obj: *.c *.h
152 cl $(VER) $(CFLAGS) /c version.c
153!end
154!specialobj vc version
155!begin cygwin
156version.o: FORCE;
157FORCE:
158 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c
159!end
160!specialobj cygwin version
161# For Unix, we also need the gross MD5 hack that causes automatic
162# version number selection in release source archives.
163!begin gtk
164version.o: FORCE;
165FORCE:
166 if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
167 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
168 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
169 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
170 else \
171 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
172 fi
173!end
174!specialobj gtk version
175# For OS X, this is made more fiddly by the fact that we don't have
176# md5sum readily available. We do, however, have `md5 -r' which
177# generates _nearly_ the same output, but it has no check function.
178!begin osx
179version.o: FORCE;
180FORCE:
181 if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
182 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
183 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
184 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
185 else \
186 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
187 fi
188!end
189!specialobj osx version
190
191# make install for Unix.
192!begin gtk
193install:
194 for i in cube net netslide fifteen sixteen twiddle \
195 pattern rect solo mines samegame flip guess \
196 pegs dominosa untangle blackbox slant lightup \
197 map loopy inertia tents; do \
198 $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \
199 || exit 1; \
200 done
201!end