2 # SCCS Id: @(#)Makefile.top 3.4 1995/01/05
4 # newer makes predefine $(MAKE) to 'make' and do smarter processing of
5 # recursive make calls if $(MAKE) is used
6 # these makes allow $(MAKE) to be overridden by the environment if someone
7 # wants to (or has to) use something other than the standard make, so we do
8 # not want to unconditionally set $(MAKE) here
10 # unfortunately, some older makes do not predefine $(MAKE); if you have one of
11 # these, uncomment the following line
12 # (you will know that you have one if you get complaints about unable to
13 # execute things like 'data' and 'rumors')
23 # Permissions - some places use setgid instead of setuid, for instance
24 # See also the option "SECURE" in include/config.h
30 # GAMEDIR also appears in config.h as "HACKDIR".
31 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else GAMEDIR
33 # note that 'make install' believes in creating a nice tidy GAMEDIR for
34 # installation, free of debris from previous NetHack versions --
35 # therefore there should not be anything in GAMEDIR that you want to keep
36 # (if there is, you'll have to do the installation by hand or modify the
38 GAMEDIR = $(PREFIX)/games/lib/$(GAME)dir
40 SHELLDIR = $(PREFIX)/games
42 # per discussion in Install.X11 and Install.Qt
44 # VARDATND = x11tiles NetHack.ad pet_mark.xbm
45 # VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm
47 # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
49 # VARDATND = beostiles
51 # VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm
53 VARDATD = data oracles options quest.dat rumors
54 VARDAT = $(VARDATD) $(VARDATND)
56 # Some versions of make use the SHELL environment variable as the shell
57 # for running commands. We need this to be a Bourne shell.
60 # SHELL=E:/GEMINI2/MUPFEL.TTP
62 # Commands for setting the owner and group on files during installation.
63 # Some systems fail with one or the other when installing over NFS or for
64 # other permission-related reasons. If that happens, you may want to set the
65 # command to "true", which is a no-op. Note that disabling chown or chgrp
66 # will only work if setuid (or setgid) behavior is not desired or required.
71 # end of configuration
74 DATHELP = help hh cmdhelp history opthelp wizhelp
76 SPEC_LEVS = asmodeus.lev baalz.lev bigrm-?.lev castle.lev fakewiz?.lev \
77 juiblex.lev knox.lev medusa-?.lev minend-?.lev minefill.lev \
78 minetn-?.lev oracle.lev orcus.lev sanctum.lev soko?-?.lev \
79 tower?.lev valley.lev wizard?.lev \
80 astral.lev air.lev earth.lev fire.lev water.lev
81 QUEST_LEVS = ???-goal.lev ???-fil?.lev ???-loca.lev ???-strt.lev
83 DATNODLB = $(VARDATND) license
84 DATDLB = $(DATHELP) dungeon $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
85 DAT = $(DATNODLB) $(DATDLB)
90 all: $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
93 # Note: many of the dependencies below are here to allow parallel make
94 # to generate valid output
97 ( cd doc ; $(MAKE) Guidebook )
100 ( cd doc ; $(MAKE) manpages )
103 ( cd dat ; $(MAKE) data )
106 ( cd dat ; $(MAKE) rumors )
109 ( cd dat ; $(MAKE) oracles )
111 # Note: options should have already been made with make, but...
113 ( cd dat ; $(MAKE) options )
116 ( cd dat ; $(MAKE) quest.dat )
119 ( cd util ; $(MAKE) lev_comp )
120 ( cd dat ; $(MAKE) spec_levs )
121 ( cd dat ; $(MAKE) quest_levs )
124 ( cd util ; $(MAKE) dgn_comp )
125 ( cd dat ; $(MAKE) dungeon )
128 ( cd dat ; $(MAKE) nhtiles.bmp )
131 ( cd util ; $(MAKE) tile2x11 )
132 ( cd dat ; $(MAKE) x11tiles )
135 ( cd util ; $(MAKE) tile2beos )
136 ( cd dat ; $(MAKE) beostiles )
139 ( cd dat ; $(MAKE) NetHack.ad )
142 ( cd dat ; $(MAKE) pet_mark.xbm )
145 ( cd dat ; $(MAKE) rip.xpm )
148 (cd dat ; $(MAKE) mapbg.xpm )
151 ( cd dat ; $(MAKE) nhsplash.xpm )
154 ( cd util ; $(MAKE) tile2img.ttp )
155 ( cd dat ; $(MAKE) nh16.img )
158 ( cd util ; $(MAKE) xpm2img.ttp )
159 ( cd dat ; $(MAKE) rip.img )
161 ( cd dat ; $(MAKE) GEM_RSC.RSC )
164 ( cd dat ; $(MAKE) title.img )
167 @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
170 ( cd util ; $(MAKE) dlb )
171 ( cd dat ; ../util/dlb cf nhdat $(DATDLB) )
173 # recover can be used when INSURANCE is defined in include/config.h
174 # and the checkpoint option is true
176 ( cd util ; $(MAKE) recover )
184 -e '$$s/.*/nodlb/p' < dat/options` ; \
185 $(MAKE) dofiles-$${target-nodlb}
186 cp src/$(GAME) $(GAMEDIR)
187 cp util/recover $(GAMEDIR)
188 -rm -f $(SHELLDIR)/$(GAME)
189 sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
190 -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
191 < sys/unix/nethack.sh \
192 > $(SHELLDIR)/$(GAME)
193 # set up their permissions
194 -( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
195 $(CHGRP) $(GAMEGRP) $(GAME) recover )
196 chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
197 chmod $(EXEPERM) $(GAMEDIR)/recover
198 -$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
199 $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
200 chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
202 dofiles-dlb: check-dlb
203 ( cd dat ; cp nhdat $(DATNODLB) $(GAMEDIR) )
204 # set up their permissions
205 -( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) nhdat $(DATNODLB) ; \
206 $(CHGRP) $(GAMEGRP) nhdat $(DATNODLB) ; \
207 chmod $(FILEPERM) nhdat $(DATNODLB) )
210 # copy over the game files
211 ( cd dat ; cp $(DAT) $(GAMEDIR) )
212 # set up their permissions
213 -( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
214 $(CHGRP) $(GAMEGRP) $(DAT) ; \
215 chmod $(FILEPERM) $(DAT) )
217 update: $(GAME) recover $(VARDAT) dungeon spec_levs
218 # (don't yank the old version out from under people who're playing it)
219 -mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
220 # quest.dat is also kept open and has the same problems over NFS
221 # (quest.dat may be inside nhdat if dlb is in use)
222 -mv $(GAMEDIR)/quest.dat $(GAMEDIR)/quest.dat.old
223 -mv $(GAMEDIR)/nhdat $(GAMEDIR)/nhdat.old
224 # set up new versions of the game files
226 # touch time-sensitive files
227 -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
228 -touch -c $(VARDIR)/save/*
229 touch $(VARDIR)/perm $(VARDIR)/record
231 @echo You may also want to install the man pages via the doc Makefile.
233 install: $(GAME) recover $(VARDAT) dungeon spec_levs
234 # set up the directories
235 # not all mkdirs have -p; those that don't will create a -p directory
236 -mkdir -p $(SHELLDIR)
237 -rm -rf $(GAMEDIR) $(VARDIR)
238 -mkdir -p $(GAMEDIR) $(VARDIR) $(VARDIR)/save
240 -$(CHOWN) $(GAMEUID) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
241 $(CHGRP) $(GAMEGRP) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
242 chmod $(DIRPERM) $(GAMEDIR) $(VARDIR) $(VARDIR)/save
243 # set up the game files
245 # set up some additional files
246 touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile
247 -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \
248 $(CHGRP) $(GAMEGRP) perm record logfile ; \
249 chmod $(FILEPERM) perm record logfile )
251 @echo You may also want to reinstall the man pages via the doc Makefile.
254 # 'make clean' removes all the .o files, but leaves around all the executables
255 # and compiled data files
257 ( cd src ; $(MAKE) clean )
258 ( cd util ; $(MAKE) clean )
260 # 'make spotless' returns the source tree to near-distribution condition.
261 # it removes .o files, executables, and compiled data files
263 ( cd src ; $(MAKE) spotless )
264 ( cd util ; $(MAKE) spotless )
265 ( cd dat ; $(MAKE) spotless )
266 ( cd doc ; $(MAKE) spotless )