Makefile revision 1.23
1#	$NetBSD: Makefile,v 1.23 1997/11/15 01:09:15 thorpej 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=	dev isofs net netatalk netinet netccitt netiso netns netnatm nfs miscfs \
16	sys ufs 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	rm -rf ${DESTDIR}/usr/include/machine
53	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
54		${DESTDIR}/usr/include/machine
55	pax -rw -pa -s "|arch/${MACHINE}/include||" \
56	    arch/${MACHINE}/include/*.h \
57	    ${DESTDIR}/usr/include/machine   
58	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
59	if test ${MACHINE} != ${MACHINE_ARCH} -a \
60	    -d arch/${MACHINE_ARCH}/include; then \
61		${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
62		${DESTDIR}/usr/include/${MACHINE_ARCH}; \
63		pax -rw -pa -s "|arch/${MACHINE_ARCH}/include||" \
64		    arch/${MACHINE_ARCH}/include/*.h \
65		    ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
66	else \
67		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH}; \
68	fi
69
70.PHONY:	symlinks
71symlinks:
72	@echo symlinks: ${LDIRS}
73	@for i in ${LDIRS}; do \
74		rm -rf ${DESTDIR}/usr/include/$$i; \
75		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \
76	done
77	rm -rf ${DESTDIR}/usr/include/machine
78	ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/machine
79	rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH}
80	if test ${MACHINE} != ${MACHINE_ARCH} -a \
81	    -d arch/${MACHINE_ARCH}/include ; then \
82		ln -s /sys/arch/${MACHINE_ARCH}/include \
83		    ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
84	else \
85		ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \
86	fi
87
88.include <bsd.subdir.mk>
89