| 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.1 (Berkeley) %G% |
| 7 | # |
| 8 | DESTDIR= |
| 9 | CFLAGS= -O |
| 10 | |
| 11 | # Programs that live in subdirectories, and have makefiles of their own. |
| 12 | # |
| 13 | SUBDIR= aard ching compat ddl rogue zork |
| 14 | |
| 15 | # C programs that live in the current directory and do not need |
| 16 | # explicit make lines. |
| 17 | # |
| 18 | STD= chess |
| 19 | |
| 20 | all: ${SUBDIR} ${STD} |
| 21 | |
| 22 | ${SUBDIR}: FRC |
| 23 | cd $@; make ${MFLAGS} |
| 24 | |
| 25 | FRC: |
| 26 | |
| 27 | ${STD}: |
| 28 | cc ${CFLAGS} -o $@ $@.c |
| 29 | |
| 30 | install: |
| 31 | -for i in ${SUBDIR}; do \ |
| 32 | (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done |
| 33 | -for i in ${STD}; do \ |
| 34 | (install -s $$i ${DESTDIR}/usr/games/$$i); done |
| 35 | install -c chess.bin ${DESTDIR}/usr/games/lib/chess |
| 36 | |
| 37 | clean: |
| 38 | rm -f a.out core *.s *.o |
| 39 | -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done |
| 40 | rm -f ${STD} |
| 41 | |
| 42 | depend: |
| 43 | for i in ${STD}; do \ |
| 44 | cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \ |
| 45 | awk ' { if ($$1 != prev) \ |
| 46 | { if (rec != "") print rec; rec = $$0; prev = $$1; } \ |
| 47 | else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \ |
| 48 | else rec = rec " " $$2 } } \ |
| 49 | END { print rec } ' >> makedep; done |
| 50 | echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep |
| 51 | echo '$$r makedep' >>eddep |
| 52 | echo 'w' >>eddep |
| 53 | cp Makefile Makefile.bak |
| 54 | ed - Makefile < eddep |
| 55 | rm eddep makedep |
| 56 | echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile |
| 57 | echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile |
| 58 | echo '# see make depend above' >> Makefile |
| 59 | |
| 60 | |
| 61 | # DO NOT DELETE THIS LINE -- make depend uses it |
| 62 | |
| 63 | chess: chess.c /usr/include/stdio.h |
| 64 | # DEPENDENCIES MUST END AT END OF FILE |
| 65 | # IF YOU PUT STUFF HERE IT WILL GO AWAY |
| 66 | # see make depend above |