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