xref: /original-bsd/include/Makefile (revision 612877e1)
1#	@(#)Makefile	8.2 (Berkeley) 01/04/94
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
10FILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
11	err.h fnmatch.h fstab.h fts.h glob.h grp.h kvm.h limits.h locale.h \
12	math.h memory.h mp.h mpool.h ndbm.h netdb.h nlist.h paths.h pwd.h \
13	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h \
14	sgtty.h signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
15	struct.h sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
16	utmp.h vis.h
17
18MFILES=	float.h frame.h stdarg.h varargs.h
19LFILES=	errno.h fcntl.h syslog.h termios.h
20
21DIRS=arpa protocols
22LDIRS=	net netccitt netinet netiso netns nfs sys ufs vm
23
24NOOBJ=	noobj
25
26# Define SHARED to indicate whether you want symbolic links to the system
27# source (``symlinks''), or a separate copy (``copies''); (latter useful
28# in environments where it's not possible to keep /sys publicly readable)
29# SHARED=	copies
30SHARED=	symlinks
31
32install: ${SHARED}
33	@echo installing ${FILES}
34	@-for i in ${FILES}; do \
35		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
36		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
37		    ${DESTDIR}/usr/include/$$i; \
38	done
39	@echo installing ${DIRS}
40	@-for i in ${DIRS}; do \
41		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
42		then \
43			mkdir ${DESTDIR}/usr/include/$$i; \
44		fi; \
45		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
46		chmod 755 ${DESTDIR}/usr/include/$$i; \
47		(cd $$i; for j in *.[ih]; do \
48			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
49			    /dev/null 2>&1 || \
50			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
51			    ${DESTDIR}/usr/include/$$i/$$j; \
52		done); \
53	done
54	@echo installing ${LFILES}
55	@-for i in ${LFILES}; do \
56		rm -f ${DESTDIR}/usr/include/$$i; \
57		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
58		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
59	done
60	@echo installing ${MFILES}
61	@-for i in ${MFILES}; do \
62		rm -f ${DESTDIR}/usr/include/$$i; \
63		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
64		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
65	done
66
67copies:
68	@echo copies: ${LDIRS}
69	@-for i in ${LDIRS}; do \
70		rm -rf ${DESTDIR}/usr/include/$$i; \
71		cd /sys; \
72		tar Hcf - $$i/*.h | (cd ${DESTDIR}/usr/include; tar xpfB -); \
73	done
74	rm -f ${DESTDIR}/usr/include/machine
75	mkdir ${DESTDIR}/usr/include/machine
76	cd /sys/${MACHINE}/include && \
77	    tar Hcf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
78	rm -f ${DESTDIR}/usr/include/X11
79	mkdir ${DESTDIR}/usr/include/X11
80	cd /usr/X11/include/X11 && \
81	    tar Hcf - *.h | (cd ${DESTDIR}/usr/include/X11; tar xpfB -);
82
83symlinks:
84	@echo symlinks: ${LDIRS}
85	@for i in ${LDIRS}; do \
86		rm -rf ${DESTDIR}/usr/include/$$i; \
87		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
88		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
89	done
90	rm -f ${DESTDIR}/usr/include/machine
91	ln -s ${DESTDIR}/sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
92	rm -f ${DESTDIR}/usr/include/X11
93	ln -s ${DESTDIR}/usr/X11/include/X11 ${DESTDIR}/usr/include/X11
94
95.include <bsd.prog.mk>
96