one too many levels of indirection (from ks@purdue)
[unix-history] / usr / src / lib / Makefile
CommitLineData
051b1e55 1#
d0aeaf5a 2# Copyright (c) 1983 Regents of the University of California.
051b1e55
DF
3# All rights reserved. The Berkeley software License Agreement
4# specifies the terms and conditions for redistribution.
5#
1a84272e 6# @(#)Makefile 5.6 (Berkeley) %G%
069fab95
KM
7#
8DESTDIR=
9CFLAGS= -O
74d5a2b2
SL
10TAGSFILE=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#
16TAGSDIR=libcurses libdbm libln libm libmp libpc libtermlib
069fab95
KM
17
18# Programs that live in subdirectories, and have makefiles of their own.
19#
8e792d0c 20SUBDIR= lib2648 libF77 libI77 libU77 libcurses libdbm libg libln \
1a84272e 21 libom libm libmp libpc libplot libtermlib liby lpr me sendmail
069fab95
KM
22
23# Shell scripts that need only be installed and are never removed.
24#
25SCRIPT= makewhatis
26
27# C programs that live in the current directory and do not need
28# explicit make lines.
29#
dcb9aa88 30STD= getNAME makekey
069fab95
KM
31
32# C programs that live in the current directory and need explicit make lines.
33#
34NSTD=
35
36all: ${SUBDIR} ${STD} ${NSTD}
37
38${SUBDIR}: /tmp
39 cd $@; make ${MFLAGS}
40
41${STD}:
42 cc ${CFLAGS} -o $@ $@.c
43
44install:
3ceb07a7 45 -for i in ${SUBDIR}; do \
069fab95 46 (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
3ceb07a7
KM
47 -for i in ${SCRIPT}; do (install -c $$i.sh ${DESTDIR}/usr/lib/$$i); done
48 -for i in ${STD} ${NSTD}; do (install $$i ${DESTDIR}/usr/lib/$$i); done
5d73db6e 49 install -c lib.b ${DESTDIR}/usr/lib/lib.b
069fab95 50
74d5a2b2 51tags:
3ceb07a7 52 -for i in ${TAGSDIR}; do \
74d5a2b2
SL
53 (cd $$i; make ${MFLAGS} TAGSFILE=../${TAGSFILE} tags); \
54 done
55
069fab95 56clean:
74d5a2b2 57 rm -f a.out core *.s *.o tags
3ceb07a7 58 -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
069fab95
KM
59 rm -f ${STD} ${NSTD}
60
61depend:
62 cat </dev/null >x.c
3ceb07a7 63 -for i in ${STD} ${NSTD}; do \
069fab95
KM
64 (echo $$i: $$i.c >>makedep; \
65 /bin/grep '^#[ ]*include' x.c $$i.c | sed \
66 -e '/\.\.\/h/d' \
67 -e 's,<\(.*\)>,"/usr/include/\1",' \
68 -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
69 -e 's/\.c//' >>makedep); done
70 echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
71 echo '$$r makedep' >>eddep
72 echo 'w' >>eddep
73 cp Makefile Makefile.bak
74 ed - Makefile < eddep
75 rm eddep makedep x.c
76 echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
77 echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
78 echo '# see make depend above' >> Makefile
79
80# Files listed in ${NSTD} have explicit make lines given below.
81
82# DO NOT DELETE THIS LINE -- make depend uses it
83
84getNAME: getNAME.c
85getNAME: /usr/include/stdio.h
86makekey: 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