| 1 | # |
| 2 | # Copyright (c) 1983 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.9 (Berkeley) %G% |
| 7 | # |
| 8 | DESTDIR= |
| 9 | CFLAGS= -O |
| 10 | TAGSFILE=tags |
| 11 | |
| 12 | # Subdirectories whose routines are included in the making of the |
| 13 | # master tags file (/usr/lib/tags); the Fortran libraries should |
| 14 | # be on this list, but we don't control them.... |
| 15 | # |
| 16 | TAGSDIR=libcurses libdbm libln libm libmp libpc libtermlib |
| 17 | |
| 18 | # Programs that live in subdirectories, and have makefiles of their own. |
| 19 | # |
| 20 | SUBDIR= lib2648 libF77 libI77 libU77 libcurses libdbm libg libln \ |
| 21 | libom libm libmp libpc libplot libtermlib liby lpr me sendmail |
| 22 | |
| 23 | # Shell scripts that need only be installed and are never removed. |
| 24 | # |
| 25 | SCRIPT= makewhatis |
| 26 | |
| 27 | # C programs that live in the current directory and do not need |
| 28 | # explicit make lines. |
| 29 | # |
| 30 | STD= getNAME makekey |
| 31 | |
| 32 | # C programs that live in the current directory and need explicit make lines. |
| 33 | # |
| 34 | NSTD= |
| 35 | |
| 36 | all: ${SUBDIR} ${STD} ${NSTD} |
| 37 | |
| 38 | ${SUBDIR}: FRC |
| 39 | cd $@; make ${MFLAGS} |
| 40 | |
| 41 | FRC: |
| 42 | |
| 43 | ${STD}: |
| 44 | cc ${CFLAGS} -o $@ $@.c |
| 45 | |
| 46 | install: |
| 47 | -for i in ${SUBDIR}; do \ |
| 48 | (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done |
| 49 | -for i in ${SCRIPT}; do (install -c $$i.sh ${DESTDIR}/usr/lib/$$i); done |
| 50 | -for i in ${STD} ${NSTD}; do (install -s $$i ${DESTDIR}/usr/lib/$$i); done |
| 51 | install -c lib.b ${DESTDIR}/usr/lib/lib.b |
| 52 | |
| 53 | tags: |
| 54 | -for i in ${TAGSDIR}; do \ |
| 55 | (cd $$i; make ${MFLAGS} TAGSFILE=../${TAGSFILE} tags); \ |
| 56 | done |
| 57 | |
| 58 | clean: |
| 59 | rm -f a.out core *.s *.o tags |
| 60 | -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done |
| 61 | rm -f ${STD} ${NSTD} |
| 62 | |
| 63 | depend: |
| 64 | for i in ${STD} ${NSTD}; do \ |
| 65 | cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \ |
| 66 | awk ' { if ($$1 != prev) \ |
| 67 | { if (rec != "") print rec; rec = $$0; prev = $$1; } \ |
| 68 | else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \ |
| 69 | else rec = rec " " $$2 } } \ |
| 70 | END { print rec } ' >> makedep; done |
| 71 | echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep |
| 72 | echo '$$r makedep' >>eddep |
| 73 | echo 'w' >>eddep |
| 74 | cp Makefile Makefile.bak |
| 75 | ed - Makefile < eddep |
| 76 | rm eddep makedep |
| 77 | echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile |
| 78 | echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile |
| 79 | echo '# see make depend above' >> Makefile |
| 80 | |
| 81 | # Files listed in ${NSTD} have explicit make lines given below. |
| 82 | |
| 83 | # DO NOT DELETE THIS LINE -- make depend uses it |
| 84 | |
| 85 | getNAME: getNAME.c /usr/include/strings.h /usr/include/stdio.h |
| 86 | makekey: makekey.c |
| 87 | # DEPENDENCIES MUST END AT END OF FILE |
| 88 | # IF YOU PUT STUFF HERE IT WILL GO AWAY |
| 89 | # see make depend above |