xref: /original-bsd/include/Makefile (revision fb9118b1)
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.17 (Berkeley) 87/05/12
7#
8# Doing a make install builds /usr/include
9#
10# Define SHARED to indicate whether you want
11# symbolic links to the system source (``symlinks''),
12# or a separate copy (``copies'').
13# (latter useful in environments where it's
14# not possible to keep /sys publicly readable)
15#
16# The ``rm -rf''s used below are safe because rm doesn't
17# follow symbolic links.
18#
19DESTDIR=
20SUBDIRS=arpa pascal protocols
21STD=	a.out.h ar.h assert.h ctype.h curses.h ndbm.h disktab.h \
22	fcntl.h fstab.h grp.h lastlog.h math.h memory.h mp.h mtab.h \
23	netdb.h nlist.h pcc.h pwd.h ranlib.h resolv.h setjmp.h \
24	sgtty.h stab.h stdio.h string.h strings.h struct.h syscall.h \
25	sysexits.h time.h ttyent.h tzfile.h utmp.h varargs.h vfont.h
26LINKS=	errno.h signal.h syslog.h
27#ifdef vax
28#MACHINE=vax
29#MACHDEP=${MACHINE} vaxif vaxmba vaxuba
30#endif
31MACHINE=tahoe
32MACHDEP=${MACHINE} tahoeif tahoevba tahoemath
33NETDIRS=net netimp netinet netns
34SYSDIRS=${NETDIRS} ${MACHDEP}
35SHARED=	symlinks
36TAGSFILE=tags
37
38all:
39
40install: ${SHARED}
41	-for i in ${STD}; do \
42		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
43		    install -c -m 444 $$i ${DESTDIR}/usr/include/$$i; \
44	done
45	-for i in ${SUBDIRS}; do \
46		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
47		then \
48			mkdir ${DESTDIR}/usr/include/$$i; \
49		fi; \
50		(cd $$i; for j in *.[ih]; do \
51			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
52			install -c -m 444 $$j ${DESTDIR}/usr/include/$$i/$$j; \
53		done); \
54	done
55	-cmp -s Makefile.install ${DESTDIR}/usr/include/Makefile || \
56	    install -c -m 444 Makefile.install ${DESTDIR}/usr/include/Makefile
57	-for i in ${LINKS}; do \
58		rm -f ${DESTDIR}/usr/include/$$i; \
59		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
60	done
61	rm -f ${DESTDIR}/usr/include/machine
62	ln -s ./${MACHINE} ${DESTDIR}/usr/include/machine
63	rm -f ${DESTDIR}/usr/include/frame.h
64	ln -s machine/frame.h ${DESTDIR}/usr/include/frame.h
65
66symlinks:
67	-for i in ${SYSDIRS}; do \
68		rm -rf ${DESTDIR}/usr/include/$$i; \
69		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
70		then \
71			ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
72		else \
73			echo ${DESTDIR}/usr/include/$$i not removed; \
74		fi; \
75	done
76	rm -rf ${DESTDIR}/usr/include/sys
77	-if [ ! -s ${DESTDIR}/usr/include/sys ]; \
78	then \
79		ln -s /sys/h ${DESTDIR}/usr/include/sys; \
80	else \
81		echo ${DESTDIR}/usr/include/sys not removed; \
82	fi
83
84copies:
85	-for i in ${SYSDIRS}; do \
86		rm -rf ${DESTDIR}/usr/include/$$i; \
87		cd /sys; \
88		tar cf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
89	done
90	rm -rf ${DESTDIR}/usr/include/sys;
91	mkdir ${DESTDIR}/usr/include/sys;
92	chmod 775 ${DESTDIR}/usr/include/sys;
93	-(cd /sys/h; tar cf - *.h | (cd ${DESTDIR}/usr/include/sys; tar xpfB -))
94
95tags:
96	cwd=/usr/include; \
97	for i in ${STD} ${LINKS}; do \
98		ctags -a -f ${TAGSFILE} $$cwd/$$i; \
99	done
100
101clean:
102	rm -f tags
103