3 # Hack or Quest Makefile.
5 # on some systems the termcap library is in -ltermcap
11 GAMEDIR = /usr/games/lib/questdir
13 HACKCSRC = hack.Decl.c\
14 hack.apply.c hack.bones.c hack.c hack.cmd.c hack.do.c\
15 hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c hack.end.c\
16 hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c\
17 hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c\
18 hack.mklev.c hack.mkmaze.c hack.mkobj.c hack.mkshop.c\
19 hack.mon.c hack.monst.c hack.o_init.c hack.objnam.c\
20 hack.options.c hack.pager.c hack.potion.c hack.pri.c\
21 hack.read.c hack.rip.c hack.rumors.c hack.save.c\
22 hack.search.c hack.shk.c hack.shknam.c hack.steal.c\
23 hack.termcap.c hack.timeout.c hack.topl.c\
24 hack.track.c hack.trap.c hack.tty.c hack.unix.c\
25 hack.u_init.c hack.vault.c\
26 hack.wield.c hack.wizard.c hack.worm.c hack.worn.c hack.zap.c\
27 hack.version.c rnd.c alloc.c
29 CSOURCES = $(HACKCSRC) makedefs.c
31 HSOURCES = hack.h hack.mfndpos.h config.h\
32 def.edog.h def.eshk.h def.flag.h def.func_tab.h def.gold.h\
34 def.monst.h def.obj.h def.objclass.h def.objects.h\
35 def.permonst.h def.rm.h def.trap.h def.wseg.h
37 SOURCES = $(CSOURCES) $(HSOURCES)
39 AUX = data help hh rumors hack.6 hack.sh
41 DISTR = $(SOURCES) $(AUX) READ_ME Makefile date.h hack.onames.h
43 HOBJ = hack.Decl.o hack.apply.o hack.bones.o hack.o hack.cmd.o hack.do.o\
44 hack.do_name.o hack.do_wear.o hack.dog.o hack.eat.o hack.end.o\
45 hack.engrave.o hack.fight.o hack.invent.o hack.ioctl.o\
46 hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o hack.mklev.o\
47 hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o\
48 hack.monst.o hack.o_init.o hack.objnam.o hack.options.o\
49 hack.pager.o hack.potion.o hack.pri.o\
50 hack.read.o hack.rip.o hack.rumors.o hack.save.o\
51 hack.search.o hack.shk.o hack.shknam.o hack.steal.o\
52 hack.termcap.o hack.timeout.o hack.topl.o\
53 hack.track.o hack.trap.o\
54 hack.tty.o hack.unix.o hack.u_init.o hack.vault.o hack.wield.o\
55 hack.wizard.o hack.worm.o hack.worn.o hack.zap.o\
56 hack.version.o rnd.o alloc.o
58 $(GAME): $(HOBJ) Makefile
60 @ld -X -o $(GAME) /lib/crt0.o $(HOBJ) $(TERMLIB) -lc
66 cc -o makedefs makedefs.c
69 hack.onames.h: makedefs def.objects.h
70 makedefs > hack.onames.h
73 # lint cannot have -p here because (i) capitals are meaningful:
74 # [Ww]izard, (ii) identifiers may coincide in the first six places:
75 # doweararm() versus dowearring().
76 # _flsbuf comes from <stdio.h>, a bug in the system libraries.
77 @echo lint -axbh -DLINT ...
78 @lint -axbh -DLINT $(HACKCSRC) | sed '/_flsbuf/d'
82 @- for i in $(SOURCES) $(AUX) ; do \
83 cmp -s $$i $D/$$i || \
84 ( echo diff $D/$$i $$i ; diff $D/$$i $$i ; echo ) ; done
86 distribution: Makefile
87 @- for i in READ_ME $(SOURCES) $(AUX) Makefile date.h hack.onames.h\
89 cmp -s $$i $D/$$i || \
90 ( echo cp $$i $D ; cp $$i $D ) ; done
91 # the distribution directory also contains the empty files perm and record.
95 rm -f $(GAMEDIR)/$(GAME)
96 cp $(GAME) $(GAMEDIR)/$(GAME)
97 chmod 04511 $(GAMEDIR)/$(GAME)
98 rm -f $(GAMEDIR)/bones*
99 # cp hack.6 /usr/man/man6
106 # For the moment we are lazy and disregard /usr/include files because
107 # the sources contain them conditionally. Perhaps we should use cpp.
108 # ( /bin/grep '^#[ ]*include' $$i | sed -n \
109 # -e 's,<\(.*\)>,"/usr/include/\1",' \
111 for i in ${CSOURCES}; do \
112 ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
113 -e 's/[^"]*"\([^"]*\)".*/\1/' \
114 -e H -e '$$g' -e '$$s/\n/ /g' \
115 -e '$$s/.*/'$$i': &/' -e '$$s/\.c:/.o:/p' \
117 for i in ${HSOURCES}; do \
118 ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
119 -e 's/[^"]*"\([^"]*\)".*/\1/' \
120 -e H -e '$$g' -e '$$s/\n/ /g' \
124 @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
125 @echo '$$r makedep' >>eddep
127 @cp Makefile Makefile.bak
128 ed - Makefile < eddep
130 @echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
131 @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
132 @echo '# see make depend above' >> Makefile
133 - diff Makefile Makefile.bak
136 # DO NOT DELETE THIS LINE
138 hack.Decl.o: hack.h def.mkroom.h
139 hack.apply.o: hack.h def.edog.h def.mkroom.h
142 hack.cmd.o: hack.h def.func_tab.h
144 hack.do_name.o: hack.h
145 hack.do_wear.o: hack.h
146 hack.dog.o: hack.h hack.mfndpos.h def.edog.h def.mkroom.h
149 hack.engrave.o: hack.h
151 hack.invent.o: hack.h def.wseg.h
152 hack.ioctl.o: config.h
153 hack.lev.o: hack.h def.mkroom.h def.wseg.h
155 hack.makemon.o: hack.h
157 hack.mklev.o: hack.h def.mkroom.h
158 hack.mkmaze.o: hack.h def.mkroom.h
160 hack.mkshop.o: hack.h def.mkroom.h def.eshk.h
161 hack.mon.o: hack.h hack.mfndpos.h
162 hack.monst.o: hack.h def.eshk.h
163 hack.o_init.o: config.h def.objects.h hack.onames.h
164 hack.objnam.o: hack.h
165 hack.options.o: config.h hack.h
167 hack.potion.o: hack.h
168 hack.pri.o: hack.h def.wseg.h
171 hack.rumors.o: hack.h
173 hack.search.o: hack.h
174 hack.shk.o: hack.h hack.mfndpos.h def.mkroom.h def.eshk.h
175 hack.shknam.o: hack.h
177 hack.termcap.o: config.h def.flag.h
178 hack.timeout.o: hack.h
181 hack.trap.o: hack.h def.mkroom.h
183 hack.unix.o: hack.h def.mkroom.h
184 hack.u_init.o: hack.h
185 hack.vault.o: hack.h def.mkroom.h
187 hack.wizard.o: hack.h
188 hack.worm.o: hack.h def.wseg.h
191 hack.version.o: date.h
192 hack.h: config.h def.objclass.h def.monst.h def.gold.h def.trap.h def.obj.h def.flag.h def.rm.h def.permonst.h hack.onames.h
194 def.objects.h: config.h def.objclass.h
196 # DEPENDENCIES MUST END AT END OF FILE
197 # IF YOU PUT STUFF HERE IT WILL GO AWAY
198 # see make depend above