chiark / gitweb /
Update changelog for 20170923.ff218728-0+iwj2~3.gbpc58e0c release
[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.gtk
12 !makefile am Makefile.am
13 !makefile vc Makefile.vc
14 !makefile wce Makefile.wce
15 !makefile cygwin Makefile.cyg
16 !makefile osx Makefile.osx
17 !makefile gnustep Makefile.gnustep
18 !makefile nestedvm Makefile.nestedvm
19 !makefile emcc Makefile.emcc
20 !makefile clangcl Makefile.clangcl
21
22 !srcdir icons/
23
24 WINDOWS_COMMON = printing
25          + user32.lib gdi32.lib comctl32.lib comdlg32.lib winspool.lib
26 WINDOWS  = windows WINDOWS_COMMON
27 COMMON   = midend drawing misc malloc random version
28 GTK      = gtk printing ps
29 # Objects needed for auxiliary command-line programs.
30 STANDALONE = nullfe random misc malloc
31
32 ALL      = list
33
34 # First half of list.c.
35 !begin >list.c
36 /*
37  * list.c: List of pointers to puzzle structures, for monolithic
38  * platforms.
39  *
40  * This file is automatically generated by mkfiles.pl. Do not edit
41  * it directly, or the changes will be lost next time mkfiles.pl runs.
42  * Instead, edit Recipe and/or its *.R subfiles.
43  */
44 #include "puzzles.h"
45 #define GAMELIST(A) \
46 !end
47
48 # Now each .R file adds part of the macro definition of GAMELIST to list.c.
49 !include *.R
50
51 # Then we finish up list.c as follows:
52 !begin >list.c
53
54 #define DECL(x) extern const game x;
55 #define REF(x) &x,
56 GAMELIST(DECL)
57 const game *gamelist[] = { GAMELIST(REF) };
58 const int gamecount = lenof(gamelist);
59 !end
60
61 # Unix standalone application for special-purpose obfuscation.
62 obfusc : [U] obfusc STANDALONE
63
64 puzzles  : [G] windows[COMBINED] WINDOWS_COMMON COMMON ALL noicon.res
65
66 # Mac OS X unified application containing all the puzzles.
67 Puzzles  : [MX] osx osx.icns osx-info.plist COMMON ALL
68 # For OS X, we must create the online help and include it in the
69 # application bundle.) Also we add -DCOMBINED to the compiler flags
70 # so as to inform the code that we're building a single binary for
71 # all the puzzles. Then I've also got some code in here to build a
72 # distributable .dmg disk image.
73 !begin osx
74 Puzzles_extra = Puzzles.app/Contents/Resources/Help/index.html
75 Puzzles.app/Contents/Resources/Help/index.html: \
76         Puzzles.app/Contents/Resources/Help osx-help.but puzzles.but
77         cd Puzzles.app/Contents/Resources/Help; \
78                 halibut --html ../../../../osx-help.but ../../../../puzzles.but
79 Puzzles.app/Contents/Resources/Help: Puzzles.app/Contents/Resources
80         mkdir -p Puzzles.app/Contents/Resources/Help
81
82 release: Puzzles.dmg
83 Puzzles.dmg: Puzzles
84         rm -f raw.dmg
85         hdiutil create -megabytes 5 -layout NONE raw.dmg
86         hdid -nomount raw.dmg > devicename
87         newfs_hfs -v "Simon Tatham's Puzzle Collection" `cat devicename`
88         hdiutil eject `cat devicename`
89         hdid raw.dmg | cut -f1 -d' ' > devicename
90         cp -R Puzzles.app /Volumes/"Simon Tatham's Puzzle Collection"
91         hdiutil eject `cat devicename`
92         rm -f Puzzles.dmg
93         hdiutil convert -format UDCO raw.dmg -o Puzzles.dmg
94         rm -f raw.dmg devicename
95 !end
96
97 !begin am
98 bin_PROGRAMS = $(GAMES)
99 GTK_CFLAGS += -DSHAREDIR="\"$(datarootdir)\""
100 !end
101 !begin am_begin
102 GAMES =
103 !end
104
105 # make install for Unix.
106 !begin gtk
107 install:
108         for i in $(GAMES); do \
109                 $(INSTALL_PROGRAM) -m 755 $(BINPREFIX)$$i $(DESTDIR)$(gamesdir)/$(BINPREFIX)$$i \
110                 || exit 1; \
111         done
112 !end
113 !begin nestedvm
114 .PRECIOUS: %.class
115 %.class: %.mips
116         java -cp $(NESTEDVM)/build:$(NESTEDVM)/upstream/build/classgen/build \
117                 org.ibex.nestedvm.Compiler -outformat class -d . \
118                 PuzzleEngine $<
119                 mv PuzzleEngine.class $@
120
121 org:
122         mkdir -p org/ibex/nestedvm/util
123         cp $(NESTEDVM)/build/org/ibex/nestedvm/Registers.class org/ibex/nestedvm
124         cp $(NESTEDVM)/build/org/ibex/nestedvm/UsermodeConstants.class org/ibex/nestedvm
125         cp $(NESTEDVM)/build/org/ibex/nestedvm/Runtime*.class org/ibex/nestedvm
126         cp $(NESTEDVM)/build/org/ibex/nestedvm/util/Platform*.class org/ibex/nestedvm/util
127         cp $(NESTEDVM)/build/org/ibex/nestedvm/util/Seekable*.class org/ibex/nestedvm/util
128         echo "Main-Class: PuzzleApplet" >applet.manifest
129
130 PuzzleApplet.class: PuzzleApplet.java org
131         javac -source 1.3 -target 1.3 PuzzleApplet.java
132
133 %.jar: %.class PuzzleApplet.class org
134         mv $< PuzzleEngine.class
135         jar cfm $@ applet.manifest PuzzleEngine.class PuzzleApplet*.class org
136         echo '<applet archive="'$@'" code="PuzzleApplet" width="700" height="500"></applet>' >$*.html
137         mv PuzzleEngine.class $<
138 !end
139
140 # A benchmarking and testing target for the GTK puzzles.
141 !begin gtk
142 test: benchmark.html benchmark.txt
143
144 benchmark.html: benchmark.txt benchmark.pl
145         ./benchmark.pl benchmark.txt > $@
146
147 benchmark.txt: benchmark.sh $(GAMES)
148         ./benchmark.sh > $@
149
150 !end
151 !begin am
152 test: benchmark.html benchmark.txt
153
154 benchmark.html: benchmark.txt benchmark.pl
155         ./benchmark.pl benchmark.txt > $@
156
157 benchmark.txt: benchmark.sh $(GAMES)
158         ./benchmark.sh > $@
159 !end