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