xref: /original-bsd/lib/Makefile (revision 8fe8c1c5)
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.7 (Berkeley) 08/26/85
7#
8DESTDIR=
9CFLAGS=	-O
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
17
18# Programs that live in subdirectories, and have makefiles of their own.
19#
20SUBDIR=	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#
25SCRIPT=	makewhatis
26
27# C programs that live in the current directory and do not need
28# explicit make lines.
29#
30STD=	getNAME makekey
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:
45	-for i in ${SUBDIR}; do \
46		(cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install); done
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
49	install -c lib.b ${DESTDIR}/usr/lib/lib.b
50
51tags:
52	-for i in ${TAGSDIR}; do \
53		(cd $$i; make ${MFLAGS} TAGSFILE=../${TAGSFILE} tags); \
54	done
55
56clean:
57	rm -f a.out core *.s *.o tags
58	-for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
59	rm -f ${STD} ${NSTD}
60
61depend:
62	for i in ${STD} ${NSTD}; do \
63	    cc -M ${INCPATH} $$i.c | sed 's/\.o//' | \
64	    awk ' { if ($$1 != prev) \
65		{ if (rec != "") print rec; rec = $$0; prev = $$1; } \
66		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
67		else rec = rec " " $$2 } } \
68		END { print rec } ' >> makedep; done
69	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
70	echo '$$r makedep' >>eddep
71	echo 'w' >>eddep
72	cp Makefile Makefile.bak
73	ed - Makefile < eddep
74	rm eddep makedep
75	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
76	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
77	echo '# see make depend above' >> Makefile
78
79# Files listed in ${NSTD} have explicit make lines given below.
80
81# DO NOT DELETE THIS LINE -- make depend uses it
82
83getNAME: getNAME.c /usr/include/strings.h /usr/include/stdio.h
84makekey: makekey.c
85# DEPENDENCIES MUST END AT END OF FILE
86# IF YOU PUT STUFF HERE IT WILL GO AWAY
87# see make depend above
88