Makefile revision 1.27
1#	$NetBSD: Makefile,v 1.27 1998/03/01 02:15:35 fvdl Exp $
2
3# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
4# links.
5
6SUBDIR+= arch/${MACHINE}
7
8.if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips" && \
9     ${MACHINE_ARCH} != "powerpc")
10SUBDIR+= lkm
11.endif
12
13LFILES=	errno.h fcntl.h md5.h poll.h syslog.h termios.h
14MFILES=	float.h frame.h stdarg.h varargs.h
15LDIRS=	adosfs dev isofs miscfs msdosfs net netatalk netccitt netinet netiso \
16	netnatm netns nfs sys ufs uvm vm
17
18# Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you
19# don't want copies
20.include <bsd.own.mk>
21SYS_INCLUDE?=	copies
22
23# If DESTDIR is set, we're probably building a release, so force "copies".
24.if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR))
25SYS_INCLUDE=	copies
26.endif
27
28.PHONY:	includes
29includes: ${SYS_INCLUDE}
30	@echo installing ${LFILES}
31	@-for i in ${LFILES}; do \
32		rm -f ${DESTDIR}/usr/include/$$i; \
33		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
34	done
35	@echo installing ${MFILES}
36	@-for i in ${MFILES}; do \
37		rm -f ${DESTDIR}/usr/include/$$i; \
38		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
39	done
40
41.PHONY:	copies
42copies:
43	@echo copies: ${LDIRS}
44	@-for i in ${LDIRS}; do \
45		rm -rf ${DESTDIR}/usr/include/$$i; \
46		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
47			${DESTDIR}/usr/include/$$i ; \
48	done
49	pax -rw -pa -L \
50	    `find ${LDIRS} -follow -type f -name '*.h' '!' -path \
51	    'netiso/xebec/*' -print` ${DESTDIR}/usr/include
52	(cd ${DESTDIR}/usr/include; find ${LDIRS} -type f | \
53		xargs chmod a=r)
54	(cd ${DESTDIR}/usr/include; find ${LDIRS} -type d | \
55		xargs chmod u=rwx,go=rx)
56	rm -rf ${DESTDIR}/usr/include/machine
57	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
58		${DESTDIR}/usr/include/machine
59	pax -rw -pa -s "|arch/${MACHINE}/include||" \
60	    arch/${MACHINE}/include/*.h \
61	    ${DESTDIR}/usr/include/machine   
62	(cd ${DESTDIR}/usr/include; find machine -type f | \
63		xargs chmod a=r)
64	(cd ${DESTDIR}/usr/include; find machine -type d | \
65		xargs chmod u=rwx,go=rx)
66	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
67	if test ${MACHINE} != ${MACHINE_ARCH} -a \
68	    -d arch/${MACHINE_ARCH}/include; then \
69		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
70		${DESTDIR}/usr/include/${MACHINE_ARCH}; \
71		pax -rw -pa -s "|arch/${MACHINE_ARCH}/include||" \
72		    arch/${MACHINE_ARCH}/include/*.h \
73		    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
74		(cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type f | \
75			xargs chmod a=r); \
76		(cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type d | \
77			xargs chmod u=rwx,go=rx); \
78	else \
79		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
80	fi
81
82.PHONY:	symlinks
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	done
89	rm -rf ${DESTDIR}/usr/include/machine
90	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/machine
91	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
92	if test ${MACHINE} != ${MACHINE_ARCH} -a \
93	    -d arch/${MACHINE_ARCH}/include ; then \
94		ln -s /sys/arch/${MACHINE_ARCH}/include \
95		    ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
96	else \
97		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
98	fi
99
100.include <bsd.subdir.mk>
101