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.
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
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')
29 # Permissions - some places use setgid instead of setuid, for instance
30 # See also the option "SECURE" in include/config.h
38 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
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
45 #HACKDIR = $(PREFIX)/games/lib/$(GAME)dir
47 # Where nethack.sh in installed. If this is not defined, the wrapper is not used.
48 #SHELLDIR = $(PREFIX)/games
50 # per discussion in Install.X11 and Install.Qt
52 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
53 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
55 # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
57 # VARDATND = beostiles
59 # VARDATND = x11tiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
61 VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors
62 VARDAT = $(VARDATD) $(VARDATND)
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.
68 # SHELL=E:/GEMINI2/MUPFEL.TTP
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.
79 # end of configuration
82 DATHELP = help hh cmdhelp keyhelp history opthelp wizhelp
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
91 DATNODLB = $(VARDATND) license symbols
92 DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
93 DAT = $(DATNODLB) $(DATDLB)
98 all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
102 # Note: many of the dependencies below are here to allow parallel make
103 # to generate valid output
106 ( cd doc ; $(MAKE) Guidebook )
109 ( cd doc ; $(MAKE) manpages )
112 ( cd dat ; $(MAKE) data )
115 ( cd dat ; $(MAKE) engrave )
118 ( cd dat ; $(MAKE) bogusmon )
121 ( cd dat ; $(MAKE) epitaph )
124 ( cd dat ; $(MAKE) rumors )
127 ( cd dat ; $(MAKE) oracles )
129 # Note: options should have already been made with make, but...
131 ( cd dat ; $(MAKE) options )
134 ( cd dat ; $(MAKE) quest.dat )
137 ( cd util ; $(MAKE) lev_comp )
138 ( cd dat ; $(MAKE) spec_levs )
139 ( cd dat ; $(MAKE) quest_levs )
142 ( cd util ; $(MAKE) dgn_comp )
143 ( cd dat ; $(MAKE) dungeon )
146 ( cd dat ; $(MAKE) nhtiles.bmp )
149 ( cd util ; $(MAKE) tile2x11 )
150 ( cd dat ; $(MAKE) x11tiles )
153 ( cd util ; $(MAKE) tile2beos )
154 ( cd dat ; $(MAKE) beostiles )
157 ( cd dat ; $(MAKE) JNetHack.ad )
160 ( cd dat ; $(MAKE) pet_mark.xbm )
163 ( cd dat ; $(MAKE) pilemark.xbm )
166 ( cd dat ; $(MAKE) rip.xpm )
169 (cd dat ; $(MAKE) mapbg.xpm )
172 ( cd dat ; $(MAKE) nhsplash.xpm )
175 ( cd util ; $(MAKE) tile2img.ttp )
176 ( cd dat ; $(MAKE) nh16.img )
179 ( cd util ; $(MAKE) xpm2img.ttp )
180 ( cd dat ; $(MAKE) rip.img )
182 ( cd dat ; $(MAKE) GEM_RSC.RSC )
185 ( cd dat ; $(MAKE) title.img )
188 @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
191 ( cd util ; $(MAKE) dlb )
192 ( cd dat ; LC_ALL=C ; ../util/dlb cf nhdat $(DATDLB) )
194 # recover can be used when INSURANCE is defined in include/config.h
195 # and the checkpoint option is true
197 ( cd util ; $(MAKE) recover )
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
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) )
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) )
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
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
255 @echo You may also want to install the man pages via the doc Makefile.
260 install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
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
272 chmod $(DIRPERM) $(INSTDIR)
273 chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
274 # set up the game files
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 )
283 @echo You may also want to reinstall the man pages via the doc Makefile.
286 # 'make clean' removes all the .o files, but leaves around all the executables
287 # and compiled data files
289 ( cd src ; $(MAKE) clean )
290 ( cd util ; $(MAKE) clean )
291 ( cd doc ; $(MAKE) clean )
293 # 'make spotless' returns the source tree to near-distribution condition.
294 # it removes .o files, executables, and compiled data files
296 ( cd src ; $(MAKE) spotless )
297 ( cd util ; $(MAKE) spotless )
298 ( cd dat ; $(MAKE) spotless )
299 ( cd doc ; $(MAKE) spotless )