chiark / gitweb /
New puzzle: `Slant', picked from the Japanese-language section of
[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
26 ALL      = list NET NETSLIDE cube fifteen sixteen rect pattern solo twiddle
27          + MINES samegame FLIP guess PEGS dominosa UNTANGLE blackbox SLANT
28
29 net      : [X] gtk COMMON NET
30 netslide : [X] gtk COMMON NETSLIDE
31 cube     : [X] gtk COMMON cube
32 fifteen  : [X] gtk COMMON fifteen
33 sixteen  : [X] gtk COMMON sixteen
34 rect     : [X] gtk COMMON rect
35 pattern  : [X] gtk COMMON pattern
36 solo     : [X] gtk COMMON solo
37 twiddle  : [X] gtk COMMON twiddle
38 mines    : [X] gtk COMMON MINES
39 samegame : [X] gtk COMMON samegame
40 flip     : [X] gtk COMMON FLIP
41 guess    : [X] gtk COMMON guess
42 pegs     : [X] gtk COMMON PEGS
43 dominosa : [X] gtk COMMON dominosa
44 untangle : [X] gtk COMMON UNTANGLE
45 blackbox : [X] gtk COMMON blackbox
46 slant    : [X] gtk COMMON SLANT
47
48 # Auxiliary command-line programs.
49 solosolver :    [U] solo[STANDALONE_SOLVER] malloc
50 patternsolver : [U] pattern[STANDALONE_SOLVER] malloc
51 mineobfusc :    [U] mines[STANDALONE_OBFUSCATOR] malloc random tree234 misc
52
53 solosolver :    [C] solo[STANDALONE_SOLVER] malloc
54 patternsolver : [C] pattern[STANDALONE_SOLVER] malloc
55 mineobfusc :    [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!
59 netgame  : [G] WINDOWS COMMON NET
60 netslide : [G] WINDOWS COMMON NETSLIDE
61 cube     : [G] WINDOWS COMMON cube
62 fifteen  : [G] WINDOWS COMMON fifteen
63 sixteen  : [G] WINDOWS COMMON sixteen
64 rect     : [G] WINDOWS COMMON rect
65 pattern  : [G] WINDOWS COMMON pattern
66 solo     : [G] WINDOWS COMMON solo
67 twiddle  : [G] WINDOWS COMMON twiddle
68 mines    : [G] WINDOWS COMMON MINES
69 samegame : [G] WINDOWS COMMON samegame
70 flip     : [G] WINDOWS COMMON FLIP
71 guess    : [G] WINDOWS COMMON guess
72 pegs     : [G] WINDOWS COMMON PEGS
73 dominosa : [G] WINDOWS COMMON dominosa
74 untangle : [G] WINDOWS COMMON UNTANGLE
75 blackbox : [G] WINDOWS COMMON blackbox
76 slant    : [G] WINDOWS COMMON SLANT
77
78 # Mac OS X unified application containing all the puzzles.
79 Puzzles  : [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
86 CFLAGS += -DCOMBINED
87 Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
88 Puzzles.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
92 Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
93         mkdir -p Puzzles.app/Contents/Resources/Help
94
95 release: Puzzles.dmg
96 Puzzles.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.
118 nullgame : [X] gtk COMMON nullgame
119 nullgame : [G] WINDOWS COMMON nullgame
120
121 # Version management.
122 !begin vc
123 version.obj: *.c *.h
124         cl $(VER) $(CFLAGS) /c version.c
125 !end
126 !specialobj vc version
127 !begin cygwin
128 version.o: FORCE;
129 FORCE:
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
136 version.o: FORCE;
137 FORCE:
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
151 version.o: FORCE;
152 FORCE:
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
165 install:
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