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