add manual page, cleanup
[unix-history] / usr / src / games / Makefile
index fb62307..3d1c1ac 100644 (file)
-#      @(#)Makefile    4.3     (Berkeley)      %G%
+#
+# Copyright (c) 1980, 1987 Regents of the University of California.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms are permitted
+# provided that the above copyright notice and this paragraph are
+# duplicated in all such forms and that any documentation,
+# advertising materials, and other materials related to such
+# distribution and use acknowledge that the software was developed
+# by the University of California, Berkeley.  The name of the
+# University may not be used to endorse or promote products derived
+# from this software without specific prior written permission.
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+#      @(#)Makefile    5.12 (Berkeley) %G%
 #
 DESTDIR=
 CFLAGS=        -O
 #
 DESTDIR=
 CFLAGS=        -O
-
-# The following sources are incomplete and cannot be compiled without
-# some work
-WORK=  aard ddl mpu
+LIBC=  /lib/libc.a
 
 # Programs that live in subdirectories, and have makefiles of their own.
 #
 
 # Programs that live in subdirectories, and have makefiles of their own.
 #
-SUBDIR=        adventure backgammon boggle compat cribbage doctor fortune \
-       mille monop snake
+# doctor removed until lisp works
+SUBDIR=        adventure atc backgammon battlestar boggle btlgammon canfield \
+       cribbage dm fortune hack hangman hunt mille monop \
+       phantasia quiz robots rogue sail snake trek \
+       games.${MACHINE}
 
 # Shell scripts that need only be installed and are never removed.
 #
 
 # Shell scripts that need only be installed and are never removed.
 #
-#SCRIPT=       
+SCRIPT=        wargames
+
+# C sources that live in the current directory
+#
+SRCS=  arithmetic.c banner.c bcd.c factor.c fish.c morse.c number.c ppt.c \
+       primes.c rain.c worm.c worms.c wump.c
 
 # C programs that live in the current directory and do not need
 # explicit make lines.
 #
 
 # C programs that live in the current directory and do not need
 # explicit make lines.
 #
-STD=   arithmetic btlgammon banner bcd chess fish number quiz wump zork
+STD=   arithmetic banner bcd factor fish morse number ppt wump
 
 # C programs that live in the current directory and need explicit make lines.
 #
 
 # C programs that live in the current directory and need explicit make lines.
 #
-NSTD=  canfield hangman rain worm worms
+NSTD=  primes rain worm worms
+
+# programs that get hidden
+HIDE=  fish wump worm
+
+# programs that don't
+NOHIDE=        arithmetic banner bcd factor morse number ppt primes rain worms
+
+# Programs that require a lisp interpreter or compiler
+LISP=  doctor
 
 all:   ${SUBDIR} ${STD} ${NSTD}
 
 
 all:   ${SUBDIR} ${STD} ${NSTD}
 
-${SUBDIR}: /tmp
+${SUBDIR}: FRC
        cd $@; make ${MFLAGS}
 
        cd $@; make ${MFLAGS}
 
-${STD}:
-       cc ${CFLAGS} -o $@ $@.c
+${STD}: ${LIBC}
+       ${CC} ${CFLAGS} -o $@ $@.c
 
 
-install:
-       for i in ${SUBDIR}; do \
+install: FRC
+       -for i in ${SUBDIR}; do \
                (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
                (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
-#      for i in ${SCRIPT}; do (install -c $$i ${DESTDIR}/usr/games/$$i); done
-       for i in ${STD} ${NSTD}; do (install $$i ${DESTDIR}/usr/games/$$i); done
-       install -c chess.bin ${DESTDIR}/usr/games/lib/chess
-
-clean:
-       rm -f a.out core *.s *.o
-       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
-       rm -f ${STD} ${NSTD}
-
-depend:
-       cat </dev/null >x.c
-       for i in ${STD} ${NSTD}; do \
-               (echo $$i: $$i.c >>makedep; \
-               /bin/grep '^#[  ]*include' x.c $$i.c | sed \
-                       -e 's,<\(.*\)>,"/usr/include/\1",' \
-                       -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
-                       -e 's/\.c//' >>makedep); done
-       echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
-       echo '$$r makedep' >>eddep
-       echo 'w' >>eddep
-       cp Makefile Makefile.bak
-       ed - Makefile < eddep
-       rm eddep makedep x.c
-       echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
-       echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
-       echo '# see make depend above' >> Makefile
+       -for i in ${SCRIPT}; do \
+               (install -c -o games -g bin -m 755 $$i.sh ${DESTDIR}/usr/games/$$i); done
+       install -s -o games -g bin -m 700 ${HIDE} ${DESTDIR}/usr/games/hide
+       install -s -o games -g bin -m 755 ${NOHIDE} ${DESTDIR}/usr/games
+       -for i in ${HIDE}; do \
+               (cd ${DESTDIR}/usr/games; rm -f $$i; ln -s dm $$i; chown games.bin $$i) \
+       done
 
 
-# Files listed in ${NSTD} have explicit make lines given below.
+clean: FRC
+       -for i in ${SUBDIR} games.vax games.tahoe; do \
+               (cd $$i; make ${MFLAGS} clean); \
+       done
+       rm -f ${STD} ${NSTD} a.out core *.s *.o
+
+depend: ldepend
+       for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
 
 
-canfield:
-       cc -o canfield canfield.c -lcurses -ltermcap
+ldepend: FRC
+       mkdep -p ${CFLAGS} ${SRCS}
+
+FRC:
+
+# Files listed in ${NSTD} have explicit make lines given below.
 
 
-hangman:
-       cc -o hangman hangman.c -lcurses -ltermcap -lm
+primes:
+       ${CC} -o $@ ${CFLAGS} primes.c -lm
 
 rain:
 
 rain:
-       cc -o rain rain.c -lcurses -ltermcap
+       ${CC} -o $@ ${CFLAGS} rain.c -lcurses -ltermcap
 
 worm:
 
 worm:
-       cc -o worm worm.c -lcurses -ltermcap
+       ${CC} -o $@ ${CFLAGS} worm.c -lcurses -ltermcap
 
 worms:
 
 worms:
-       cc -o worms worms.c -lcurses -ltermcap
+       ${CC} -o $@ ${CFLAGS} worms.c -lcurses -ltermcap
 
 
-# DO NOT DELETE THIS LINE -- make depend uses it
+# DO NOT DELETE THIS LINE -- mkdep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
 
 
-arithmetic: arithmetic.c
-arithmetic: /usr/include/stdio.h
-arithmetic: /usr/include/signal.h
-btlgammon: btlgammon.c
-btlgammon: /usr/include/stdio.h
-banner: banner.c
-banner: /usr/include/stdio.h
+arithmetic: arithmetic.c /usr/include/stdio.h /usr/include/signal.h
+arithmetic: /usr/include/machine/trap.h
+banner: banner.c /usr/include/stdio.h
 bcd: bcd.c
 bcd: bcd.c
-chess: chess.c
-chess: /usr/include/stdio.h
-fish: fish.c
-fish: /usr/include/stdio.h
-number: number.c
-quiz: quiz.c
-quiz: /usr/include/stdio.h
-quiz: /usr/include/signal.h
-wump: wump.c
-wump: /usr/include/stdio.h
-wump: /usr/include/sgtty.h
-zork: zork.c
-zork: /usr/include/stdio.h
-canfield: canfield.c
-canfield: /usr/include/curses.h
-canfield: /usr/include/ctype.h
-canfield: /usr/include/signal.h
-hangman: hangman.c
-hangman: /usr/include/stdio.h
-hangman: /usr/include/sys/types.h
-hangman: /usr/include/sys/stat.h
-rain: rain.c
-rain: /usr/include/stdio.h
-rain: /usr/include/sgtty.h
-rain: /usr/include/signal.h
-worm: worm.c
-worm: /usr/include/ctype.h
-worm: /usr/include/curses.h
-worm: /usr/include/signal.h
-worms: worms.c
-worms: /usr/include/stdio.h
-worms: /usr/include/sgtty.h
-# DEPENDENCIES MUST END AT END OF FILE
-# IF YOU PUT STUFF HERE IT WILL GO AWAY
-# see make depend above
+factor: factor.c
+fish: fish.c /usr/include/stdio.h
+number: number.c /usr/include/stdio.h /usr/include/ctype.h
+ppt: ppt.c /usr/include/stdio.h
+primes: primes.c /usr/include/stdio.h /usr/include/math.h
+rain: rain.c /usr/include/sys/types.h /usr/include/stdio.h /usr/include/sgtty.h
+rain: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
+rain: /usr/include/sys/ttydefaults.h /usr/include/sys/ttydev.h
+rain: /usr/include/signal.h /usr/include/machine/trap.h
+worm: worm.c /usr/include/ctype.h /usr/include/curses.h /usr/include/stdio.h
+worm: /usr/include/sgtty.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
+worm: /usr/include/sys/ttydefaults.h /usr/include/sys/ttydev.h
+worm: /usr/include/signal.h /usr/include/machine/trap.h
+worms: worms.c /usr/include/sys/types.h /usr/include/stdio.h
+worms: /usr/include/sgtty.h /usr/include/sys/ioctl.h
+worms: /usr/include/sys/ttychars.h /usr/include/sys/ttydefaults.h
+worms: /usr/include/sys/ttydev.h /usr/include/signal.h
+worms: /usr/include/machine/trap.h
+wump: wump.c /usr/include/stdio.h /usr/include/sgtty.h /usr/include/sys/ioctl.h
+wump: /usr/include/sys/ttychars.h /usr/include/sys/ttydefaults.h
+wump: /usr/include/sys/ttydev.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY