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