1# Makefile 4.15 84/12/03 2# 3DESTDIR= 4CFLAGS= -O 5 6# The following sources are incomplete and cannot be compiled without 7# some work 8WORK= aard ddl mpu 9 10# Programs that live in subdirectories, and have makefiles of their own. 11# 12SUBDIR= adventure backgammon battlestar boggle compat cribbage doctor fortune \ 13 hangman hunt mille monop quiz rogue sail snake trek zork 14 15# Shell scripts that need only be installed and are never removed. 16# 17#SCRIPT= 18 19# C programs that live in the current directory and do not need 20# explicit make lines. 21# 22STD= arithmetic btlgammon banner bcd cfscores chess factor \ 23 fish number wump 24 25# C programs that live in the current directory and need explicit make lines. 26# 27NSTD= canfield primes rain worm worms 28 29all: ${SUBDIR} ${STD} ${NSTD} 30 31${SUBDIR}: /tmp 32 cd $@; make ${MFLAGS} 33 34${STD}: 35 cc ${CFLAGS} -o $@ $@.c 36 37install: 38 for i in ${SUBDIR}; do \ 39 (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done 40# for i in ${SCRIPT}; do (install -c $$i ${DESTDIR}/usr/games/$$i); done 41 for i in ${STD} ${NSTD}; do \ 42 (install -s $$i ${DESTDIR}/usr/games/$$i); \ 43 done 44 install -c chess.bin ${DESTDIR}/usr/games/lib/chess 45 cat >${DESTDIR}/usr/games/lib/cfscores </dev/null 46 chmod 777 ${DESTDIR}/usr/games/lib/cfscores 47 48clean: 49 rm -f a.out core *.s *.o 50 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done 51 rm -f ${STD} ${NSTD} 52 53depend: 54 cat </dev/null >x.c 55 for i in ${STD} ${NSTD}; do \ 56 (echo $$i: $$i.c >>makedep; \ 57 /bin/grep '^#[ ]*include' x.c $$i.c | sed \ 58 -e 's,<\(.*\)>,"/usr/include/\1",' \ 59 -e 's/:[^"]*"\([^"]*\)".*/: \1/' \ 60 -e 's/\.c//' >>makedep); done 61 echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep 62 echo '$$r makedep' >>eddep 63 echo 'w' >>eddep 64 cp Makefile Makefile.bak 65 ed - Makefile < eddep 66 rm eddep makedep x.c 67 echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile 68 echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile 69 echo '# see make depend above' >> Makefile 70 71# Files listed in ${NSTD} have explicit make lines given below. 72 73canfield: 74 cc -o canfield ${CFLAGS} canfield.c -lcurses -ltermcap 75 76primes: 77 cc -o primes ${CFLAGS} primes.c -lm 78 79rain: 80 cc -o rain ${CFLAGS} rain.c -lcurses -ltermcap 81 82worm: 83 cc -o worm ${CFLAGS} worm.c -lcurses -ltermcap 84 85worms: 86 cc -o worms ${CFLAGS} worms.c -lcurses -ltermcap 87 88# DO NOT DELETE THIS LINE -- make depend uses it 89 90arithmetic: arithmetic.c 91arithmetic: /usr/include/stdio.h 92arithmetic: /usr/include/signal.h 93btlgammon: btlgammon.c 94btlgammon: /usr/include/stdio.h 95banner: banner.c 96banner: /usr/include/stdio.h 97bcd: bcd.c 98cfscores: cfscores.c 99cfscores: /usr/include/pwd.h 100chess: chess.c 101chess: /usr/include/stdio.h 102fish: fish.c 103fish: /usr/include/stdio.h 104number: number.c 105wump: wump.c 106wump: /usr/include/stdio.h 107wump: /usr/include/sgtty.h 108canfield: canfield.c 109canfield: /usr/include/curses.h 110canfield: /usr/include/ctype.h 111canfield: /usr/include/signal.h 112canfield: /usr/include/sys/types.h 113rain: rain.c 114rain: /usr/include/stdio.h 115rain: /usr/include/sgtty.h 116rain: /usr/include/signal.h 117worm: worm.c 118worm: /usr/include/ctype.h 119worm: /usr/include/curses.h 120worm: /usr/include/signal.h 121worms: worms.c 122worms: /usr/include/stdio.h 123worms: /usr/include/sgtty.h 124# DEPENDENCIES MUST END AT END OF FILE 125# IF YOU PUT STUFF HERE IT WILL GO AWAY 126# see make depend above 127