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