| 1 | # |
| 2 | # Copyright (c) 1980 Regents of the University of California. |
| 3 | # All rights reserved. The Berkeley software License Agreement |
| 4 | # specifies the terms and conditions for redistribution. |
| 5 | # |
| 6 | # @(#)Makefile 5.6 (Berkeley) %G% |
| 7 | # |
| 8 | DESTDIR= |
| 9 | CFLAGS= -O |
| 10 | |
| 11 | # Programs that live in subdirectories, and have makefiles of their own. |
| 12 | # |
| 13 | SUBDIR= adventure backgammon battlestar boggle cribbage fortune \ |
| 14 | hangman hunt mille monop quiz robots sail snake trek |
| 15 | |
| 16 | # Shell scripts that need only be installed and are never removed. |
| 17 | # |
| 18 | SCRIPT= wargames |
| 19 | |
| 20 | # C programs that live in the current directory and do not need |
| 21 | # explicit make lines. |
| 22 | # |
| 23 | STD= arithmetic btlgammon banner bcd cfscores factor fish number wump |
| 24 | |
| 25 | # C programs that live in the current directory and need explicit make lines. |
| 26 | # |
| 27 | NSTD= canfield primes rain worm worms |
| 28 | |
| 29 | # Programs that require a lisp interpreter or compiler |
| 30 | LISP= doctor |
| 31 | |
| 32 | all: ${SUBDIR} ${STD} ${NSTD} |
| 33 | cd games.`machine`; make ${MFLAGS} |
| 34 | |
| 35 | ${SUBDIR}: FRC |
| 36 | cd $@; make ${MFLAGS} |
| 37 | |
| 38 | FRC: |
| 39 | |
| 40 | ${STD}: |
| 41 | cc ${CFLAGS} -o $@ $@.c |
| 42 | |
| 43 | install: |
| 44 | -for i in ${SUBDIR}; do \ |
| 45 | (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done |
| 46 | -for i in ${SCRIPT}; do \ |
| 47 | (install -c $$i.sh ${DESTDIR}/usr/games/$$i); done |
| 48 | -for i in ${STD} ${NSTD}; do \ |
| 49 | (install -s $$i ${DESTDIR}/usr/games/$$i); done |
| 50 | -if [ ! -f ${DESTDIR}/usr/games/lib/cfscores ]; then \ |
| 51 | cat >${DESTDIR}/usr/games/lib/cfscores </dev/null; \ |
| 52 | chmod 777 ${DESTDIR}/usr/games/lib/cfscores; fi |
| 53 | cd games.`machine`; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 54 | |
| 55 | clean: |
| 56 | rm -f a.out core *.s *.o |
| 57 | -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done |
| 58 | rm -f ${STD} ${NSTD} |
| 59 | cd games.`machine`; make ${MFLAGS} DESTDIR=${DESTDIR} clean |
| 60 | |
| 61 | depend: |
| 62 | for i in ${STD} ${NSTD}; do \ |
| 63 | cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \ |
| 64 | awk ' { if ($$1 != prev) \ |
| 65 | { if (rec != "") print rec; rec = $$0; prev = $$1; } \ |
| 66 | else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \ |
| 67 | else rec = rec " " $$2 } } \ |
| 68 | END { print rec } ' >> makedep; done |
| 69 | echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep |
| 70 | echo '$$r makedep' >>eddep |
| 71 | echo 'w' >>eddep |
| 72 | cp Makefile Makefile.bak |
| 73 | ed - Makefile < eddep |
| 74 | rm eddep makedep |
| 75 | echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile |
| 76 | echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile |
| 77 | echo '# see make depend above' >> Makefile |
| 78 | |
| 79 | # Files listed in ${NSTD} have explicit make lines given below. |
| 80 | |
| 81 | canfield: |
| 82 | cc -o canfield ${CFLAGS} canfield.c -lcurses -ltermcap |
| 83 | |
| 84 | primes: |
| 85 | cc -o primes ${CFLAGS} primes.c -lm |
| 86 | |
| 87 | rain: |
| 88 | cc -o rain ${CFLAGS} rain.c -lcurses -ltermcap |
| 89 | |
| 90 | worm: |
| 91 | cc -o worm ${CFLAGS} worm.c -lcurses -ltermcap |
| 92 | |
| 93 | worms: |
| 94 | cc -o worms ${CFLAGS} worms.c -lcurses -ltermcap |
| 95 | |
| 96 | # DO NOT DELETE THIS LINE -- make depend uses it |
| 97 | |
| 98 | arithmetic: arithmetic.c /usr/include/stdio.h /usr/include/signal.h |
| 99 | btlgammon: btlgammon.c /usr/include/stdio.h |
| 100 | banner: banner.c /usr/include/stdio.h |
| 101 | bcd: bcd.c |
| 102 | cfscores: cfscores.c /usr/include/pwd.h |
| 103 | factor: factor.c |
| 104 | fish: fish.c /usr/include/stdio.h |
| 105 | number: number.c |
| 106 | wump: wump.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h |
| 107 | wump: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h |
| 108 | canfield: canfield.c /usr/include/curses.h /usr/include/stdio.h |
| 109 | canfield: /usr/include/sgtty.h /usr/include/sys/ioctl.h |
| 110 | canfield: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h |
| 111 | canfield: /usr/include/ctype.h /usr/include/signal.h /usr/include/sys/types.h |
| 112 | primes: primes.c /usr/include/stdio.h /usr/include/math.h |
| 113 | rain: rain.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h |
| 114 | rain: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h |
| 115 | rain: /usr/include/signal.h |
| 116 | worm: worm.c /usr/include/ctype.h /usr/include/curses.h /usr/include/stdio.h |
| 117 | worm: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h |
| 118 | worm: /usr/include/sys/ttydev.h /usr/include/signal.h |
| 119 | worms: worms.c /usr/include/stdio.h /usr/include/sgtty.h |
| 120 | worms: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h |
| 121 | worms: /usr/include/sys/ttydev.h /usr/include/signal.h |
| 122 | # DEPENDENCIES MUST END AT END OF FILE |
| 123 | # IF YOU PUT STUFF HERE IT WILL GO AWAY |
| 124 | # see make depend above |