NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / sys / unix / Makefile.top
blob654861cb501f6a15b9ff985c2b584fc3fc97c91a
1 #       aNetHack Makefile.
2 # aNetHack 0.0.1  Makefile.top  $ANH-Date: 1465114189 2016/06/05 08:09:49 $  $ANH-Branch: master $:$ANH-Revision: 1.35 $
4 # Root of source tree:
5 NHSROOT=.
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')
17 # MAKE = make
19 # make aNetHack
20 #PREFIX  = /usr
21 GAME     = anethack
22 # GAME     = anethack.prg
23 #GAMEUID  = games
24 #GAMEGRP  = bin
26 # Permissions - some places use setgid instead of setuid, for instance
27 # See also the option "SECURE" in include/config.h
28 #GAMEPERM = 04755
29 FILEPERM = 0644
30 # VARFILEPERM = 0644
31 EXEPERM  = 0755
32 DIRPERM  = 0755
33 # VARDIRPERM = 0755
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 aNetHack 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
41 # instructions)
42 #HACKDIR  = $(PREFIX)/games/lib/$(GAME)dir
43 #VARDIR  = $(HACKDIR)
44 # Where anethack.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
48 #VARDATND = 
49 # VARDATND = x11tiles aNetHack.ad pet_mark.xbm pilemark.xbm
50 # VARDATND = x11tiles aNetHack.ad pet_mark.xbm pilemark.xbm rip.xpm
51 # for Atari/Gem
52 # VARDATND = nh16.img title.img GEM_RSC.RSC rip.img
53 # for BeOS
54 # VARDATND = beostiles
55 # for Gnome
56 # VARDATND = x11tiles pet_mark.xbm pilemark.xbm 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.
63 # SHELL = /bin/sh
64 # for Atari
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.
72 #CHOWN = chown
73 #CHGRP = chgrp
76 # end of configuration
79 DATHELP = help hh cmdhelp keyhelp 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 symbols
89 DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
90 DAT = $(DATNODLB) $(DATDLB)
92 $(GAME):
93         ( cd src ; $(MAKE) )
95 all:    $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
96         true; $(MOREALL)
97         @echo "Done."
99 # Note: many of the dependencies below are here to allow parallel make
100 # to generate valid output
102 Guidebook:
103         ( cd doc ; $(MAKE) Guidebook )
105 manpages:
106         ( cd doc ; $(MAKE) manpages )
108 data: $(GAME)
109         ( cd dat ; $(MAKE) data )
111 engrave: $(GAME)
112         ( cd dat ; $(MAKE) engrave )
114 bogusmon: $(GAME)
115         ( cd dat ; $(MAKE) bogusmon )
117 epitaph: $(GAME)
118         ( cd dat ; $(MAKE) epitaph )
120 rumors: $(GAME)
121         ( cd dat ; $(MAKE) rumors )
123 oracles: $(GAME)
124         ( cd dat ; $(MAKE) oracles )
126 #       Note: options should have already been made with make, but...
127 options: $(GAME)
128         ( cd dat ; $(MAKE) options )
130 quest.dat: $(GAME)
131         ( cd dat ; $(MAKE) quest.dat )
133 spec_levs: dungeon
134         ( cd util ; $(MAKE) lev_comp )
135         ( cd dat ; $(MAKE) spec_levs )
136         ( cd dat ; $(MAKE) quest_levs )
138 dungeon: $(GAME)
139         ( cd util ; $(MAKE) dgn_comp )
140         ( cd dat ; $(MAKE) dungeon )
142 nhtiles.bmp: $(GAME)
143         ( cd dat ; $(MAKE) nhtiles.bmp )
145 x11tiles: $(GAME)
146         ( cd util ; $(MAKE) tile2x11 )
147         ( cd dat ; $(MAKE) x11tiles )
149 beostiles: $(GAME)
150         ( cd util ; $(MAKE) tile2beos )
151         ( cd dat ; $(MAKE) beostiles )
153 aNetHack.ad: $(GAME)
154         ( cd dat ; $(MAKE) aNetHack.ad )
156 pet_mark.xbm:
157         ( cd dat ; $(MAKE) pet_mark.xbm )
159 pilemark.xbm:
160         ( cd dat ; $(MAKE) pilemark.xbm )
162 rip.xpm:
163         ( cd dat ; $(MAKE) rip.xpm )
165 mapbg.xpm:
166         (cd dat ; $(MAKE) mapbg.xpm )
168 nhsplash.xpm:
169         ( cd dat ; $(MAKE) nhsplash.xpm )
171 nh16.img: $(GAME)
172         ( cd util ; $(MAKE) tile2img.ttp )
173         ( cd dat ; $(MAKE) nh16.img )
175 rip.img:
176         ( cd util ; $(MAKE) xpm2img.ttp )
177         ( cd dat ; $(MAKE) rip.img )
178 GEM_RSC.RSC:
179         ( cd dat ; $(MAKE) GEM_RSC.RSC )
181 title.img:
182         ( cd dat ; $(MAKE) title.img )
184 check-dlb: options
185         @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
187 dlb:
188         ( cd util ; $(MAKE) dlb )
189         ( cd dat ; LC_ALL=C ; ../util/dlb cf anhdat $(DATDLB) )
191 # recover can be used when INSURANCE is defined in include/config.h
192 # and the checkpoint option is true
193 recover: $(GAME)
194         ( cd util ; $(MAKE) recover )
196 dofiles:
197         target=`sed -n                                  \
198                 -e '/librarian/{'                       \
199                 -e      's/.*/dlb/p'                    \
200                 -e      'q'                             \
201                 -e '}'                                  \
202                 -e '$$s/.*/nodlb/p' < dat/options` ;    \
203         $(MAKE) dofiles-$${target-nodlb}
204         cp src/$(GAME) $(INSTDIR)
205         cp util/recover $(INSTDIR)
206         -if test -n '$(SHELLDIR)'; then rm -f $(SHELLDIR)/$(GAME); fi
207         if test -n '$(SHELLDIR)'; then \
208                 sed -e 's;/usr/games/lib/anethackdir;$(HACKDIR);' \
209                 -e 's;HACKDIR/anethack;HACKDIR/$(GAME);' \
210                 < sys/unix/anethack.sh \
211                 > $(SHELLDIR)/$(GAME) ; fi
212 # set up their permissions
213         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
214                         $(CHGRP) $(GAMEGRP) $(GAME) recover )
215         chmod $(GAMEPERM) $(INSTDIR)/$(GAME)
216         chmod $(EXEPERM) $(INSTDIR)/recover
217         -if test -n '$(SHELLDIR)'; then \
218                 $(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME); fi
219         if test -n '$(SHELLDIR)'; then \
220                 $(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME); \
221                 chmod $(EXEPERM) $(SHELLDIR)/$(GAME); fi
223 dofiles-dlb: check-dlb
224         ( cd dat ; cp anhdat $(DATNODLB) $(INSTDIR) )
225 # set up their permissions
226         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) anhdat $(DATNODLB) ; \
227                         $(CHGRP) $(GAMEGRP) anhdat $(DATNODLB) ; \
228                         chmod $(FILEPERM) anhdat $(DATNODLB) )
230 dofiles-nodlb:
231 # copy over the game files
232         ( cd dat ; cp $(DAT) $(INSTDIR) )
233 # set up their permissions
234         -( cd $(INSTDIR) ; $(CHOWN) $(GAMEUID) $(DAT) ; \
235                         $(CHGRP) $(GAMEGRP) $(DAT) ; \
236                         chmod $(FILEPERM) $(DAT) )
238 update: $(GAME) recover $(VARDAT) dungeon spec_levs
239 #       (don't yank the old version out from under people who're playing it)
240         -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
241 #       quest.dat is also kept open and has the same problems over NFS
242 #       (quest.dat may be inside anhdat if dlb is in use)
243         -mv $(INSTDIR)/quest.dat $(INSTDIR)/quest.dat.old
244         -mv $(INSTDIR)/anhdat $(INSTDIR)/anhdat.old
245 # set up new versions of the game files
246         ( $(MAKE) dofiles )
247 # touch time-sensitive files
248         -touch -c $(VARDIR)/bones* $(VARDIR)/?lock* $(VARDIR)/wizard*
249         -touch -c $(VARDIR)/save/*
250         touch $(VARDIR)/perm $(VARDIR)/record
251 # and a reminder
252         @echo You may also want to install the man pages via the doc Makefile.
254 rootcheck:
255         @true; $(ROOTCHECK)
257 install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
258         true; $(PREINSTALL)
259 # set up the directories
260 # not all mkdirs have -p; those that don't will create a -p directory
261         -if test -n '$(SHELLDIR)'; then \
262                 mkdir -p $(SHELLDIR); fi
263         rm -rf $(INSTDIR) $(VARDIR)
264         -mkdir -p $(INSTDIR) $(VARDIR) $(VARDIR)/save
265         if test -d ./-p; then rmdir ./-p; fi
266         -$(CHOWN) $(GAMEUID) $(INSTDIR) $(VARDIR) $(VARDIR)/save
267         $(CHGRP) $(GAMEGRP) $(INSTDIR) $(VARDIR) $(VARDIR)/save
268 # order counts here:
269         chmod $(DIRPERM) $(INSTDIR)
270         chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
271 # set up the game files
272         ( $(MAKE) dofiles )
273 # set up some additional files
274         touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile
275         -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \
276                         $(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \
277                         chmod $(VARFILEPERM) perm record logfile xlogfile )
278         true; $(POSTINSTALL)
279 # and a reminder
280         @echo You may also want to reinstall the man pages via the doc Makefile.
283 # 'make clean' removes all the .o files, but leaves around all the executables
284 # and compiled data files
285 clean:
286         ( cd src ; $(MAKE) clean )
287         ( cd util ; $(MAKE) clean )
288         ( cd doc ; $(MAKE) clean )
290 # 'make spotless' returns the source tree to near-distribution condition.
291 # it removes .o files, executables, and compiled data files
292 spotless:
293         ( cd src ; $(MAKE) spotless )
294         ( cd util ; $(MAKE) spotless )
295         ( cd dat ; $(MAKE) spotless )
296         ( cd doc ; $(MAKE) spotless )