1 # $NetBSD: Makefile,v 1.22.8.3 1998/11/04 20:27:28 cgd Exp $ 2 3 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic 4 # links. 5 6 SUBDIR+= arch/${MACHINE} 7 8 .if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips" && \ 9 ${MACHINE_ARCH} != "powerpc") 10 SUBDIR+= lkm 11 .endif 12 13 LFILES= errno.h fcntl.h md5.h poll.h syslog.h termios.h 14 MFILES= float.h frame.h stdarg.h varargs.h 15 LDIRS= 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> 21 SYS_INCLUDE?= copies 22 23 # If DESTDIR is set, we're probably building a release, so force "copies". 24 .if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR)) 25 SYS_INCLUDE= copies 26 .endif 27 28 .PHONY: includes 29 includes: ${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 42 copies: 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 f | \ 55 xargs chown ${BINOWN}:${BINGRP}) 56 (cd ${DESTDIR}/usr/include; find ${LDIRS} -type d | \ 57 xargs chmod u=rwx,go=rx) 58 (cd ${DESTDIR}/usr/include; find ${LDIRS} -type d | \ 59 xargs chown ${BINOWN}:${BINGRP}) 60 rm -rf ${DESTDIR}/usr/include/machine 61 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 62 ${DESTDIR}/usr/include/machine 63 pax -rw -pa -s "|arch/${MACHINE}/include||" \ 64 arch/${MACHINE}/include/*.h \ 65 ${DESTDIR}/usr/include/machine 66 (cd ${DESTDIR}/usr/include; find machine -type f | \ 67 xargs chmod a=r) 68 (cd ${DESTDIR}/usr/include; find machine -type f | \ 69 xargs chown ${BINOWN}:${BINGRP}) 70 (cd ${DESTDIR}/usr/include; find machine -type d | \ 71 xargs chmod u=rwx,go=rx) 72 (cd ${DESTDIR}/usr/include; find machine -type d | \ 73 xargs chown ${BINOWN}:${BINGRP}) 74 rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH} 75 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 76 -d arch/${MACHINE_ARCH}/include; then \ 77 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 78 ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 79 pax -rw -pa -s "|arch/${MACHINE_ARCH}/include||" \ 80 arch/${MACHINE_ARCH}/include/*.h \ 81 ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 82 (cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type f | \ 83 xargs chmod a=r); \ 84 (cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type f | \ 85 xargs chown ${BINOWN}:${BINGRP}); \ 86 (cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type d | \ 87 xargs chmod u=rwx,go=rx); \ 88 (cd ${DESTDIR}/usr/include; find ${MACHINE_ARCH} -type d | \ 89 xargs chown ${BINOWN}:${BINGRP}); \ 90 else \ 91 ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 92 fi 93 94 .PHONY: symlinks 95 symlinks: 96 @echo symlinks: ${LDIRS} 97 @for i in ${LDIRS}; do \ 98 rm -rf ${DESTDIR}/usr/include/$$i; \ 99 ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \ 100 done 101 rm -rf ${DESTDIR}/usr/include/machine 102 ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/machine 103 rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH} 104 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 105 -d arch/${MACHINE_ARCH}/include ; then \ 106 ln -s /sys/arch/${MACHINE_ARCH}/include \ 107 ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \ 108 else \ 109 ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \ 110 fi 111 112 .include <bsd.subdir.mk> 113