OSDN Git Service

upgrade to 3.6.2
[jnethack/source.git] / sys / unix / Makefile.top
1 #      NetHack Top-level Makefile.
2 # NetHack 3.6  Makefile.top    $NHDT-Date: 1524689449 2018/04/25 20:50:49 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $
3 # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
4 # NetHack may be freely redistributed.  See license for details.
5
6 # Root of source tree:
7 NHSROOT=.
8
9 # newer makes predefine $(MAKE) to 'make' and do smarter processing of
10 # recursive make calls if $(MAKE) is used
11 # these makes allow $(MAKE) to be overridden by the environment if someone
12 # wants to (or has to) use something other than the standard make, so we do
13 # not want to unconditionally set $(MAKE) here
14 #
15 # unfortunately, some older makes do not predefine $(MAKE); if you have one of
16 # these, uncomment the following line
17 # (you will know that you have one if you get complaints about unable to
18 # execute things like 'data' and 'rumors')
19 # MAKE = make
20
21 # make NetHack
22 #PREFIX  = /usr
23 # GAME     = nethack
24 GAME     = jnethack
25 # GAME     = nethack.prg
26 #GAMEUID  = games
27 #GAMEGRP  = bin
28
29 # Permissions - some places use setgid instead of setuid, for instance
30 # See also the option "SECURE" in include/config.h
31 #GAMEPERM = 04755
32 FILEPERM = 0644
33 # VARFILEPERM = 0644
34 EXEPERM  = 0755
35 DIRPERM  = 0755
36 # VARDIRPERM = 0755
37
38 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
39 #
40 # note that 'make install' believes in creating a nice tidy HACKDIR for
41 # installation, free of debris from previous NetHack versions --
42 # therefore there should not be anything in HACKDIR that you want to keep
43 # (if there is, you'll have to do the installation by hand or modify the
44 # instructions)
45 #HACKDIR  = $(PREFIX)/games/lib/$(GAME)dir
46 #VARDIR  = $(HACKDIR)
47 # Where nethack.sh in installed.  If this is not defined, the wrapper is not used.
48 #SHELLDIR = $(PREFIX)/games
49
50 # per discussion in Install.X11 and Install.Qt
51 #VARDATND = 
52 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
53 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
54 # for Atari/Gem
55 # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
56 # for BeOS
57 # VARDATND = beostiles
58 # for Gnome
59 # VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
60
61 VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors
62 VARDAT = $(VARDATD) $(VARDATND)
63
64 # Some versions of make use the SHELL environment variable as the shell
65 # for running commands.  We need this to be a Bourne shell.
66 # SHELL = /bin/sh
67 # for Atari
68 # SHELL=E:/GEMINI2/MUPFEL.TTP
69
70 # Commands for setting the owner and group on files during installation.
71 # Some systems fail with one or the other when installing over NFS or for
72 # other permission-related reasons.  If that happens, you may want to set the
73 # command to "true", which is a no-op. Note that disabling chown or chgrp
74 # will only work if setuid (or setgid) behavior is not desired or required.
75 #CHOWN = chown
76 #CHGRP = chgrp
77
78 #
79 # end of configuration
80 #
81
82 DATHELP = help hh cmdhelp keyhelp history opthelp wizhelp
83
84 SPEC_LEVS = asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev \
85         juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \
86         minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \
87         tower?.lev valley.lev wizard?.lev \
88         astral.lev air.lev earth.lev fire.lev water.lev
89 QUEST_LEVS = ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev
90
91 DATNODLB = $(VARDATND) license symbols
92 DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
93 DAT = $(DATNODLB) $(DATDLB)
94
95 $(GAME):
96         ( cd src ; $(MAKE) )
97
98 all:    $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
99         true; $(MOREALL)
100         @echo "Done."
101
102 # Note: many of the dependencies below are here to allow parallel make
103 # to generate valid output
104
105 Guidebook:
106         ( cd doc ; $(MAKE) Guidebook )
107
108 manpages:
109         ( cd doc ; $(MAKE) manpages )
110
111 data: $(GAME)
112         ( cd dat ; $(MAKE) data )
113
114 engrave: $(GAME)
115         ( cd dat ; $(MAKE) engrave )
116
117 bogusmon: $(GAME)
118         ( cd dat ; $(MAKE) bogusmon )
119
120 epitaph: $(GAME)
121         ( cd dat ; $(MAKE) epitaph )
122
123 rumors: $(GAME)
124         ( cd dat ; $(MAKE) rumors )
125
126 oracles: $(GAME)
127         ( cd dat ; $(MAKE) oracles )
128
129 #       Note: options should have already been made with make, but...
130 options: $(GAME)
131         ( cd dat ; $(MAKE) options )
132
133 quest.dat: $(GAME)
134         ( cd dat ; $(MAKE) quest.dat )
135
136 spec_levs: dungeon
137         ( cd util ; $(MAKE) lev_comp )
138         ( cd dat ; $(MAKE) spec_levs )
139         ( cd dat ; $(MAKE) quest_levs )
140
141 dungeon: $(GAME)
142         ( cd util ; $(MAKE) dgn_comp )
143         ( cd dat ; $(MAKE) dungeon )
144
145 nhtiles.bmp: $(GAME)
146         ( cd dat ; $(MAKE) nhtiles.bmp )
147
148 x11tiles: $(GAME)
149         ( cd util ; $(MAKE) tile2x11 )
150         ( cd dat ; $(MAKE) x11tiles )
151
152 beostiles: $(GAME)
153         ( cd util ; $(MAKE) tile2beos )
154         ( cd dat ; $(MAKE) beostiles )
155
156 JNetHack.ad: $(GAME)
157         ( cd dat ; $(MAKE) JNetHack.ad )
158
159 pet_mark.xbm:
160         ( cd dat ; $(MAKE) pet_mark.xbm )
161
162 pilemark.xbm:
163         ( cd dat ; $(MAKE) pilemark.xbm )
164
165 rip.xpm:
166         ( cd dat ; $(MAKE) rip.xpm )
167
168 mapbg.xpm:
169         (cd dat ; $(MAKE) mapbg.xpm )
170
171 nhsplash.xpm:
172         ( cd dat ; $(MAKE) nhsplash.xpm )
173
174 nh16.img: $(GAME)
175         ( cd util ; $(MAKE) tile2img.ttp )
176         ( cd dat ; $(MAKE) nh16.img )
177
178 rip.img:
179         ( cd util ; $(MAKE) xpm2img.ttp )
180         ( cd dat ; $(MAKE) rip.img )
181 GEM_RSC.RSC:
182         ( cd dat ; $(MAKE) GEM_RSC.RSC )
183
184 title.img:
185         ( cd dat ; $(MAKE) title.img )
186
187 check-dlb: options
188         @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
189
190 dlb:
191         ( cd util ; $(MAKE) dlb )
192         ( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
193
194 # recover can be used when INSURANCE is defined in include/config.h
195 # and the checkpoint option is true
196 recover: $(GAME)
197         ( cd util ; $(MAKE) recover )
198
199 dofiles:
200         target=`sed -n                                  \
201                 -e '/librarian/{'                       \
202                 -e      's/.*/dlb/p'                    \
203                 -e      'q'                             \
204                 -e '}'                                  \
205                 -e '$$s/.*/nodlb/p' < dat/options` ;    \
206         $(MAKE) dofiles-$${target-nodlb}
207         cp src/$(GAME) $(INSTDIR)
208         cp util/recover $(INSTDIR)
209         -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
210         if test -n '$(SHELLDIR)'; then \
211                 sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
212                 -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
213                 < sys/unix/nethack.sh \
214                 > $(SHELLDIR)/$(GAME) ; fi
215 # set up their permissions
216         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
217                         $(CHGRP) $(GAMEGRP) $(GAME) recover )
218         chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
219         chmod $(EXEPERM) $(INSTDIR)/recover
220         -if test -n '$(SHELLDIR)'; then \
221                 $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
222         if test -n '$(SHELLDIR)'; then \
223                 $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
224                 chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
225
226 dofiles-dlb: check-dlb
227         ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
228 # set up their permissions
229         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
230                         $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
231                         chmod $(FILEPERM) nhdat $(DATNODLB) )
232
233 dofiles-nodlb:
234 # copy over the game files
235         ( cd dat ; cp $(DAT) $(INSTDIR) )
236 # set up their permissions
237         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
238                         $(CHGRP) $(GAMEGRP) $(DAT) ; \
239                         chmod $(FILEPERM) $(DAT) )
240
241 update: $(GAME) recover $(VARDAT) dungeon spec_levs
242 #       (don't yank the old version out from under people who're playing it)
243         -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
244 #       quest.dat is also kept open and has the same problems over NFS
245 #       (quest.dat may be inside nhdat if dlb is in use)
246         -mv $(INSTDIR)/quest.dat $(INSTDIR)/quest.dat.old
247         -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
248 # set up new versions of the game files
249         ( $(MAKE) dofiles )
250 # touch time-sensitive files
251         -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
252         -touch -c $(VARDIR)/save/*
253         touch $(VARDIR)/perm $(VARDIR)/record
254 # and a reminder
255         @echo You may also want to install the man pages via the doc Makefile.
256
257 rootcheck:
258         @true; $(ROOTCHECK)
259
260 install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
261         true; $(PREINSTALL)
262 # set up the directories
263 # not all mkdirs have -p; those that don't will create a -p directory
264         -if test -n '$(SHELLDIR)'; then \
265                 mkdir -p $(SHELLDIR); fi
266         rm -rf $(INSTDIR) $(VARDIR)
267         -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save
268         if test -d ./-p; then rmdir ./-p; fi
269         -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save
270         $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save
271 # order counts here:
272         chmod $(DIRPERM) $(INSTDIR)
273         chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
274 # set up the game files
275         ( $(MAKE) dofiles )
276 # set up some additional files
277         touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile
278         -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \
279                         $(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \
280                         chmod $(VARFILEPERM) perm record logfile xlogfile )
281         true; $(POSTINSTALL)
282 # and a reminder
283         @echo You may also want to reinstall the man pages via the doc Makefile.
284
285
286 # 'make clean' removes all the .o files, but leaves around all the executables
287 # and compiled data files
288 clean:
289         ( cd src ; $(MAKE) clean )
290         ( cd util ; $(MAKE) clean )
291         ( cd doc ; $(MAKE) clean )
292
293 # 'make spotless' returns the source tree to near-distribution condition.
294 # it removes .o files, executables, and compiled data files
295 spotless::
296         ( cd src ; $(MAKE) spotless )
297         ( cd util ; $(MAKE) spotless )
298         ( cd dat ; $(MAKE) spotless )
299         ( cd doc ; $(MAKE) spotless )