#CFLAGS = -g
# For playing the game, you may want to use this line
CFLAGS = -O 

# For BSD Systems
CURSES = -lcurses -ltermcap
# For SYS V Systems
# CURSES = -lcurses
# For XENIX, some XENIX systems may need -ltinfo
# CURSES = -ltcap -ltermcap -lx

# CHANGE HERE
#This is where the moria binary will be put
BINDIR = /usr/games/bin

#CHANGE HERE
#This is where the lib files go
LIBDIR = /usr/games/lib/umoria

#CHANGE HERE
#This is where the man page should go.
MANDIR = /usr/games/man/man6

#CHANGE HERE
#This is where the main doc should go.
DOCDIR = /usr/games/doc/umoria

CC = gcc

SRCS = main.c misc1.c misc2.c store1.c files.c io.c create.c desc.c\
	generate.c sets.c dungeon.c creature.c death.c eat.c help.c magic.c\
	potions.c prayer.c save.c staffs.c wands.c scrolls.c spells.c\
	wizard.c store2.c signals.c moria1.c moria2.c monsters.c\
	treasure.c variable.c rnd.c recall.c unix.c\
	player.c tables.c

OBJS = main.o misc1.o misc2.o store1.o files.o io.o create.o desc.o\
	generate.o sets.o dungeon.o creature.o death.o eat.o help.o magic.o\
	potions.o prayer.o save.o staffs.o wands.o scrolls.o spells.o\
	wizard.o store2.o signals.o moria1.o moria2.o monsters.o\
	treasure.o variable.o rnd.o recall.o unix.o\
	player.o tables.o

LIBFILES = hours news origcmds.hlp owizcmds.hlp roglcmds.hlp rwizcmds.hlp \
	version.hlp welcome.hlp

all : moria utils install

moria : $(OBJS)
	$(CC) -o moria $(CFLAGS) $(OBJS) $(CURSES) $(AUTHLIBS)

utils :
	make -C util/scores
	mv util/scores/prscore util/scores/delscore $(BINDIR)
	chmod 555 $(BINDIR)/prscore
# only the owner can write to the scores file, but this extra security
# doesn't hurt. 
	chmod 500 $(BINDIR)/delscore
	

lintout : $(SRCS)
	lint $(SRCS) $(CURSES) > lintout

lintout2 : $(SRCS)
	lint -bach $(SRCS) $(CURSES) > lintout

TAGS : $(SRCS)
	ctags -x $(SRCS) > TAGS

install:
#	install -c -s moria $(SECURE)moria
# For those who don't have install.

	cp moria $(BINDIR)
	cp files/* $(LIBDIR)

# CHANGE HERE
# Change the filename to moria.man if you don't have groff or something 
# compatible.
	cp doc/moria.6 $(MANDIR)
	chmod 444 $(MANDIR)/moria.6
 
	cat doc/moria1.ms doc/moria2.ms > $(DOCDIR)/moria.ms
	chmod 444 $(DOCDIR)/moria.ms
	cat doc/moria1.txt doc/moria2.txt > $(DOCDIR)/moria.txt
	chmod 444 $(DOCDIR)/moria.txt

	chmod 4511 $(BINDIR)/moria
	chmod 644 $(LIBDIR)/scores
	chmod 444 $(LIBDIR)/hours
	chmod 444 $(LIBDIR)/news
	
	
clean:
	rm -r *.o
	rm -i moria

create.o: constant.h types.h externs.h config.h
creature.o: constant.h types.h externs.h config.h
death.o: constant.h types.h externs.h config.h
desc.o: constant.h types.h externs.h config.h
dungeon.o: constant.h types.h externs.h config.h
eat.o: constant.h types.h externs.h config.h
files.o: constant.h types.h externs.h config.h
generate.o: constant.h types.h externs.h config.h
help.o: constant.h types.h externs.h config.h
io.o: constant.h types.h externs.h config.h
magic.o: constant.h types.h externs.h config.h
main.o: constant.h types.h externs.h config.h
misc1.o: constant.h types.h externs.h config.h
misc2.o: constant.h types.h externs.h config.h
monsters.o: constant.h types.h config.h
moria1.o: constant.h types.h externs.h config.h
moria2.o: constant.h types.h externs.h config.h
player.o: constant.h types.h config.h
potions.o: constant.h types.h externs.h config.h
prayer.o: constant.h types.h externs.h config.h
recall.o: constant.h config.h types.h externs.h
rnd.o: constant.h types.h
save.o: constant.h types.h externs.h config.h
scrolls.o: constant.h types.h externs.h config.h
sets.o: constant.h config.h
signals.o: constant.h types.h externs.h config.h
spells.o: constant.h types.h externs.h config.h
staffs.o: constant.h types.h externs.h config.h
store1.o: constant.h types.h externs.h config.h
store2.o: constant.h types.h externs.h config.h
tables.o: constant.h types.h config.h
treasure.o: constant.h types.h config.h
unix.o: constant.h config.h types.h externs.h
variable.o: constant.h types.h config.h
wands.o: constant.h types.h externs.h config.h
wizard.o: constant.h types.h externs.h config.h









