xref: /original-bsd/include/Makefile (revision 86ed09e7)
1#	@(#)Makefile	5.40 (Berkeley) 09/05/90
2#
3# Doing a make install builds /usr/include
4#
5# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
6# links.
7#
8all clean cleandir depend lint tags:
9
10SUBDIRS=arpa protocols
11STD=	a.out.h ar.h assert.h bitstring.h ctype.h dirent.h disktab.h \
12	fstab.h fts.h glob.h grp.h kvm.h limits.h math.h memory.h mp.h \
13	ndbm.h netdb.h nlist.h paths.h pcc.h pwd.h ranlib.h regexp.h \
14	resolv.h setjmp.h sgtty.h stab.h stdarg.h stddef.h stdio.h \
15	stdlib.h string.h strings.h struct.h sysexits.h time.h ttyent.h \
16	tzfile.h utmp.h varargs.h vfont.h vis.h
17LMCH=	float.h frame.h
18LSYS=	errno.h fcntl.h signal.h syslog.h termios.h unistd.h
19NOOBJ=	noobj
20
21DIRS=	sys net netimp netinet netiso netns ufs nfs
22.if   (${MACHINE} == "hp300")
23DIRS+=	hp300 hpdev
24.elif (${MACHINE} == "tahoe")
25DIRS+=	tahoe tahoemath tahoevba tahoeif
26.elif (${MACHINE} == "vax")
27DIRS+=	vax vaxbi vaxif vaxmba vaxuba
28.endif
29
30# Define SHARED to indicate whether you want symbolic links to the system
31# source (``symlinks''), or a separate copy (``copies''); (latter useful
32# in environments where it's not possible to keep /sys publicly readable)
33# SHARED=	copies
34SHARED=	symlinks
35
36install: ${SHARED}
37	@echo installing ${STD}
38	@-for i in ${STD}; do \
39		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
40		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
41		    ${DESTDIR}/usr/include/$$i; \
42	done
43	@echo installing ${SUBDIRS}
44	@-for i in ${SUBDIRS}; do \
45		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
46		then \
47			mkdir ${DESTDIR}/usr/include/$$i; \
48		fi; \
49		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
50		chmod 755 ${DESTDIR}/usr/include/$$i; \
51		(cd $$i; for j in *.[ih]; do \
52			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
53			install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
54			    ${DESTDIR}/usr/include/$$i/$$j; \
55		done); \
56	done
57	install -c -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.install \
58	    ${DESTDIR}/usr/include/Makefile
59	rm -f ${DESTDIR}/usr/include/machine
60	ln -s ./${MACHINE} ${DESTDIR}/usr/include/machine
61	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine
62	@echo installing ${LSYS}
63	@-for i in ${LSYS}; do \
64		rm -f ${DESTDIR}/usr/include/$$i; \
65		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
66		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
67	done
68	@echo installing ${LMCH}
69	@-for i in ${LMCH}; do \
70		rm -f ${DESTDIR}/usr/include/$$i; \
71		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
72		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
73	done
74
75copies:
76	@echo copies: ${DIRS}
77	@-for i in ${DIRS}; do \
78		rm -rf ${DESTDIR}/usr/include/$$i; \
79		cd /sys; \
80		tar cf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
81	done
82
83symlinks:
84	@echo symlinks: ${DIRS}
85	@-for i in ${DIRS}; do \
86		rm -rf ${DESTDIR}/usr/include/$$i; \
87		if [ ! -s ${DESTDIR}/usr/include/$$i ]; \
88		then \
89			ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
90			chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
91		else \
92			echo ${DESTDIR}/usr/include/$$i not removed; \
93		fi; \
94	done
95
96update:
97	@echo copy updates: ${DIRS}
98	@rm -rf machine
99	@ln -s ${MACHINE} machine
100	@-for i in ${DIRS}; do \
101		if [ ! -d $$i ]; \
102		then \
103			mkdir $$i; \
104		fi; \
105		for j in `cd /sys/$$i; echo *.h`; do \
106			cmp -s /sys/$$i/$$j $$i/$$j || \
107			install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
108			    ${SYS}/$$i/$$j $$i/$$j; \
109		done; \
110	done
111
112.include <bsd.prog.mk>
113