| 1 | # |
| 2 | # Copyright (c) 1980, 1987 Regents of the University of California. |
| 3 | # All rights reserved. |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms are permitted |
| 6 | # provided that this notice is preserved and that due credit is given |
| 7 | # to the University of California at Berkeley. The name of the University |
| 8 | # may not be used to endorse or promote products derived from this |
| 9 | # software without specific prior written permission. This software |
| 10 | # is provided ``as is'' without express or implied warranty. |
| 11 | # |
| 12 | # @(#)Makefile 5.9 (Berkeley) %G% |
| 13 | # |
| 14 | DESTDIR= |
| 15 | CFLAGS= -O |
| 16 | LIBC= /lib/libc.a |
| 17 | |
| 18 | # Programs that live in subdirectories, and have makefiles of their own. |
| 19 | # |
| 20 | # doctor removed until lisp works |
| 21 | SUBDIR= adventure atc backgammon battlestar boggle btlgammon canfield \ |
| 22 | cribbage dm fortune gnuchess hack hangman hunt larn mille monop \ |
| 23 | phantasia quiz robots rogue sail snake trek \ |
| 24 | games.${MACHINE} |
| 25 | |
| 26 | # Shell scripts that need only be installed and are never removed. |
| 27 | # |
| 28 | SCRIPT= wargames |
| 29 | |
| 30 | # C sources that live in the current directory |
| 31 | # |
| 32 | SRCS= arithmetic.c banner.c bcd.c factor.c fish.c number.c primes.c \ |
| 33 | rain.c worm.c worms.c wump.c |
| 34 | |
| 35 | # C programs that live in the current directory and do not need |
| 36 | # explicit make lines. |
| 37 | # |
| 38 | STD= arithmetic banner bcd factor fish number wump |
| 39 | |
| 40 | # C programs that live in the current directory and need explicit make lines. |
| 41 | # |
| 42 | NSTD= primes rain worm worms |
| 43 | |
| 44 | # programs that get hidden |
| 45 | HIDE= fish wump worm |
| 46 | |
| 47 | # programs that don't |
| 48 | NOHIDE= arithmetic banner bcd factor number primes rain worms |
| 49 | |
| 50 | # Programs that require a lisp interpreter or compiler |
| 51 | LISP= doctor |
| 52 | |
| 53 | all: ${SUBDIR} ${STD} ${NSTD} |
| 54 | |
| 55 | ${SUBDIR}: FRC |
| 56 | cd $@; make ${MFLAGS} |
| 57 | |
| 58 | ${STD}: ${LIBC} |
| 59 | ${CC} ${CFLAGS} -o $@ $@.c |
| 60 | |
| 61 | install: FRC |
| 62 | -for i in ${SUBDIR}; do \ |
| 63 | (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done |
| 64 | -for i in ${SCRIPT}; do \ |
| 65 | (install -c -o games -g bin -m 755 $$i.sh ${DESTDIR}/usr/games/$$i); done |
| 66 | install -s -o games -g bin -m 700 ${HIDE} ${DESTDIR}/usr/games/hide |
| 67 | install -s -o games -g bin -m 755 ${NOHIDE} ${DESTDIR}/usr/games |
| 68 | -for i in ${HIDE}; do \ |
| 69 | (cd ${DESTDIR}/usr/games; rm -f $$i; ln -s dm $$i; chown games.bin $$i) \ |
| 70 | done |
| 71 | |
| 72 | clean: FRC |
| 73 | -for i in ${SUBDIR} games.vax games.tahoe; do \ |
| 74 | (cd $$i; make ${MFLAGS} clean); \ |
| 75 | done |
| 76 | rm -f ${STD} ${NSTD} a.out core *.s *.o |
| 77 | |
| 78 | depend: ldepend |
| 79 | for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done |
| 80 | |
| 81 | ldepend: FRC |
| 82 | mkdep -p ${CFLAGS} ${SRCS} |
| 83 | |
| 84 | FRC: |
| 85 | |
| 86 | # Files listed in ${NSTD} have explicit make lines given below. |
| 87 | |
| 88 | primes: |
| 89 | ${CC} -o $@ ${CFLAGS} primes.c -lm |
| 90 | |
| 91 | rain: |
| 92 | ${CC} -o $@ ${CFLAGS} rain.c -lcurses -ltermcap |
| 93 | |
| 94 | worm: |
| 95 | ${CC} -o $@ ${CFLAGS} worm.c -lcurses -ltermcap |
| 96 | |
| 97 | worms: |
| 98 | ${CC} -o $@ ${CFLAGS} worms.c -lcurses -ltermcap |
| 99 | |
| 100 | # DO NOT DELETE THIS LINE -- mkdep uses it. |
| 101 | # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. |
| 102 | |
| 103 | arithmetic: arithmetic.c /usr/include/stdio.h /usr/include/signal.h |
| 104 | arithmetic: /usr/include/machine/trap.h |
| 105 | banner: banner.c /usr/include/stdio.h |
| 106 | bcd: bcd.c |
| 107 | factor: factor.c |
| 108 | fish: fish.c /usr/include/stdio.h |
| 109 | number: number.c /usr/include/stdio.h /usr/include/ctype.h |
| 110 | primes: primes.c /usr/include/stdio.h /usr/include/math.h |
| 111 | rain: rain.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h |
| 112 | rain: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h |
| 113 | rain: /usr/include/signal.h /usr/include/machine/trap.h |
| 114 | worm: worm.c /usr/include/ctype.h /usr/include/curses.h /usr/include/stdio.h |
| 115 | worm: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h |
| 116 | worm: /usr/include/sys/ttydev.h /usr/include/signal.h |
| 117 | worm: /usr/include/machine/trap.h |
| 118 | worms: worms.c /usr/include/stdio.h /usr/include/sgtty.h |
| 119 | worms: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h |
| 120 | worms: /usr/include/sys/ttydev.h /usr/include/signal.h |
| 121 | worms: /usr/include/machine/trap.h |
| 122 | wump: wump.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h |
| 123 | wump: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h |
| 124 | |
| 125 | # IF YOU PUT ANYTHING HERE IT WILL GO AWAY |