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