2 # NetHack 3.6 Makefile.top $NHDT-Date: 1447844578 2015/11/18 11:02:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.32 $
7 # newer makes predefine $(MAKE) to 'make' and do smarter processing of
8 # recursive make calls if $(MAKE) is used
9 # these makes allow $(MAKE) to be overridden by the environment if someone
10 # wants to (or has to) use something other than the standard make, so we do
11 # not want to unconditionally set $(MAKE) here
13 # unfortunately, some older makes do not predefine $(MAKE); if you have one of
14 # these, uncomment the following line
15 # (you will know that you have one if you get complaints about unable to
16 # execute things like 'data' and 'rumors')
26 # Permissions - some places use setgid instead of setuid, for instance
27 # See also the option "SECURE" in include/config.h
35 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
37 # note that 'make install' believes in creating a nice tidy HACKDIR for
38 # installation, free of debris from previous NetHack versions --
39 # therefore there should not be anything in HACKDIR that you want to keep
40 # (if there is, you'll have to do the installation by hand or modify the
42 #HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
44 # Where nethack.sh in installed. If this is not defined, the wrapper is not used.
45 #SHELLDIR = $(PREFIX)/games
47 # per discussion in Install.X11 and Install.Qt
49 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xpm
50 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xpm rip.xpm
52 # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
54 # VARDATND = beostiles
56 # VARDATND = x11tiles pet_mark.xbm pilemark.xpm rip.xpm mapbg.xpm
58 VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors
59 VARDAT = $(VARDATD) $(VARDATND)
61 # Some versions of make use the SHELL environment variable as the shell
62 # for running commands. We need this to be a Bourne shell.
65 # SHELL=E:/GEMINI2/MUPFEL.TTP
67 # Commands for setting the owner and group on files during installation.
68 # Some systems fail with one or the other when installing over NFS or for
69 # other permission-related reasons. If that happens, you may want to set the
70 # command to "true", which is a no-op. Note that disabling chown or chgrp
71 # will only work if setuid (or setgid) behavior is not desired or required.
76 # end of configuration
79 DATHELP = help hh cmdhelp history opthelp wizhelp
81 SPEC_LEVS = asmodeus.lev baalz.lev bigrm-*.lev castle.lev fakewiz?.lev \
82 juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \
83 minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \
84 tower?.lev valley.lev wizard?.lev \
85 astral.lev air.lev earth.lev fire.lev water.lev
86 QUEST_LEVS = ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev
88 DATNODLB = $(VARDATND) license
89 DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
90 DAT = $(DATNODLB) $(DATDLB)
95 all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
99 # Note: many of the dependencies below are here to allow parallel make
100 # to generate valid output
103 ( cd doc ; $(MAKE) Guidebook )
106 ( cd doc ; $(MAKE) manpages )
109 ( cd dat ; $(MAKE) data )
112 ( cd dat ; $(MAKE) engrave )
115 ( cd dat ; $(MAKE) bogusmon )
118 ( cd dat ; $(MAKE) epitaph )
121 ( cd dat ; $(MAKE) rumors )
124 ( cd dat ; $(MAKE) oracles )
126 # Note: options should have already been made with make, but...
128 ( cd dat ; $(MAKE) options )
131 ( cd dat ; $(MAKE) quest.dat )
134 ( cd util ; $(MAKE) lev_comp )
135 ( cd dat ; $(MAKE) spec_levs )
136 ( cd dat ; $(MAKE) quest_levs )
139 ( cd util ; $(MAKE) dgn_comp )
140 ( cd dat ; $(MAKE) dungeon )
143 ( cd dat ; $(MAKE) nhtiles.bmp )
146 ( cd util ; $(MAKE) tile2x11 )
147 ( cd dat ; $(MAKE) x11tiles )
150 ( cd util ; $(MAKE) tile2beos )
151 ( cd dat ; $(MAKE) beostiles )
154 ( cd dat ; $(MAKE) NetHack.ad )
157 ( cd dat ; $(MAKE) pet_mark.xbm )
160 ( cd dat ; $(MAKE) pilemark.xbm )
163 ( cd dat ; $(MAKE) rip.xpm )
166 (cd dat ; $(MAKE) mapbg.xpm )
169 ( cd dat ; $(MAKE) nhsplash.xpm )
172 ( cd util ; $(MAKE) tile2img.ttp )
173 ( cd dat ; $(MAKE) nh16.img )
176 ( cd util ; $(MAKE) xpm2img.ttp )
177 ( cd dat ; $(MAKE) rip.img )
179 ( cd dat ; $(MAKE) GEM_RSC.RSC )
182 ( cd dat ; $(MAKE) title.img )
185 @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
188 ( cd util ; $(MAKE) dlb )
189 ( cd dat ; ../util/dlb cf nhdat $(DATDLB) )
191 # recover can be used when INSURANCE is defined in include/config.h
192 # and the checkpoint option is true
194 ( cd util ; $(MAKE) recover )
202 -e '$$s/.*/nodlb/p' < dat/options` ; \
203 $(MAKE) dofiles-$${target-nodlb}
204 (cd dat ; cp symbols $(INSTDIR) )
205 cp src/$(GAME) $(INSTDIR)
206 cp util/recover $(INSTDIR)
207 -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
208 if test -n '$(SHELLDIR)'; then \
209 sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \
210 -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
211 < sys/unix/nethack.sh \
212 > $(SHELLDIR)/$(GAME) ; fi
213 # set up their permissions
214 -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
215 $(CHGRP) $(GAMEGRP) $(GAME) recover )
216 chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
217 chmod $(EXEPERM) $(INSTDIR)/recover
218 -if test -n '$(SHELLDIR)'; then \
219 $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
220 if test -n '$(SHELLDIR)'; then \
221 $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
222 chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
223 -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) symbols ; \
224 $(CHGRP) $(GAMEGRP) symbols ; \
225 chmod $(FILEPERM) symbols )
227 dofiles-dlb: check-dlb
228 ( cd dat ; cp nhdat $(DATNODLB) $(INSTDIR) )
229 # set up their permissions
230 -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
231 $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
232 chmod $(FILEPERM) nhdat $(DATNODLB) )
235 # copy over the game files
236 ( cd dat ; cp $(DAT) $(INSTDIR) )
237 # set up their permissions
238 -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
239 $(CHGRP) $(GAMEGRP) $(DAT) ; \
240 chmod $(FILEPERM) $(DAT) )
242 update: $(GAME) recover $(VARDAT) dungeon spec_levs
243 # (don't yank the old version out from under people who're playing it)
244 -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
245 # quest.dat is also kept open and has the same problems over NFS
246 # (quest.dat may be inside nhdat if dlb is in use)
247 -mv $(INSTDIR)/quest.dat $(INSTDIR)/quest.dat.old
248 -mv $(INSTDIR)/nhdat $(INSTDIR)/nhdat.old
249 # set up new versions of the game files
251 # touch time-sensitive files
252 -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
253 -touch -c $(VARDIR)/save/*
254 touch $(VARDIR)/perm $(VARDIR)/record
256 @echo You may also want to install the man pages via the doc Makefile.
261 install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
263 # set up the directories
264 # not all mkdirs have -p; those that don't will create a -p directory
265 -if test -n '$(SHELLDIR)'; then \
266 mkdir -p $(SHELLDIR); fi
267 rm -rf $(INSTDIR) $(VARDIR)
268 -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save
269 if test -d ./-p; then rmdir ./-p; fi
270 -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save
271 $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save
273 chmod $(DIRPERM) $(INSTDIR)
274 chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
275 # set up the game files
277 # set up some additional files
278 touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile
279 -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \
280 $(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \
281 chmod $(VARFILEPERM) perm record logfile xlogfile )
284 @echo You may also want to reinstall the man pages via the doc Makefile.
287 # 'make clean' removes all the .o files, but leaves around all the executables
288 # and compiled data files
290 ( cd src ; $(MAKE) clean )
291 ( cd util ; $(MAKE) clean )
292 ( cd doc ; $(MAKE) clean )
294 # 'make spotless' returns the source tree to near-distribution condition.
295 # it removes .o files, executables, and compiled data files
297 ( cd src ; $(MAKE) spotless )
298 ( cd util ; $(MAKE) spotless )
299 ( cd dat ; $(MAKE) spotless )
300 ( cd doc ; $(MAKE) spotless )