MACHINE defined by make, now
[unix-history] / usr / src / games / Makefile
CommitLineData
37eb54a9
RE
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#
a2665b45 6# @(#)Makefile 5.6 (Berkeley) 11/17/86
c2f9db1e
KM
7#
8DESTDIR=
9CFLAGS= -O
10
c2f9db1e
KM
11# Programs that live in subdirectories, and have makefiles of their own.
12#
23ba14cd
KM
13SUBDIR= adventure backgammon battlestar boggle cribbage fortune \
14 hangman hunt mille monop quiz robots sail snake trek
c2f9db1e 15
583192f1
KM
16# Shell scripts that need only be installed and are never removed.
17#
5bad83a0 18SCRIPT= wargames
583192f1 19
c2f9db1e
KM
20# C programs that live in the current directory and do not need
21# explicit make lines.
22#
23ba14cd 23STD= arithmetic btlgammon banner bcd cfscores factor fish number wump
c2f9db1e
KM
24
25# C programs that live in the current directory and need explicit make lines.
26#
6c05e2fa 27NSTD= canfield primes rain worm worms
c2f9db1e 28
23ba14cd
KM
29# Programs that require a lisp interpreter or compiler
30LISP= doctor
31
c2f9db1e 32all: ${SUBDIR} ${STD} ${NSTD}
a2665b45 33 cd games.${MACHINE}; make ${MFLAGS}
c2f9db1e 34
f0f83cf4 35${SUBDIR}: FRC
c2f9db1e
KM
36 cd $@; make ${MFLAGS}
37
f0f83cf4
KM
38FRC:
39
c2f9db1e
KM
40${STD}:
41 cc ${CFLAGS} -o $@ $@.c
42
43install:
37eb54a9 44 -for i in ${SUBDIR}; do \
c2f9db1e 45 (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
5bad83a0
KM
46 -for i in ${SCRIPT}; do \
47 (install -c $$i.sh ${DESTDIR}/usr/games/$$i); done
37eb54a9
RE
48 -for i in ${STD} ${NSTD}; do \
49 (install -s $$i ${DESTDIR}/usr/games/$$i); done
23ba14cd
KM
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
a2665b45 53 cd games.${MACHINE}; make ${MFLAGS} DESTDIR=${DESTDIR} install
c2f9db1e
KM
54
55clean:
56 rm -f a.out core *.s *.o
37eb54a9 57 -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
c2f9db1e 58 rm -f ${STD} ${NSTD}
a2665b45 59 cd games.${MACHINE}; make ${MFLAGS} DESTDIR=${DESTDIR} clean
c2f9db1e
KM
60
61depend:
c2f9db1e 62 for i in ${STD} ${NSTD}; do \
2154d805
KM
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
c2f9db1e
KM
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
2154d805 74 rm eddep makedep
c2f9db1e
KM
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
81canfield:
6c05e2fa 82 cc -o canfield ${CFLAGS} canfield.c -lcurses -ltermcap
c2f9db1e 83
6c05e2fa
SL
84primes:
85 cc -o primes ${CFLAGS} primes.c -lm
7a2e4160 86
c2f9db1e 87rain:
6c05e2fa 88 cc -o rain ${CFLAGS} rain.c -lcurses -ltermcap
c2f9db1e
KM
89
90worm:
6c05e2fa 91 cc -o worm ${CFLAGS} worm.c -lcurses -ltermcap
c2f9db1e
KM
92
93worms:
6c05e2fa 94 cc -o worms ${CFLAGS} worms.c -lcurses -ltermcap
c2f9db1e
KM
95
96# DO NOT DELETE THIS LINE -- make depend uses it
97
2154d805
KM
98arithmetic: arithmetic.c /usr/include/stdio.h /usr/include/signal.h
99btlgammon: btlgammon.c /usr/include/stdio.h
100banner: banner.c /usr/include/stdio.h
7a2e4160 101bcd: bcd.c
2154d805 102cfscores: cfscores.c /usr/include/pwd.h
2154d805
KM
103factor: factor.c
104fish: fish.c /usr/include/stdio.h
c2f9db1e 105number: number.c
2154d805
KM
106wump: wump.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h
107wump: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
108canfield: canfield.c /usr/include/curses.h /usr/include/stdio.h
109canfield: /usr/include/sgtty.h /usr/include/sys/ioctl.h
110canfield: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
111canfield: /usr/include/ctype.h /usr/include/signal.h /usr/include/sys/types.h
112primes: primes.c /usr/include/stdio.h /usr/include/math.h
113rain: rain.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h
114rain: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
c2f9db1e 115rain: /usr/include/signal.h
2154d805
KM
116worm: worm.c /usr/include/ctype.h /usr/include/curses.h /usr/include/stdio.h
117worm: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
118worm: /usr/include/sys/ttydev.h /usr/include/signal.h
119worms: worms.c /usr/include/stdio.h /usr/include/sgtty.h
120worms: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
121worms: /usr/include/sys/ttydev.h /usr/include/signal.h
c2f9db1e
KM
122# DEPENDENCIES MUST END AT END OF FILE
123# IF YOU PUT STUFF HERE IT WILL GO AWAY
124# see make depend above