eliminate 1 character reads
[unix-history] / usr / src / lib / Makefile
CommitLineData
4bba0e35 1# Makefile 4.11 83/11/10
069fab95
KM
2#
3DESTDIR=
4CFLAGS= -O
5
6# Programs that live in subdirectories, and have makefiles of their own.
7#
8e792d0c
SL
8SUBDIR= lib2648 libF77 libI77 libU77 libcurses libdbm libg libln \
9 libm libmp libnm libpc libplot libtermlib lpr sendmail
069fab95
KM
10
11# Shell scripts that need only be installed and are never removed.
12#
13SCRIPT= makewhatis
14
15# C programs that live in the current directory and do not need
16# explicit make lines.
17#
ff8725a6 18STD= atrun getNAME makekey
069fab95
KM
19
20# C programs that live in the current directory and need explicit make lines.
21#
22NSTD=
23
24all: ${SUBDIR} ${STD} ${NSTD}
25
26${SUBDIR}: /tmp
27 cd $@; make ${MFLAGS}
28
29${STD}:
30 cc ${CFLAGS} -o $@ $@.c
31
32install:
33 for i in ${SUBDIR}; do \
34 (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
5d73db6e
SL
35 for i in ${SCRIPT}; do (install -c $$i.sh ${DESTDIR}/usr/lib/$$i); done
36 for i in ${STD} ${NSTD}; do (install $$i ${DESTDIR}/usr/lib/$$i); done
37 install -c lib.b ${DESTDIR}/usr/lib/lib.b
069fab95
KM
38
39clean:
40 rm -f a.out core *.s *.o
41 for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
42 rm -f ${STD} ${NSTD}
43
44depend:
45 cat </dev/null >x.c
46 for i in ${STD} ${NSTD}; do \
47 (echo $$i: $$i.c >>makedep; \
48 /bin/grep '^#[ ]*include' x.c $$i.c | sed \
49 -e '/\.\.\/h/d' \
50 -e 's,<\(.*\)>,"/usr/include/\1",' \
51 -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
52 -e 's/\.c//' >>makedep); done
53 echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
54 echo '$$r makedep' >>eddep
55 echo 'w' >>eddep
56 cp Makefile Makefile.bak
57 ed - Makefile < eddep
58 rm eddep makedep x.c
59 echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
60 echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
61 echo '# see make depend above' >> Makefile
62
63# Files listed in ${NSTD} have explicit make lines given below.
64
65# DO NOT DELETE THIS LINE -- make depend uses it
66
ff8725a6
SL
67atrun: atrun.c
68atrun: /usr/include/stdio.h
69atrun: /usr/include/sys/param.h
70atrun: /usr/include/sys/dir.h
a2cb9a08 71atrun: /usr/include/sys/time.h
ff8725a6 72atrun: /usr/include/sys/stat.h
069fab95
KM
73getNAME: getNAME.c
74getNAME: /usr/include/stdio.h
75makekey: makekey.c
76# DEPENDENCIES MUST END AT END OF FILE
77# IF YOU PUT STUFF HERE IT WILL GO AWAY
78# see make depend above