Phil Bordelon points out an off-by-one error: since Solo doesn't use
[sgt/puzzles] / Recipe
CommitLineData
720a8fb7 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
4e7ef6e6 12!makefile vc Makefile.vc
eb2ad6f1 13!makefile cygwin Makefile.cyg
9494d866 14!makefile osx Makefile.osx
720a8fb7 15
fa2cb13d 16!srcdir icons/
17
821ab2c6 18WINDOWS = windows printing
19 + user32.lib gdi32.lib comctl32.lib comdlg32.lib winspool.lib
dafd6cf6 20COMMON = midend drawing misc malloc random version
dafd6cf6 21GTK = gtk printing ps
3f98cd5a 22# Objects needed for auxiliary command-line programs.
23STANDALONE = nullfe random misc malloc
dafd6cf6 24
3f98cd5a 25ALL = list
720a8fb7 26
3f98cd5a 27# First half of list.c.
28!begin >list.c
29/*
30 * list.c: List of pointers to puzzle structures, for monolithic
31 * platforms.
32 *
33 * This file is automatically generated by mkfiles.pl. Do not edit
34 * it directly, or the changes will be lost next time mkfiles.pl runs.
35 * Instead, edit Recipe and/or its *.R subfiles.
36 */
37#include "puzzles.h"
38#define GAMELIST(A) \
39!end
8317499a 40
3f98cd5a 41# Now each .R file adds part of the macro definition of GAMELIST to list.c.
42!include *.R
9b265feb 43
3f98cd5a 44# Then we finish up list.c as follows:
45!begin >list.c
8317499a 46
3f98cd5a 47#define DECL(x) extern const game x;
48#define REF(x) &x,
49GAMELIST(DECL)
50const game *gamelist[] = { GAMELIST(REF) };
51const int gamecount = lenof(gamelist);
52!end
699b896a 53
9494d866 54# Mac OS X unified application containing all the puzzles.
a96edf8a 55Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL
fccfd04d 56# For OS X, we must create the online help and include it in the
08f7c1b2 57# application bundle.) Also we add -DCOMBINED to the compiler flags
58# so as to inform the code that we're building a single binary for
c4a7369d 59# all the puzzles. Then I've also got some code in here to build a
60# distributable .dmg disk image.
fccfd04d 61!begin osx
08f7c1b2 62CFLAGS += -DCOMBINED
fccfd04d 63Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
64Puzzles.app/Contents/Resources/Help/index.html: \
8709d5d9 65 Puzzles.app/Contents/Resources/Help osx-help.but puzzles.but
66 cd Puzzles.app/Contents/Resources/Help; \
67 halibut --html ../../../../osx-help.but ../../../../puzzles.but
fccfd04d 68Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
69 mkdir -p Puzzles.app/Contents/Resources/Help
c4a7369d 70
71release: Puzzles.dmg
72Puzzles.dmg: Puzzles
73 rm -f raw.dmg
74 hdiutil create -megabytes 5 -layout NONE raw.dmg
75 hdid -nomount raw.dmg > devicename
76 newfs_hfs -v "Simon Tatham's Puzzle Collection" `cat devicename`
77 hdiutil eject `cat devicename`
78 hdid raw.dmg | cut -f1 -d' ' > devicename
79 cp -R Puzzles.app /Volumes/"Simon Tatham's Puzzle Collection"
80 hdiutil eject `cat devicename`
81 rm -f Puzzles.dmg
82 hdiutil convert -format UDCO raw.dmg -o Puzzles.dmg
83 rm -f raw.dmg devicename
fccfd04d 84!end
9494d866 85
97098757 86# Version management.
87!begin vc
88version.obj: *.c *.h
89 cl $(VER) $(CFLAGS) /c version.c
90!end
91!specialobj vc version
92!begin cygwin
36d01ffa 93version.o: FORCE;
97098757 94FORCE:
95 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c
96!end
97!specialobj cygwin version
98# For Unix, we also need the gross MD5 hack that causes automatic
99# version number selection in release source archives.
100!begin gtk
101version.o: FORCE;
102FORCE:
118fcd8b 103 if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
97098757 104 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
eb935f91 105 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
118fcd8b 106 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
97098757 107 else \
108 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
109 fi
110!end
111!specialobj gtk version
112# For OS X, this is made more fiddly by the fact that we don't have
113# md5sum readily available. We do, however, have `md5 -r' which
114# generates _nearly_ the same output, but it has no check function.
115!begin osx
116version.o: FORCE;
117FORCE:
118 if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
119 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c; \
eb935f91 120 elif test -z "$(VER)" && test -d .svn && svnversion . >&/dev/null; then \
118fcd8b 121 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) "-DREVISION=`svnversion .`" -c version.c; \
97098757 122 else \
123 $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) $(VER) -c version.c; \
124 fi
125!end
126!specialobj osx version
fd38f463 127
128# make install for Unix.
129!begin gtk
130install:
3f98cd5a 131 for i in $(GAMES); do \
0d336b11 132 $(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \
133 || exit 1; \
fd38f463 134 done
135!end