1# Makefile for dungeon
2# By Jonathan Mark <uunet!microsoft!jonm>
3
4MSC	= 1		# this is the Microsoft C version (for DOS)
5
6!if $(MSC)
7O = obj                 # suffix for object files
8BINDIR = .		# Where to install the program
9LIBDIR = .		# Where to install the data file
10TARGET = dungeon.exe
11!else
12O = o			# suffix for object files
13BINDIR = /usr/games	# Where to install the program
14LIBDIR = /usr/games/lib # Where to install the data file
15TARGET = dungeon
16!endif
17
18# The dungeon program provides a ``more'' facility which tries to
19# figure out how many rows the terminal has.  Several mechanisms are
20# supported for determining this; the most common one has been left
21# uncommented.  If you have trouble, especially when linking, you may
22# have to select a different option.
23
24# more option 1: use the termcap routines.  On some systems the LIBS
25# variable may need to be set to -lcurses.  On some it may need to
26# be /usr/lib/termcap.o.  These options are commented out below.
27# LIBS = -ltermcap
28# TERMFLAG =
29# LIBS = -lcurses
30# LIBS = /usr/lib/termcap.o
31
32# more option 2: use the terminfo routines.  On some systems the LIBS
33# variable needs to be -lcursesX, but probably all such systems support
34# the termcap routines (option 1) anyhow.
35# LIBS = -lcurses
36# TERMFLAG = -DMORE_TERMINFO
37
38# more option 3: assume all terminals have 24 rows
39!if $(MSC)
40LIBS =
41TERMFLAG = -DMORE_24
42!endif
43
44# more option 4: don't use the more facility at all
45# LIBS =
46# TERMFLAG = -DMORE_NONE
47
48# End of more options
49
50# Uncomment the following line if you want to have access to the game
51# debugging tool.  This is invoked by typing "gdt".  It is not much
52# use except for debugging.
53# GDTFLAG = -DALLOW_GDT
54
55# Compilation flags
56!if $(MSC)
57# MSC-specific compile options:
58#	-AM	"medium" memory model (code > 64k, data < 64k)
59#	-Za	disables Microsoft C extensions.  This causes the compiler to
60#		  define __STDC__, which in turn causes BINREAD to be defined
61#		  as "rb", etc.  (This seems odd -- is the "b" suffix in
62#		  ANSI C?) [Yes, it is]
63CFLAGS = -O -AM -Za
64!else
65CFLAGS = -O
66!endif
67
68##################################################################
69
70# Source files
71CSRC =	actors.c ballop.c clockr.c demons.c dgame.c dinit.c dmain.c\
72	dso1.c dso2.c dso3.c dso4.c dso5.c dso6.c dso7.c dsub.c dverb1.c\
73	dverb2.c gdt.c lightp.c local.c nobjs.c np.c np1.c np2.c np3.c\
74	nrooms.c objcts.c rooms.c sobjs.c supp.c sverbs.c verbs.c villns.c
75
76# Object files
77OBJS1 =	actors.$O ballop.$O clockr.$O demons.$O dgame.$O dinit.$O dmain.$O
78OBJS2 =	dso1.$O dso2.$O dso3.$O dso4.$O dso5.$O dso6.$O dso7.$O dsub.$O
79OBJS3 = dverb1.$O dverb2.$O gdt.$O lightp.$O local.$O nobjs.$O np.$O np1.$O
80OBJS4 = np2.$O np3.$O nrooms.$O objcts.$O rooms.$O sobjs.$O supp.$O sverbs.$O
81OBJS5 = verbs.$O villns.$O
82OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5)
83
84!if $(MSC)
85# If we try to link as one $(CC) command, the command line is too long for
86# DOS to accept.  We therefore have to use the ugly "response file" syntax.
87#
88$(TARGET): $(OBJS) dtextc.dat
89	link @<<
90$(OBJS1)+
91$(OBJS2)+
92$(OBJS3)+
93$(OBJS4)+
94$(OBJS5)
95$(TARGET)
96/map /codeview
97$(LIBS)
98
99<<
100!else
101$(TARGET): $(OBJS) dtextc.dat
102	$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
103!endif
104
105install: $(TARGET) dtextc.dat
106	cp $(TARGET) $(BINDIR)
107	cp dtextc.dat $(LIBDIR)
108
109clean:
110	rm -f $(OBJS) $(TARGET) core dsave.dat *~
111
112dtextc.dat:
113	cat dtextc.uu1 dtextc.uu2 dtextc.uu3 dtextc.uu4 >dtextc.uu
114	uudecode dtextc.uu
115	rm -f dtextc.uu
116
117dinit.$O: dinit.c funcs.h vars.h
118	$(CC) $(CFLAGS) $(GDTFLAG) -DTEXTFILE=\"$(LIBDIR)/dtextc.dat\" -c dinit.c
119
120dgame.$O: dgame.c funcs.h vars.h
121	$(CC) $(CFLAGS) $(GDTFLAG) -c dgame.c
122
123gdt.$O: gdt.c funcs.h vars.h
124	$(CC) $(CFLAGS) $(GDTFLAG) -c gdt.c
125
126local.$O: local.c funcs.h vars.h
127	$(CC) $(CFLAGS) $(GDTFLAG) -c local.c
128
129supp.$O: supp.c funcs.h vars.h
130	$(CC) $(CFLAGS) $(TERMFLAG) -c supp.c
131
132actors.$O: funcs.h vars.h
133ballop.$O: funcs.h vars.h
134clockr.$O: funcs.h vars.h
135demons.$O: funcs.h vars.h
136dmain.$O: funcs.h vars.h
137dso1.$O: funcs.h vars.h
138dso2.$O: funcs.h vars.h
139dso3.$O: funcs.h vars.h
140dso4.$O: funcs.h vars.h
141dso5.$O: funcs.h vars.h
142dso6.$O: funcs.h vars.h
143dso7.$O: funcs.h vars.h
144dsub.$O: funcs.h vars.h
145dverb1.$O: funcs.h vars.h
146dverb2.$O: funcs.h vars.h
147lightp.$O: funcs.h vars.h
148nobjs.$O: funcs.h vars.h
149np.$O: funcs.h vars.h
150np1.$O: funcs.h vars.h parse.h
151np2.$O: funcs.h vars.h parse.h
152np3.$O: funcs.h vars.h parse.h
153nrooms.$O: funcs.h vars.h
154objcts.$O: funcs.h vars.h
155rooms.$O: funcs.h vars.h
156sobjs.$O: funcs.h vars.h
157sverbs.$O: funcs.h vars.h
158verbs.$O: funcs.h vars.h
159villns.$O: funcs.h vars.h
160
161
162