date and time created 82/12/13 10:43:38 by ralph
[unix-history] / usr / src / games / Makefile
CommitLineData
7097427e 1# @(#)Makefile 4.4 (Berkeley) %G%
c2f9db1e
KM
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 boggle compat cribbage doctor fortune \
7097427e 13 mille monop quiz snake zork
c2f9db1e 14
583192f1
KM
15# Shell scripts that need only be installed and are never removed.
16#
af62d475 17#SCRIPT=
583192f1 18
c2f9db1e
KM
19# C programs that live in the current directory and do not need
20# explicit make lines.
21#
7097427e 22STD= arithmetic btlgammon banner bcd chess fish number wump
c2f9db1e
KM
23
24# C programs that live in the current directory and need explicit make lines.
25#
26NSTD= canfield hangman rain worm worms
27
28all: ${SUBDIR} ${STD} ${NSTD}
29
30${SUBDIR}: /tmp
31 cd $@; make ${MFLAGS}
32
33${STD}:
34 cc ${CFLAGS} -o $@ $@.c
35
36install:
37 for i in ${SUBDIR}; do \
38 (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
af62d475 39# for i in ${SCRIPT}; do (install -c $$i ${DESTDIR}/usr/games/$$i); done
c2f9db1e 40 for i in ${STD} ${NSTD}; do (install $$i ${DESTDIR}/usr/games/$$i); done
af62d475 41 install -c chess.bin ${DESTDIR}/usr/games/lib/chess
c2f9db1e
KM
42
43clean:
44 rm -f a.out core *.s *.o
45 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
46 rm -f ${STD} ${NSTD}
47
48depend:
49 cat </dev/null >x.c
50 for i in ${STD} ${NSTD}; do \
51 (echo $$i: $$i.c >>makedep; \
52 /bin/grep '^#[ ]*include' x.c $$i.c | sed \
53 -e 's,<\(.*\)>,"/usr/include/\1",' \
54 -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
55 -e 's/\.c//' >>makedep); done
56 echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
57 echo '$$r makedep' >>eddep
58 echo 'w' >>eddep
59 cp Makefile Makefile.bak
60 ed - Makefile < eddep
61 rm eddep makedep x.c
62 echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
63 echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
64 echo '# see make depend above' >> Makefile
65
66# Files listed in ${NSTD} have explicit make lines given below.
67
68canfield:
69 cc -o canfield canfield.c -lcurses -ltermcap
70
71hangman:
72 cc -o hangman hangman.c -lcurses -ltermcap -lm
73
74rain:
75 cc -o rain rain.c -lcurses -ltermcap
76
77worm:
78 cc -o worm worm.c -lcurses -ltermcap
79
80worms:
81 cc -o worms worms.c -lcurses -ltermcap
82
83# DO NOT DELETE THIS LINE -- make depend uses it
84
85arithmetic: arithmetic.c
86arithmetic: /usr/include/stdio.h
87arithmetic: /usr/include/signal.h
88btlgammon: btlgammon.c
89btlgammon: /usr/include/stdio.h
90banner: banner.c
91banner: /usr/include/stdio.h
92bcd: bcd.c
93chess: chess.c
94chess: /usr/include/stdio.h
95fish: fish.c
96fish: /usr/include/stdio.h
97number: number.c
c2f9db1e
KM
98wump: wump.c
99wump: /usr/include/stdio.h
100wump: /usr/include/sgtty.h
c2f9db1e
KM
101canfield: canfield.c
102canfield: /usr/include/curses.h
103canfield: /usr/include/ctype.h
104canfield: /usr/include/signal.h
105hangman: hangman.c
106hangman: /usr/include/stdio.h
107hangman: /usr/include/sys/types.h
108hangman: /usr/include/sys/stat.h
109rain: rain.c
110rain: /usr/include/stdio.h
111rain: /usr/include/sgtty.h
112rain: /usr/include/signal.h
113worm: worm.c
114worm: /usr/include/ctype.h
115worm: /usr/include/curses.h
116worm: /usr/include/signal.h
117worms: worms.c
118worms: /usr/include/stdio.h
119worms: /usr/include/sgtty.h
120# DEPENDENCIES MUST END AT END OF FILE
121# IF YOU PUT STUFF HERE IT WILL GO AWAY
122# see make depend above