view rogue4/Makefile.in @ 310:827441d05b3e

Advanced Rogue family: fix some potential buffer overflows. Some code for determining the score file location assumed that PATH_MAX would be less than 1024, which cannot be guaranteed. Advanced Rogue 5 and 7, and XRogue, have had the buffers for the file name enlarged. UltraRogue never called the functions, so the code has been deleted instead.
author John "Elwin" Edwards
date Mon, 03 May 2021 19:05:37 -0400
parents fe6b7a1a6dfc
children
line wrap: on
line source

#
# Makefile for rogue
# @(#)Makefile	4.13 (Berkeley) 1/23/82
#
# Rogue: Exploring the Dungeons of Doom
# Copyright (C) 1980, 1981, 1982 Michael Toy, Ken Arnold and Glenn Wichman
# All rights reserved.
#
# See the file LICENSE.TXT for full copyright and licensing information.
#

DISTNAME=@PACKAGE_TARNAME@-@PACKAGE_VERSION@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PROGRAM=@PROGRAM@

CC    = @CC@
LIBS =	@LIBS@

SCOREFILE=@SCOREFILE@
LOGFILE=@LOGFILE@
SAVEDIR=@SAVEDIR@
LOCKFILE=@LOCKFILE@

GROUPOWNER=@GROUPOWNER@

DESTDIR=
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
bindir=@bindir@
mandir=@mandir@
man6dir=$(mandir)/man6
docdir=@docdir@

HDRS=	rogue.h extern.h config.h
DOBJS=	vers.o extern.o armor.o chase.o command.o daemon.o daemons.o \
	fight.o init.o io.o list.o main.o misc.o monsters.o move.o \
	new_level.o options.o pack.o passages.o potions.o rings.o rip.o \
	rooms.o save.o scrolls.o state.o sticks.o things.o weapons.o wizard.o\
        xcrypt.o mdport.o
OBJS=	$(DOBJS) mach_dep.o
CFILES=	vers.c extern.c armor.c chase.c command.c daemon.c daemons.c \
	fight.c init.c io.c list.c main.c misc.c monsters.c move.c \
	new_level.c options.c pack.c passages.c potions.c rings.c rip.c \
	rooms.c save.c scrolls.c state.c sticks.c things.c weapons.c wizard.c \
	mach_dep.c xcrypt.c mdport.c
MISC=	Makefile LICENSE.TXT rogue.6 rogue.me
DOCS=	$(PROGRAM).cat $(PROGRAM).doc

CFLAGS=
CPPFLAGS=@DEFS@
CRLIB = -lcurses
RM    = rm -f
TAR   = tar
TOUCH=touch
MKDIR=mkdir
CHGRP=chgrp
CHMOD=chmod
INSTALL=@INSTALL@
GROFF=@GROFF@
NROFF=@NROFF@
COLCRT=@COLCRT@
TBL=@TBL@

SF=
NAMELIST=
NL=
#MACHDEP=	-DMAXLOAD=40 -DLOADAV -DCHECKTIME=4
MACHDEP=

.SUFFIXES: .c .o

.c.o:
	@echo $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
	@$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o
#	@cpp -P $(CFLAGS) $*.c | ./xstr -v -c -
#	@cc -c $(CFLAGS) x.c
#	@mv x.o $*.o

all: $(PROGRAM) docs

$(PROGRAM): $(HDRS) $(OBJS) # xs.o
#	@rm -f x.c
#	$(CC) $(LDFLAGS) xs.o $(OBJS) $(CRLIB) 
	$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@

main.o: main.c $(HDRS)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ main.c

vers.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) vers.c

mach_dep.o: mach_dep.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(SF) $(NL) $(MACHDEP) mach_dep.c

xs.o: strings
	./xstr
	$(CC) -c $(CFLAGS) xs.c

xstr: xstr.c
	$(CC) -s -O -o xstr xstr.c

findpw: findpw.c xcrypt.c
	$(CC) -s -o findpw findpw.c xcrypt.c

prob: prob.o extern.o xs.o
	$(CC) -O -o prob prob.o extern.o xs.o

prob.o: prob.c rogue.h
	$(CC) -O -c prob.c

docs: $(DOCS)

$(PROGRAM).cat@DOCS_GROFF@: rogue.6
	$(GROFF) -P-c -P-b -P-u -Tascii -man rogue.6 > $(PROGRAM).cat

$(PROGRAM).cat@DOCS_NROFF@: rogue.6
	$(NROFF) -man rogue.6 | $(COLCRT) - > $(PROGRAM).cat

$(PROGRAM).cat@DOCS_NONE@: rogue.6
	@echo "Not building" $(PROGRAM).cat

$(PROGRAM).doc@DOCS_GROFF@: rogue.me
	$(GROFF) -P-c -P-b -P-u -t -me -Tutf8 rogue.me > $(PROGRAM).doc

$(PROGRAM).doc@DOCS_NROFF@: rogue.me
	$(TBL) rogue.me | $(NROFF) -me | $(COLCRT) - > $(PROGRAM).doc

$(PROGRAM).doc@DOCS_NONE@: rogue.me
	@echo "Not building" $(PROGRAM).doc

clean:
	rm -f $(POBJS) $(OBJS) core a.out p.out $(PROGRAM) strings make.out rogue.tar vgrind.* x.c x.o xs.c xs.o linterrs findpw distmod.o xs.po xstr rogue rogue.exe rogue.tar.gz $(DOCS) xstr.exe

maintainer-clean:
	make clean
	$(RM) Makefile config.h
	$(RM) config.status config.log
	$(RM) $(PROGRAM).scr $(PROGRAM).log $(PROGRAM).lck
	$(RM) rogue.6 rogue.me

install: all
	$(TOUCH) test
	if test ! -f $(DESTDIR)$(SCOREFILE) ; then \
	    $(MKDIR) -p `dirname $(DESTDIR)$(SCOREFILE)` ; \
	    $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi
	if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \
	    $(MKDIR) -p `dirname $(DESTDIR)$(LOGFILE)` ; \
	    $(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi
	if test "x$(SAVEDIR)" != "x" && test ! -d $(DESTDIR)$(SAVEDIR) ; then \
	    $(MKDIR) -p $(DESTDIR)$(SAVEDIR) ; fi
	$(MKDIR) -p $(DESTDIR)$(bindir)
	$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)
	-if test "x$(GROUPOWNER)" != "x" ; then \
	    $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(SCOREFILE) ; \
	    $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(LOGFILE) ; \
	    $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(bindir)/$(PROGRAM) ; \
	    $(CHGRP) $(GROUPOWNER) $(DESTDIR)$(SAVEDIR) ; \
	    $(CHMOD) 02755 $(DESTDIR)$(bindir)/$(PROGRAM) ; \
	    $(CHMOD) 0464 $(DESTDIR)$(SCOREFILE) ; \
	    $(CHMOD) 0464 $(DESTDIR)$(LOGFILE) ; \
	    $(CHMOD) 0775 $(DESTDIR)$(SAVEDIR) ; \
        fi
	if test ! -d $(DESTDIR)$(man6dir) && test -d $(DESTDIR)$(mandir) ; \
	    then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(mandir)/$(PROGRAM).6 ; \
	    else $(MKDIR) -p $(DESTDIR)$(man6dir) ; \
	    $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(man6dir)/$(PROGRAM).6 ; fi
	if test ! -d $(DESTDIR)$(docdir) ; \
	    then $(MKDIR) -p $(DESTDIR)$(docdir) ; fi
	$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
	$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me
	$(INSTALL) -m 0644 $(DOCS) $(DESTDIR)$(docdir)
	if test "x$(LOCKFILE)" != "x" && test ! -f $(DESTDIR)$(LOCKFILE) ; then \
	    $(INSTALL) -m 0666 test $(DESTDIR)$(LOCKFILE)  ; \
	    $(RM) $(DESTDIR)$(LOCKFILE) ; \
	fi
	$(RM) test

uninstall:	
	$(RM) $(DESTDIR)$(bindir)/$(PROGRAM)
	$(RM) $(DESTDIR)$(man6dir)/$(PROGRAM).6
	$(RM) $(DESTDIR)$(mandir)/$(PROGRAM).6
	$(RM) -r $(DESTDIR)$(docdir)
	if test "x$(LOCKFILE)" != "x" ; then \
	    $(RM) $(DESTDIR)$(LOCKFILE) ; fi
    
reinstall: uninstall install

dist.src:
	make clean
	tar cf $(DISTNAME)-src.tar $(CFILES) $(HDRS) $(MISC)
	gzip -f $(DISTNAME)-src.tar

debug.irix:
	make clean
	make CC=cc CFLAGS="-woff 1116 -g -DWIZARD" rogue
dist.irix:
	make clean
	make CC=cc CFLAGS="-woff 1116 -O3" rogue
	tbl rogue.me | nroff -me | colcrt - > rogue.doc
	nroff -man rogue.6 | colcrt - > rogue.cat
	tar cf $(DISTNAME)-irix.tar rogue LICENSE.TXT rogue.cat rogue.doc
	gzip -f $(DISTNAME)-irix.tar

debug.aix:
	make clean
	make CC=xlc CFLAGS="-qmaxmem=16768 -g -qstrict -DWIZARD" rogue
dist.aix:
	make clean
	make CC=xlc CFLAGS="-qmaxmem=16768 -O3 -qstrict" rogue
	tbl rogue.me | nroff -me | colcrt - > rogue.doc
	nroff -man rogue.6 | colcrt - > rogue.cat
	tar cf $(DISTNAME)-aix.tar rogue LICENSE.TXT rogue.cat rogue.doc
	gzip -f $(DISTNAME)-aix.tar

debug.linux:
	make clean
	make CFLAGS="-g3 -DWIZARD" rogue
dist.linux:
	make clean
	make rogue
	groff -P-c -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc
	groff -man rogue.6 | sed -e 's/.\x08//g' > rogue.cat
	tar cf $(DISTNAME)-linux.tar rogue LICENSE.TXT rogue.cat rogue.doc
	gzip -f $(DISTNAME)-linux.tar
	
debug.interix:
	make clean
	make CFLAGS="-g3 -DWIZARD" rogue
dist.interix: 
	make clean
	make rogue
	groff -P-b -P-u -t -me -Tascii rogue.me > rogue.doc
	groff -P-b -P-u -man -Tascii rogue.6 > rogue.cat
	tar cf $(DISTNAME)-interix.tar rogue LICENSE.TXT rogue.cat rogue.doc
	gzip -f $(DISTNAME)-interix.tar
	
debug.cygwin:
	make clean
	make CFLAGS="-g3 -DWIZARD" rogue
dist.cygwin:
	make clean
	make rogue
	groff -P-c -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc
	groff -P-c -man -Tascii rogue.6 | sed -e 's/.\x08//g' > rogue.cat
	tar cf $(DISTNAME)-cygwin.tar rogue.exe LICENSE.TXT rogue.cat rogue.doc
	gzip -f $(DISTNAME)-cygwin.tar
	
debug.djgpp:
	make clean
	make CFLAGS="-g3 -DWIZARD" LDFLAGS="-L$(DJDIR)/LIB" rogue
dist.djgpp: 
	make clean
	make CFLAGS="-O3" LDFLAGS="-L$(DJDIR)/LIB" rogue
	groff -t -me -Tascii rogue.me | sed -e 's/.\x08//g' > rogue.doc
	groff -man -Tascii rogue.6 | sed -e 's/.\x08//g' > rogue.cat
	rm -f $(DISTNAME)-djgpp.zip
	zip $(DISTNAME)-djgpp.zip rogue.exe LICENSE.TXT rogue.cat rogue.doc