Environment-based configuration wasn't sensibly usable in games with
[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 user32.lib gdi32.lib comctl32.lib comdlg32.lib
17COMMON = midend misc malloc random version
18NET = net tree234 dsf
19NETSLIDE = netslide tree234
20MINES = mines tree234
21FLIP = flip tree234
22PEGS = pegs tree234
23UNTANGLE = untangle tree234
24SLANT = slant dsf
25
26ALL = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle
27 + MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT
28
29net : [X] gtk COMMON NET
30netslide : [X] gtk COMMON NETSLIDE
31cube : [X] gtk COMMON cube
32fifteen : [X] gtk COMMON fifteen
33sixteen : [X] gtk COMMON sixteen
34rect : [X] gtk COMMON rect
35pattern : [X] gtk COMMON pattern
36solo : [X] gtk COMMON solo
37twiddle : [X] gtk COMMON twiddle
38mines : [X] gtk COMMON MINES
39samegame : [X] gtk COMMON samegame
40flip : [X] gtk COMMON FLIP
41guess : [X] gtk COMMON guess
42pegs : [X] gtk COMMON PEGS
43dominosa : [X] gtk COMMON dominosa
44untangle : [X] gtk COMMON UNTANGLE
45blackbox : [X] gtk COMMON blackbox
46slant : [X] gtk COMMON SLANT
47
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
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
60netslide : [G] WINDOWS COMMON NETSLIDE
61cube : [G] WINDOWS COMMON cube
62fifteen : [G] WINDOWS COMMON fifteen
63sixteen : [G] WINDOWS COMMON sixteen
64rect : [G] WINDOWS COMMON rect
65pattern : [G] WINDOWS COMMON pattern
66solo : [G] WINDOWS COMMON solo
67twiddle : [G] WINDOWS COMMON twiddle
68mines : [G] WINDOWS COMMON MINES
69samegame : [G] WINDOWS COMMON samegame
70flip : [G] WINDOWS COMMON FLIP
71guess : [G] WINDOWS COMMON guess
72pegs : [G] WINDOWS COMMON PEGS
73dominosa : [G] WINDOWS COMMON dominosa
74untangle : [G] WINDOWS COMMON UNTANGLE
75blackbox : [G] WINDOWS COMMON blackbox
76slant : [G] WINDOWS COMMON SLANT
77
78# Mac OS X unified application containing all the puzzles.
79Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL
80# For OS X, we must create the online help and include it in the
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
83# all the puzzles. Then I've also got some code in here to build a
84# distributable .dmg disk image.
85!begin osx
86CFLAGS += -DCOMBINED
87Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
88Puzzles.app/Contents/Resources/Help/index.html: \
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
92Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
93 mkdir -p Puzzles.app/Contents/Resources/Help
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
108!end
109
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
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
128version.o: FORCE;
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:
138 if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
139 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
140 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
141 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
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; \
155 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
156 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
157 else \
158 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
159 fi
160!end
161!specialobj osx version
162
163# make install for Unix.
164!begin gtk
165install:
166 for i in cube net netslide fifteen sixteen twiddle \
167 pattern rect solo mines samegame flip guess \
168 pegs dominosa untangle blackbox slant; do \
169 $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i; \
170 done
171!end