chiark / gitweb /
Just noticed another thing that could easily catch me out when
[sgt-puzzles.git] / 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 cygwin Makefile.cyg
14 !makefile osx Makefile.osx
15
16 WINDOWS  = windows user32.lib gdi32.lib comctl32.lib comdlg32.lib
17 COMMON   = midend misc malloc random version
18 NET      = net tree234 dsf
19 NETSLIDE = netslide tree234
20 MINES    = mines tree234
21 FLIP     = flip tree234
22 PEGS     = pegs tree234
23 UNTANGLE = untangle tree234
24 SLANT    = slant dsf
25 MAP      = map dsf
26
27 ALL      = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle
28          + MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT
29          + lightup MAP
30
31 net      : [X] gtk COMMON NET
32 netslide : [X] gtk COMMON NETSLIDE
33 cube     : [X] gtk COMMON cube
34 fifteen  : [X] gtk COMMON fifteen
35 sixteen  : [X] gtk COMMON sixteen
36 rect     : [X] gtk COMMON rect
37 pattern  : [X] gtk COMMON pattern
38 solo     : [X] gtk COMMON solo
39 twiddle  : [X] gtk COMMON twiddle
40 mines    : [X] gtk COMMON MINES
41 samegame : [X] gtk COMMON samegame
42 flip     : [X] gtk COMMON FLIP
43 guess    : [X] gtk COMMON guess
44 pegs     : [X] gtk COMMON PEGS
45 dominosa : [X] gtk COMMON dominosa
46 untangle : [X] gtk COMMON UNTANGLE
47 blackbox : [X] gtk COMMON blackbox
48 slant    : [X] gtk COMMON SLANT
49 lightup  : [X] gtk COMMON lightup
50 map      : [X] gtk COMMON MAP
51
52 # Auxiliary command-line programs.
53 solosolver :    [U] solo[STANDALONE_SOLVER] malloc
54 patternsolver : [U] pattern[STANDALONE_SOLVER] malloc
55 mineobfusc :    [U] mines[STANDALONE_OBFUSCATOR] malloc random tree234 misc
56 slantsolver :   [U] slant[STANDALONE_SOLVER] dsf malloc
57
58 solosolver :    [C] solo[STANDALONE_SOLVER] malloc
59 patternsolver : [C] pattern[STANDALONE_SOLVER] malloc
60 mineobfusc :    [C] mines[STANDALONE_OBFUSCATOR] malloc random tree234 misc
61 slantsolver :   [C] slant[STANDALONE_SOLVER] dsf malloc
62
63 # The Windows Net shouldn't be called `net.exe' since Windows
64 # already has a reasonably important utility program by that name!
65 netgame  : [G] WINDOWS COMMON NET
66 netslide : [G] WINDOWS COMMON NETSLIDE
67 cube     : [G] WINDOWS COMMON cube
68 fifteen  : [G] WINDOWS COMMON fifteen
69 sixteen  : [G] WINDOWS COMMON sixteen
70 rect     : [G] WINDOWS COMMON rect
71 pattern  : [G] WINDOWS COMMON pattern
72 solo     : [G] WINDOWS COMMON solo
73 twiddle  : [G] WINDOWS COMMON twiddle
74 mines    : [G] WINDOWS COMMON MINES
75 samegame : [G] WINDOWS COMMON samegame
76 flip     : [G] WINDOWS COMMON FLIP
77 guess    : [G] WINDOWS COMMON guess
78 pegs     : [G] WINDOWS COMMON PEGS
79 dominosa : [G] WINDOWS COMMON dominosa
80 untangle : [G] WINDOWS COMMON UNTANGLE
81 blackbox : [G] WINDOWS COMMON blackbox
82 slant    : [G] WINDOWS COMMON SLANT
83 lightup  : [G] WINDOWS COMMON lightup
84 map      : [G] WINDOWS COMMON MAP
85
86 # Mac OS X unified application containing all the puzzles.
87 Puzzles  : [MX] osx osx.icns osx-info.plist COMMON ALL
88 # For OS X, we must create the online help and include it in the
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
91 # all the puzzles. Then I've also got some code in here to build a
92 # distributable .dmg disk image.
93 !begin osx
94 CFLAGS += -DCOMBINED
95 Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
96 Puzzles.app/Contents/Resources/Help/index.html: \
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
100 Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
101         mkdir -p Puzzles.app/Contents/Resources/Help
102
103 release: Puzzles.dmg
104 Puzzles.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
116 !end
117
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.
126 nullgame : [X] gtk COMMON nullgame
127 nullgame : [G] WINDOWS COMMON nullgame
128
129 # Version management.
130 !begin vc
131 version.obj: *.c *.h
132         cl $(VER) $(CFLAGS) /c version.c
133 !end
134 !specialobj vc version
135 !begin cygwin
136 version.o: FORCE;
137 FORCE:
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
144 version.o: FORCE;
145 FORCE:
146         if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
147                 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
148         elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
149                 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
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
159 version.o: FORCE;
160 FORCE:
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; \
163         elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
164                 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
165         else \
166                 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
167         fi
168 !end
169 !specialobj osx version
170
171 # make install for Unix.
172 !begin gtk
173 install:
174         for i in cube net netslide fifteen sixteen twiddle \
175                  pattern rect solo mines samegame flip guess \
176                  pegs dominosa untangle blackbox slant lightup \
177                  map; do \
178                 $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i; \
179         done
180 !end