1 # Hack or Quest Makefile.
3 # on some systems the termcap library is in -ltermcap
9 GAMEDIR = /usr/games/lib/questdir
11 HACKCSRC = hack.Decl.c\
12 hack.apply.c hack.bones.c hack.c hack.cmd.c hack.do.c\
13 hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c hack.end.c\
14 hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c\
15 hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c\
16 hack.mklev.c hack.mkmaze.c hack.mkobj.c hack.mkshop.c\
17 hack.mon.c hack.monst.c hack.o_init.c hack.objnam.c\
18 hack.options.c hack.pager.c hack.potion.c hack.pri.c\
19 hack.read.c hack.rip.c hack.rumors.c hack.save.c\
20 hack.search.c hack.shk.c hack.shknam.c hack.steal.c\
21 hack.termcap.c hack.timeout.c hack.topl.c\
22 hack.track.c hack.trap.c hack.tty.c hack.unix.c\
23 hack.u_init.c hack.vault.c\
24 hack.wield.c hack.wizard.c hack.worm.c hack.worn.c hack.zap.c\
25 hack.version.c rnd.c alloc.c
27 CSOURCES = $(HACKCSRC) makedefs.c
29 HSOURCES = hack.h hack.mfndpos.h config.h\
30 def.edog.h def.eshk.h def.flag.h def.func_tab.h def.gold.h\
32 def.monst.h def.obj.h def.objclass.h def.objects.h\
33 def.permonst.h def.rm.h def.trap.h def.wseg.h
35 SOURCES = $(CSOURCES) $(HSOURCES)
37 AUX = data help hh rumors hack.6 hack.sh
39 DISTR = $(SOURCES) $(AUX) READ_ME Makefile date.h hack.onames.h
41 HOBJ = hack.Decl.o hack.apply.o hack.bones.o hack.o hack.cmd.o hack.do.o\
42 hack.do_name.o hack.do_wear.o hack.dog.o hack.eat.o hack.end.o\
43 hack.engrave.o hack.fight.o hack.invent.o hack.ioctl.o\
44 hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o hack.mklev.o\
45 hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o\
46 hack.monst.o hack.o_init.o hack.objnam.o hack.options.o\
47 hack.pager.o hack.potion.o hack.pri.o\
48 hack.read.o hack.rip.o hack.rumors.o hack.save.o\
49 hack.search.o hack.shk.o hack.shknam.o hack.steal.o\
50 hack.termcap.o hack.timeout.o hack.topl.o\
51 hack.track.o hack.trap.o\
52 hack.tty.o hack.unix.o hack.u_init.o hack.vault.o hack.wield.o\
53 hack.wizard.o hack.worm.o hack.worn.o hack.zap.o\
54 hack.version.o rnd.o alloc.o
56 $(GAME): $(HOBJ) Makefile
58 @ld -X -o $(GAME) /lib/crt0.o $(HOBJ) $(TERMLIB) -lc
64 cc -o makedefs makedefs.c
67 hack.onames.h: makedefs def.objects.h
68 makedefs > hack.onames.h
71 # lint cannot have -p here because (i) capitals are meaningful:
72 # [Ww]izard, (ii) identifiers may coincide in the first six places:
73 # doweararm() versus dowearring().
74 # _flsbuf comes from <stdio.h>, a bug in the system libraries.
75 @echo lint -axbh -DLINT ...
76 @lint -axbh -DLINT $(HACKCSRC) | sed '/_flsbuf/d'
80 @- for i in $(SOURCES) $(AUX) ; do \
81 cmp -s $$i $D/$$i || \
82 ( echo diff $D/$$i $$i ; diff $D/$$i $$i ; echo ) ; done
84 distribution: Makefile
85 @- for i in READ_ME $(SOURCES) $(AUX) Makefile date.h hack.onames.h\
87 cmp -s $$i $D/$$i || \
88 ( echo cp $$i $D ; cp $$i $D ) ; done
89 # the distribution directory also contains the empty files perm and record.
93 rm -f $(GAMEDIR)/$(GAME)
94 cp $(GAME) $(GAMEDIR)/$(GAME)
95 chmod 04511 $(GAMEDIR)/$(GAME)
96 rm -f $(GAMEDIR)/bones*
97 # cp hack.6 /usr/man/man6
104 # For the moment we are lazy and disregard /usr/include files because
105 # the sources contain them conditionally. Perhaps we should use cpp.
106 # ( /bin/grep '^#[ ]*include' $$i | sed -n \
107 # -e 's,<\(.*\)>,"/usr/include/\1",' \
109 for i in ${CSOURCES}; do \
110 ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
111 -e 's/[^"]*"\([^"]*\)".*/\1/' \
112 -e H -e '$$g' -e '$$s/\n/ /g' \
113 -e '$$s/.*/'$$i': &/' -e '$$s/\.c:/.o:/p' \
115 for i in ${HSOURCES}; do \
116 ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \
117 -e 's/[^"]*"\([^"]*\)".*/\1/' \
118 -e H -e '$$g' -e '$$s/\n/ /g' \
122 @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
123 @echo '$$r makedep' >>eddep
125 @cp Makefile Makefile.bak
126 ed - Makefile < eddep
128 @echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
129 @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
130 @echo '# see make depend above' >> Makefile
131 - diff Makefile Makefile.bak
134 # DO NOT DELETE THIS LINE
136 hack.Decl.o: hack.h def.mkroom.h
137 hack.apply.o: hack.h def.edog.h def.mkroom.h
140 hack.cmd.o: hack.h def.func_tab.h
142 hack.do_name.o: hack.h
143 hack.do_wear.o: hack.h
144 hack.dog.o: hack.h hack.mfndpos.h def.edog.h def.mkroom.h
147 hack.engrave.o: hack.h
149 hack.invent.o: hack.h def.wseg.h
150 hack.ioctl.o: config.h
151 hack.lev.o: hack.h def.mkroom.h def.wseg.h
153 hack.makemon.o: hack.h
155 hack.mklev.o: hack.h def.mkroom.h
156 hack.mkmaze.o: hack.h def.mkroom.h
158 hack.mkshop.o: hack.h def.mkroom.h def.eshk.h
159 hack.mon.o: hack.h hack.mfndpos.h
160 hack.monst.o: hack.h def.eshk.h
161 hack.o_init.o: config.h def.objects.h hack.onames.h
162 hack.objnam.o: hack.h
163 hack.options.o: config.h hack.h
165 hack.potion.o: hack.h
166 hack.pri.o: hack.h def.wseg.h
169 hack.rumors.o: hack.h
171 hack.search.o: hack.h
172 hack.shk.o: hack.h hack.mfndpos.h def.mkroom.h def.eshk.h
173 hack.shknam.o: hack.h
175 hack.termcap.o: config.h def.flag.h
176 hack.timeout.o: hack.h
179 hack.trap.o: hack.h def.mkroom.h
181 hack.unix.o: hack.h def.mkroom.h
182 hack.u_init.o: hack.h
183 hack.vault.o: hack.h def.mkroom.h
185 hack.wizard.o: hack.h
186 hack.worm.o: hack.h def.wseg.h
189 hack.version.o: date.h
190 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
192 def.objects.h: config.h def.objclass.h
194 # DEPENDENCIES MUST END AT END OF FILE
195 # IF YOU PUT STUFF HERE IT WILL GO AWAY
196 # see make depend above