OSDN Git Service

import nethack-3.6.0
[jnethack/source.git] / sys / unix / Makefile.top
1 #       NetHack Makefile.
2 # NetHack 3.6  Makefile.top     $NHDT-Date: 1447844578 2015/11/18 11:02:58 $  $NHDT-Branch: master $:$NHDT-Revision: 1.32 $
3
4 # Root of source tree:
5 NHSROOT=.
6
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
12 #
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
18
19 # make NetHack
20 #PREFIX  = /usr
21 GAME     = nethack
22 # GAME     = nethack.prg
23 #GAMEUID  = games
24 #GAMEGRP  = bin
25
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
34
35 # VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
36 #
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
41 # instructions)
42 #HACKDIR  = $(PREFIX)/games/lib/$(GAME)dir
43 #VARDIR  = $(HACKDIR)
44 # Where nethack.sh in installed.  If this is not defined, the wrapper is not used.
45 #SHELLDIR = $(PREFIX)/games
46
47 # per discussion in Install.X11 and Install.Qt
48 #VARDATND = 
49 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xpm
50 # VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xpm 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.xpm rip.xpm mapbg.xpm
57
58 VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors
59 VARDAT = $(VARDATD) $(VARDATND)
60
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
66
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
74
75 #
76 # end of configuration
77 #
78
79 DATHELP = help hh cmdhelp history opthelp wizhelp
80
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
87
88 DATNODLB = $(VARDATND) license
89 DATDLB = $(DATHELP) dungeon tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
90 DAT = $(DATNODLB) $(DATDLB)
91
92 $(GAME):
93         ( cd src ; $(MAKE) )
94
95 all:    $(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
96         true; $(MOREALL)
97         @echo "Done."
98
99 # Note: many of the dependencies below are here to allow parallel make
100 # to generate valid output
101
102 Guidebook:
103         ( cd doc ; $(MAKE) Guidebook )
104
105 manpages:
106         ( cd doc ; $(MAKE) manpages )
107
108 data: $(GAME)
109         ( cd dat ; $(MAKE) data )
110
111 engrave: $(GAME)
112         ( cd dat ; $(MAKE) engrave )
113
114 bogusmon: $(GAME)
115         ( cd dat ; $(MAKE) bogusmon )
116
117 epitaph: $(GAME)
118         ( cd dat ; $(MAKE) epitaph )
119
120 rumors: $(GAME)
121         ( cd dat ; $(MAKE) rumors )
122
123 oracles: $(GAME)
124         ( cd dat ; $(MAKE) oracles )
125
126 #       Note: options should have already been made with make, but...
127 options: $(GAME)
128         ( cd dat ; $(MAKE) options )
129
130 quest.dat: $(GAME)
131         ( cd dat ; $(MAKE) quest.dat )
132
133 spec_levs: dungeon
134         ( cd util ; $(MAKE) lev_comp )
135         ( cd dat ; $(MAKE) spec_levs )
136         ( cd dat ; $(MAKE) quest_levs )
137
138 dungeon: $(GAME)
139         ( cd util ; $(MAKE) dgn_comp )
140         ( cd dat ; $(MAKE) dungeon )
141
142 nhtiles.bmp: $(GAME)
143         ( cd dat ; $(MAKE) nhtiles.bmp )
144
145 x11tiles: $(GAME)
146         ( cd util ; $(MAKE) tile2x11 )
147         ( cd dat ; $(MAKE) x11tiles )
148
149 beostiles: $(GAME)
150         ( cd util ; $(MAKE) tile2beos )
151         ( cd dat ; $(MAKE) beostiles )
152
153 NetHack.ad: $(GAME)
154         ( cd dat ; $(MAKE) NetHack.ad )
155
156 pet_mark.xbm:
157         ( cd dat ; $(MAKE) pet_mark.xbm )
158
159 pilemark.xbm:
160         ( cd dat ; $(MAKE) pilemark.xbm )
161
162 rip.xpm:
163         ( cd dat ; $(MAKE) rip.xpm )
164
165 mapbg.xpm:
166         (cd dat ; $(MAKE) mapbg.xpm )
167
168 nhsplash.xpm:
169         ( cd dat ; $(MAKE) nhsplash.xpm )
170
171 nh16.img: $(GAME)
172         ( cd util ; $(MAKE) tile2img.ttp )
173         ( cd dat ; $(MAKE) nh16.img )
174
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 )
180
181 title.img:
182         ( cd dat ; $(MAKE) title.img )
183
184 check-dlb: options
185         @if egrep -s librarian dat/options ; then $(MAKE) dlb ; else true ; fi
186
187 dlb:
188         ( cd util ; $(MAKE) dlb )
189         ( cd dat ; ../util/dlb cf nhdat $(DATDLB) )
190
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 )
195
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         (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 )
226
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) )
233
234 dofiles-nodlb:
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) )
241
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
250         ( $(MAKE) dofiles )
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
255 # and a reminder
256         @echo You may also want to install the man pages via the doc Makefile.
257
258 rootcheck:
259         @true; $(ROOTCHECK)
260
261 install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs
262         true; $(PREINSTALL)
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
272 # order counts here:
273         chmod $(DIRPERM) $(INSTDIR)
274         chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
275 # set up the game files
276         ( $(MAKE) dofiles )
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 )
282         true; $(POSTINSTALL)
283 # and a reminder
284         @echo You may also want to reinstall the man pages via the doc Makefile.
285
286
287 # 'make clean' removes all the .o files, but leaves around all the executables
288 # and compiled data files
289 clean:
290         ( cd src ; $(MAKE) clean )
291         ( cd util ; $(MAKE) clean )
292         ( cd doc ; $(MAKE) clean )
293
294 # 'make spotless' returns the source tree to near-distribution condition.
295 # it removes .o files, executables, and compiled data files
296 spotless:
297         ( cd src ; $(MAKE) spotless )
298         ( cd util ; $(MAKE) spotless )
299         ( cd dat ; $(MAKE) spotless )
300         ( cd doc ; $(MAKE) spotless )