1*35974Sbostic# Makefile for creating dungeon
2*35974Sbostic# Edit BIN DDIR and FFLAGS suitable for your system
3*35974Sbostic# Also, if you are running System V change the .F.o production
4*35974Sbostic#  and production for dinit.F as indicated.
5*35974Sbostic#
6*35974Sbostic# need SUFFIXES for System V (doesn't grok .F)
7*35974Sbostic.SUFFIXES: .F
8*35974Sbostic.c.o:
9*35974Sbostic	cc -c $(CFLAGS) $*.c
10*35974Sbostic.F.o:
11*35974Sbostic	f77 -c $(FFLAGS) $*.F
12*35974Sbostic# For System V use the following production instead:
13*35974Sbostic#	@/lib/cpp $(CPPFLAGS) $*.F > $*.f
14*35974Sbostic#	f77 -c $(FFLAGS) $*.f
15*35974Sbostic#	rm $*.f
16*35974Sbostic
17*35974Sbostic# define SYSV if running System V or V7
18*35974SbosticCFLAGS = -O # -DSYSV -g -i
19*35974SbosticCPPFLAGS = -P
20*35974Sbostic#
21*35974Sbostic# f77 compiler flags for BSD Vax (and other similar machines)
22*35974SbosticFOPTS = -q # -g -Ddebug
23*35974Sbostic# use -Nn650 for System V to increase default symbol table size
24*35974Sbostic# also, define SYSV and no -g flag (causes runtime errors)
25*35974Sbostic#FOPTS = -q -Nn650 -DSYSV # -Ddebug
26*35974Sbostic# f77 compiler flags for pdp (64K split I/D)
27*35974Sbostic#FOPTS = -q -I2 -L1 -i -DPDP # -Nn650 -Ddebug
28*35974Sbostic# use -DNOCC if system does not react on carriage control (e.g. Unix)
29*35974SbosticFFLAGS = -O -DNOCC $(FOPTS)
30*35974Sbostic
31*35974Sbostic# flags for the loader
32*35974SbosticLDFLAGS = # -s -g -v
33*35974Sbostic
34*35974Sbostic# Directory path for main program - default /usr/games
35*35974SbosticBIN = /usr/games
36*35974Sbostic# Directory path for data files - default is /usr/games/lib/dunlib
37*35974SbosticLIB = /usr/games/lib/dunlib
38*35974SbosticDDIR = \'/usr/games/lib/dunlib
39*35974SbosticDCDIR =\"/usr/games/lib/dunlib
40*35974Sbostic# Directory path for man page - default /usr/manl/man6
41*35974SbosticMDIR = /usr/manl/man6
42*35974Sbostic# userid for wizard - allows invoking game debugging tool - default 0
43*35974SbosticWIZDEF = -DWIZARDID=320
44*35974Sbostic
45*35974SbosticHDRS =	advers.h clock.h curxt.h debug.h exits.h files.h flags.h\
46*35974Sbostic	gamestate.h io.h mindex.h objects.h oflags.h oindex.h\
47*35974Sbostic	parser.h puzzle.h rflag.h rindex.h rooms.h screen.h state.h\
48*35974Sbostic	verbs.h villians.h vocab.h xpars.h xsrch.h
49*35974Sbostic
50*35974SbosticFSRC =  actors.F ballop.F clockr.F demons.F\
51*35974Sbostic	dgame.F dinit.F dmain.F dso1.F dso2.F\
52*35974Sbostic	dso3.F dso4.F dso5.F dso6.F dso7.F\
53*35974Sbostic	dsub.F dverb1.F dverb2.F gdt.F lightp.F\
54*35974Sbostic	nobjs.F np.F np1.F np2.F np3.F nrooms.F objcts.F\
55*35974Sbostic	rooms.F sobjs.F sverbs.F verbs.F villns.F
56*35974Sbostic
57*35974SbosticCSRC =	cinit.c cio.c cspeak.c decode.c lex.c listen.c rtim.c
58*35974Sbostic
59*35974SbosticOBJS =  actors.o ballop.o clockr.o demons.o\
60*35974Sbostic	dgame.o dinit.o dmain.o dso1.o dso2.o\
61*35974Sbostic	dso3.o dso4.o dso5.o dso6.o dso7.o\
62*35974Sbostic	dsub.o dverb1.o dverb2.o gdt.o lightp.o\
63*35974Sbostic	nobjs.o np.o np1.o np2.o np3.o nrooms.o objcts.o\
64*35974Sbostic	rooms.o rtim.o sobjs.o sverbs.o verbs.o villns.o
65*35974Sbostic
66*35974SbosticPDPOBJS = cinit.o cio.o lex.o
67*35974SbosticLISTEN = listen.o
68*35974SbosticSPEAK = cspeak.o speak.o
69*35974Sbostic
70*35974Sbosticvax:	dungeon dtext.dat
71*35974Sbosticpdp:	dungpdp speak listen dtext.dat
72*35974Sbostic
73*35974Sbosticdungeon: $(OBJS)
74*35974Sbostic	f77 -o dungeon $(OBJS) $(LDFLAGS)
75*35974Sbostic	@echo done
76*35974Sbostic
77*35974Sbosticdungpdp: $(OBJS) $(PDPOBJS)
78*35974Sbostic	f77 -i -s -o dungpdp $(OBJS) $(PDPOBJS)
79*35974Sbostic	@echo done
80*35974Sbostic
81*35974Sbosticspeak:	$(SPEAK)
82*35974Sbostic	f77 -i -s -o speak $(SPEAK)
83*35974Sbostic
84*35974Sbosticspeak.o: speak.F
85*35974Sbostic	f77 $(FFLAGS) -DDDIR=$(DDIR) -c speak.F
86*35974Sbostic# For System V use the following instead:
87*35974Sbostic#	@/lib/cpp $(CPPFLAGS) speak.F > speak.f
88*35974Sbostic#	f77 $(FFLAGS) -DDDIR=$(DDIR) -c speak.f
89*35974Sbostic#	rm $*.f
90*35974Sbostic
91*35974Sbosticlisten:	$(LISTEN)
92*35974Sbostic	cc $(CFLAGS) -o listen $(LISTEN)
93*35974Sbostic
94*35974Sbosticlisten.o: listen.c
95*35974Sbostic	cc $(CFLAGS) -DCINDEXFILE=$(DCDIR)/dindx.dat\" -c listen.c
96*35974Sbostic
97*35974Sbosticdinit.o: dinit.F
98*35974Sbostic	f77 $(FFLAGS) -DDDIR=$(DDIR) $(WIZDEF) -c dinit.F
99*35974Sbostic# For System V use the following instead:
100*35974Sbostic#	@/lib/cpp $(CPPFLAGS) dinit.F > dinit.f
101*35974Sbostic#	f77 $(FFLAGS) -DDDIR=$(DDIR) $(WIZDEF) -c dinit.f
102*35974Sbostic#	rm $*.f
103*35974Sbostic
104*35974Sbostic# uncomment the following for Suns to get around an optimizer bug
105*35974Sbostic# -P means partial optimization.
106*35974Sbostic#objcts.o: objcts.F
107*35974Sbostic#	f77 $(FOPTS) -P -c objcts.F
108*35974Sbostic
109*35974Sbosticinstall-vax: vax
110*35974Sbostic	cp dungeon $(BIN)
111*35974Sbostic	-mkdir $(LIB)
112*35974Sbostic	cp dindx.dat dtext.dat $(LIB)
113*35974Sbostic	cp dungeon.6 $(MDIR)/dungeon.6
114*35974Sbostic
115*35974Sbosticinstall-pdp: pdp
116*35974Sbostic	cp dungeon.sh $(BIN)
117*35974Sbostic	-mkdir $(LIB)
118*35974Sbostic	cp dindx.dat dtext.dat rtext.dat dungpdp $(LIB)
119*35974Sbostic	cp dungeon.6 $(MDIR)/dungeon.6
120*35974Sbostic
121*35974Sbosticdtext.dat:
122*35974Sbostic	./maketxt.sh
123*35974Sbostic
124*35974Sbostic
125*35974Sbosticclean:
126*35974Sbostic	-rm $(OBJS) Mk* core makedep eddep
127*35974Sbostic
128*35974Sbosticdepend:
129*35974Sbostic	grep '^#include' $(FSRC) $(CSRC) $(HDRS) | grep -v '<' | \
130*35974Sbostic	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
131*35974Sbostic	    -e 's/\.c/.o/' \
132*35974Sbostic	    -e 's/\.F/.o/' \
133*35974Sbostic	    -e 's,../[a-zA-Z]*/,,' | \
134*35974Sbostic	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
135*35974Sbostic		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
136*35974Sbostic		       else rec = rec " " $$2 } } \
137*35974Sbostic	      END { print rec } ' > makedep
138*35974Sbostic	echo '$$r makedep' >>eddep
139*35974Sbostic	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
140*35974Sbostic	echo '$$r makedep' >>eddep
141*35974Sbostic	echo 'w' >>eddep
142*35974Sbostic	cp Makefile Makefile.bak
143*35974Sbostic	ed - Makefile < eddep
144*35974Sbostic	rm eddep makedep
145*35974Sbostic
146*35974Sbostic# DO NOT DELETE THIS LINE -- make depend uses it
147*35974Sbostic
148*35974Sbosticactors.o: parser.h gamestate.h rooms.h rflag.h rindex.h xsrch.h objects.h
149*35974Sbosticactors.o: oflags.h oindex.h clock.h advers.h verbs.h flags.h gamestate.h
150*35974Sbosticactors.o: debug.h rooms.h rflag.h rindex.h objects.h oflags.h oindex.h
151*35974Sbosticactors.o: villians.h flags.h
152*35974Sbosticballop.o: parser.h gamestate.h state.h rooms.h rflag.h curxt.h xpars.h
153*35974Sbosticballop.o: objects.h oflags.h oindex.h clock.h verbs.h flags.h
154*35974Sbosticclockr.o: gamestate.h state.h rooms.h rflag.h rindex.h objects.h oflags.h
155*35974Sbosticclockr.o: oindex.h clock.h curxt.h xsrch.h villians.h advers.h flags.h
156*35974Sbosticclockr.o: gamestate.h objects.h oflags.h clock.h
157*35974Sbosticdemons.o: parser.h gamestate.h objects.h oflags.h oindex.h villians.h advers.h
158*35974Sbosticdemons.o: verbs.h flags.h gamestate.h parser.h objects.h oflags.h clock.h
159*35974Sbosticdemons.o: advers.h verbs.h gamestate.h curxt.h xsrch.h objects.h oindex.h
160*35974Sbosticdemons.o: villians.h advers.h rindex.h objects.h oindex.h villians.h flags.h
161*35974Sbosticdgame.o: parser.h gamestate.h state.h io.h rooms.h rindex.h objects.h oflags.h
162*35974Sbosticdgame.o: oindex.h advers.h verbs.h flags.h parser.h villians.h gamestate.h
163*35974Sbosticdgame.o: objects.h advers.h
164*35974Sbosticdinit.o: files.h parser.h gamestate.h state.h screen.h mindex.h io.h debug.h
165*35974Sbosticdinit.o: rooms.h rflag.h rindex.h exits.h curxt.h xpars.h objects.h oindex.h
166*35974Sbosticdinit.o: clock.h villians.h advers.h flags.h
167*35974Sbosticdmain.o: parser.h gamestate.h state.h screen.h puzzle.h io.h debug.h rooms.h
168*35974Sbosticdmain.o: rflag.h rindex.h exits.h curxt.h xpars.h xsrch.h objects.h oflags.h
169*35974Sbosticdmain.o: oindex.h clock.h villians.h advers.h verbs.h flags.h
170*35974Sbosticdso1.o: gamestate.h rooms.h rflag.h objects.h oflags.h oindex.h advers.h
171*35974Sbosticdso1.o: flags.h gamestate.h objects.h oflags.h advers.h objects.h
172*35974Sbosticdso2.o: gamestate.h rooms.h rflag.h objects.h oindex.h advers.h gamestate.h
173*35974Sbosticdso2.o: state.h advers.h flags.h gamestate.h state.h clock.h advers.h flags.h
174*35974Sbosticdso3.o: rooms.h exits.h curxt.h xpars.h objects.h oflags.h
175*35974Sbosticdso4.o: objects.h oflags.h objects.h oflags.h objects.h state.h advers.h
176*35974Sbosticdso4.o: parser.h objects.h oflags.h oindex.h villians.h flags.h
177*35974Sbosticdso5.o: parser.h objects.h oflags.h verbs.h rooms.h rflag.h objects.h oflags.h
178*35974Sbosticdso5.o: advers.h objects.h
179*35974Sbosticdso6.o: rooms.h rflag.h rindex.h rindex.h flags.h
180*35974Sbosticdso7.o: rooms.h rflag.h rindex.h objects.h oflags.h flags.h flags.h
181*35974Sbosticdsub.o: gamestate.h mindex.h io.h parser.h objects.h debug.h objects.h
182*35974Sbosticdsub.o: objects.h objects.h parser.h gamestate.h state.h io.h debug.h rooms.h
183*35974Sbosticdsub.o: rflag.h rindex.h objects.h oflags.h oindex.h advers.h flags.h advers.h
184*35974Sbosticdsub.o: flags.h parser.h gamestate.h screen.h rooms.h rflag.h xsrch.h objects.h
185*35974Sbosticdsub.o: advers.h verbs.h flags.h
186*35974Sbosticdverb1.o: parser.h gamestate.h state.h objects.h oflags.h advers.h parser.h
187*35974Sbosticdverb1.o: gamestate.h rindex.h objects.h oflags.h advers.h verbs.h parser.h
188*35974Sbosticdverb1.o: gamestate.h objects.h oflags.h advers.h verbs.h parser.h gamestate.h
189*35974Sbosticdverb1.o: objects.h oflags.h verbs.h
190*35974Sbosticdverb2.o: parser.h gamestate.h state.h screen.h puzzle.h rooms.h exits.h
191*35974Sbosticdverb2.o: objects.h clock.h villians.h advers.h flags.h parser.h gamestate.h
192*35974Sbosticdverb2.o: state.h screen.h puzzle.h rooms.h exits.h objects.h clock.h
193*35974Sbosticdverb2.o: villians.h advers.h flags.h parser.h gamestate.h rooms.h rflag.h
194*35974Sbosticdverb2.o: curxt.h xsrch.h objects.h oflags.h clock.h villians.h advers.h
195*35974Sbosticdverb2.o: flags.h gamestate.h parser.h puzzle.h rooms.h rindex.h exits.h
196*35974Sbosticdverb2.o: curxt.h xpars.h xsrch.h objects.h oflags.h oindex.h advers.h flags.h
197*35974Sbosticgdt.o: parser.h gamestate.h state.h screen.h puzzle.h io.h mindex.h debug.h
198*35974Sbosticgdt.o: rooms.h rindex.h exits.h objects.h oindex.h clock.h villians.h advers.h
199*35974Sbosticgdt.o: flags.h
200*35974Sbosticlightp.o: parser.h gamestate.h objects.h oflags.h oindex.h clock.h verbs.h
201*35974Sbosticlightp.o: flags.h
202*35974Sbosticnobjs.o: parser.h gamestate.h state.h screen.h puzzle.h rooms.h rflag.h
203*35974Sbosticnobjs.o: rindex.h objects.h oflags.h oindex.h clock.h villians.h advers.h
204*35974Sbosticnobjs.o: verbs.h flags.h gamestate.h parser.h verbs.h flags.h
205*35974Sbosticnp.o: parser.h io.h debug.h parser.h xsrch.h parser.h debug.h
206*35974Sbosticnp1.o: parser.h gamestate.h debug.h objects.h oindex.h advers.h verbs.h vocab.h
207*35974Sbosticnp2.o: parser.h gamestate.h debug.h objects.h oflags.h advers.h vocab.h
208*35974Sbosticnp2.o: objects.h oflags.h vocab.h
209*35974Sbosticnp3.o: parser.h vocab.h debug.h vocab.h parser.h objects.h parser.h parser.h
210*35974Sbosticnp3.o: gamestate.h state.h objects.h oflags.h advers.h parser.h gamestate.h
211*35974Sbosticnp3.o: objects.h oflags.h advers.h
212*35974Sbosticnrooms.o: parser.h gamestate.h state.h io.h rooms.h rflag.h rindex.h objects.h
213*35974Sbosticnrooms.o: oflags.h oindex.h xsrch.h clock.h advers.h verbs.h flags.h
214*35974Sbosticnrooms.o: gamestate.h flags.h rindex.h flags.h
215*35974Sbosticobjcts.o: parser.h gamestate.h state.h rooms.h rflag.h rindex.h objects.h
216*35974Sbosticobjcts.o: oflags.h oindex.h clock.h advers.h verbs.h flags.h
217*35974Sbosticrooms.o: parser.h gamestate.h state.h rooms.h rflag.h rindex.h objects.h
218*35974Sbosticrooms.o: oflags.h oindex.h clock.h villians.h advers.h verbs.h flags.h
219*35974Sbosticsobjs.o: parser.h gamestate.h state.h rooms.h rflag.h rindex.h objects.h
220*35974Sbosticsobjs.o: oflags.h oindex.h clock.h villians.h advers.h verbs.h flags.h
221*35974Sbosticsverbs.o: parser.h gamestate.h state.h screen.h io.h rooms.h rflag.h rindex.h
222*35974Sbosticsverbs.o: exits.h curxt.h xpars.h xsrch.h objects.h oflags.h oindex.h clock.h
223*35974Sbosticsverbs.o: advers.h verbs.h flags.h
224*35974Sbosticverbs.o: parser.h gamestate.h state.h rooms.h rflag.h rindex.h xsrch.h
225*35974Sbosticverbs.o: objects.h oflags.h oindex.h advers.h verbs.h clock.h
226*35974Sbosticvillns.o: parser.h gamestate.h objects.h oflags.h oindex.h verbs.h flags.h
227*35974Sbosticvillns.o: parser.h gamestate.h objects.h oflags.h oindex.h verbs.h flags.h
228*35974Sbosticvillns.o: parser.h gamestate.h rindex.h objects.h oflags.h oindex.h clock.h
229*35974Sbosticvillns.o: villians.h verbs.h flags.h
230