abermud/DATA/
##  Abermud.
##  $Header: Makefile,v 1.3 89/07/03 08:33:36 rsalz Exp $

# User and group.
#
USER=mud
GROUP=mud

DATADIR	=	DATA/

DEFS	= 
LDEFS	= $(DEFS) -a -b -h
CFLAGS	= $(DEFS) -O

##  To compile with GCC use this line:
#CC	= gcc -fwritable-strings -traditional -O

HEADERS	= \
	kernel.h condact.h\
	objects.h verbs.h pflags.h

SRC_PROG= \
	action.c blib.c blood.c bootstrap.c bprintf.c condition.c \
	database.c debug.c exec.c extra.c frob.c key.c locdir.c loctable.c \
	magic.c mobile.c mudprog.c new1.c newuaf.c objsys.c opensys.c \
	parse.c parser.c showpriv.c support.c tk.c weather.c zones.c
OBJ_PROG= \
	action.o blib.o blood.o bootstrap.o bprintf.o condition.o \
	database.o debug.o exec.o extra.o frob.o key.o locdir.o loctable.o \
	magic.o mobile.o mudprog.o new1.o newuaf.o objsys.o opensys.o \
	parse.o parser.o showpriv.o support.o tk.o weather.o zones.o

SRC_DRIVER= \
	mud.c blib.c
OBJ_DRIVER= \
	mud.o blib.o

SRC_GEN	= \
	generate.c blib.c
OBJ_GEN	= \
	generate.o blib.o

##  These are the three programs that are built.
PROGRAMS= \
	mud mudprog
GENERATE= \
        generate
##  Data files.  If you change the pathnames, edit kernel.h and rebuild
##  the world.
DATAS	= \
	$(DATADIR)locations \
	$(DATADIR)reset_data $(DATADIR)world_file \
	$(DATADIR)uaf.rand $(DATADIR)user_file

DATA_SRC= \
	$(DATADIR)locations.1 \
	$(DATADIR)locations.2 \
	$(DATADIR)locations.3 \
	$(DATADIR)objects \
	$(DATADIR)reset.txt \
	$(DATADIR)examine.* \
	$(DATADIR)verbs \
	$(DATADIR)messages \
	$(DATADIR)promptlist \
	$(DATADIR)players \
	$(DATADIR)zones

##
all:		$(GENERATE) $(DATAS) $(PROGRAMS)

install:		all
	chown $(USER).$(GROUP) mud mudprog $(DATADIR)*
	chmod 4700 mudprog
	chmod 4711 mud

clean:
	rm -f $(PROGRAMS) $(DATAS) $(DATADIR)mud_syslog *.o
	rm -f a.out foo core tags lint* MANIFEST.BAK

lint:			lint.mud lint.prog lint.gen

tags:			FORCE
	ctags -t *.[ch]

FORCE:


##
lint.mud:		 $(HEADERS) mud
	lint $(LDEFS) $(SRC_DRIVER) | sed -f Fluff.sed >lint.mud
lint.prog:		 $(HEADERS) mudprog
	lint $(LDEFS) $(SRC_PROG) | sed -f Fluff.sed >lint.prog
lint.gen:		 $(HEADERS) generate
	lint $(LDEFS) $(SRC_GEN) >lint.gen


##  Packing.
tar:			clean
	tar cvf ../abermud.new.tar .
	compress ../abermud.new.tar

##  Printing...
print:
	more $(HEADERS) $(SRC_PROG) mud.c generate.c | lpr -Pprinter
	more $(DATA_SRC) | lpr -Pprinter

##  Programs.
mudprog:		$(HEADERS) $(OBJ_PROG)
	@rm -f mudprog
	cc -o mudprog $(OBJ_PROG)

mud:			$(HEADERS) $(OBJ_DRIVER)
	@rm -f mud
	cc -o mud $(OBJ_DRIVER)

generate:		$(OBJ_GEN)
	@rm -f generate
	cc -o generate $(OBJ_GEN)


##  Header file dependencies.
#$(OBJ_DRIVER):		kernel.h
#$(OBJ_PROG):		kernel.h
action.o condition.o database.o debug.o exec.o:	condact.h
#showpriv.o:		pflags.h
#database.o:		objects.h verbs.h

##  Data files built by the tools.
$(DATADIR)locations:		$(DATADIR)locations.1 \
				$(DATADIR)locations.2 \
				$(DATADIR)locations.3
	cat $(DATADIR)locations.1 $(DATADIR)locations.2 $(DATADIR)locations.3 \
		> $(DATADIR)locations
$(DATADIR)reset_data:	generate $(DATADIR)reset.txt
	./generate reset $(DATADIR)reset.txt $(DATADIR)reset_data
$(DATADIR)world_file:	generate
	./generate world $(DATADIR)world_file
$(DATADIR)uaf.rand:	generate
	./generate uaf $(DATADIR)uaf.rand
$(DATADIR)user_file:	generate
	./generate userfile $(DATADIR)user_file

objects.h: $(DATADIR)objects
	./generate objects $(DATADIR)objects objects.h
verbs.h: $(DATADIR)verbs
	./generate verbs $(DATADIR)verbs verbs.h