1 # $NetBSD: Makefile,v 1.20 1997/05/26 03:59:14 cjs Exp $ 2 3 # The ``rm -rf''s used below are safe because rm doesn't follow symbolic 4 # links. 5 6 .include <bsd.own.mk> # for BUILDDIR 7 8 SUBDIR+= arch/${MACHINE} 9 10 .if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "mips" && \ 11 ${MACHINE_ARCH} != "powerpc") 12 SUBDIR+= lkm 13 .endif 14 15 LFILES= errno.h fcntl.h md5.h poll.h syslog.h termios.h 16 MFILES= float.h frame.h stdarg.h varargs.h 17 LDIRS= dev net netatalk netinet netccitt netiso netns netnatm nfs miscfs \ 18 sys ufs vm 19 20 # Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you 21 # don't want copies 22 .include <bsd.own.mk> 23 SYS_INCLUDE?= copies 24 25 .PHONY: includes 26 .if defined(BUILDDIR) 27 includes: build_${SYS_INCLUDE} 28 @echo installing ${LFILES} 29 @-for i in ${LFILES}; do \ 30 rm -f ${BUILDDIR}/usr/include/$$i; \ 31 ln -s sys/$$i ${BUILDDIR}/usr/include/$$i; \ 32 done 33 @echo installing ${MFILES} 34 @-for i in ${MFILES}; do \ 35 rm -f ${BUILDDIR}/usr/include/$$i; \ 36 ln -s machine/$$i ${BUILDDIR}/usr/include/$$i; \ 37 done 38 .else 39 includes: install_${SYS_INCLUDE} 40 .endif 41 42 build_copies: 43 @echo copies: ${LDIRS} 44 @-for i in ${LDIRS}; do \ 45 rm -rf ${BUILDDIR}/usr/include/$$i; \ 46 ${INSTALL} -d -m 755 ${BUILDDIR}/usr/include/$$i ; \ 47 done 48 pax -rw -pa -L \ 49 `find ${LDIRS} -follow -type f -name '*.h' '!' -path \ 50 'netiso/xebec/*' -print` ${BUILDDIR}/usr/include 51 rm -rf ${BUILDDIR}/usr/include/machine 52 ${INSTALL} -d -m 755 ${BUILDDIR}/usr/include/machine 53 pax -rw -pa -s "|arch/${MACHINE}/include||" \ 54 arch/${MACHINE}/include/*.h \ 55 ${BUILDDIR}/usr/include/machine 56 rm -rf ${BUILDDIR}/usr/include/${MACHINE_ARCH} 57 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 58 -d arch/${MACHINE_ARCH}/include; then \ 59 ${INSTALL} -d -m 755 ${BUILDDIR}/usr/include/${MACHINE_ARCH}; \ 60 pax -rw -pa -s "|arch/${MACHINE_ARCH}/include||" \ 61 arch/${MACHINE_ARCH}/include/*.h \ 62 ${BUILDDIR}/usr/include/${MACHINE_ARCH}; \ 63 else \ 64 ln -s machine ${BUILDDIR}/usr/include/${MACHINE_ARCH}; \ 65 fi 66 67 build_symlinks: 68 @echo symlinks: ${LDIRS} 69 @for i in ${LDIRS}; do \ 70 rm -rf ${BUILDDIR}/usr/include/$$i; \ 71 ln -s /sys/$$i ${BUILDDIR}/usr/include/$$i; \ 72 done 73 rm -rf ${BUILDDIR}/usr/include/machine 74 ln -s /sys/arch/${MACHINE}/include ${BUILDDIR}/usr/include/machine 75 rm -rf ${BUILDDIR}/usr/include/${MACHINE_ARCH} 76 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 77 -d arch/${MACHINE_ARCH}/include ; then \ 78 ln -s /sys/arch/${MACHINE_ARCH}/include \ 79 ${BUILDDIR}/usr/include/${MACHINE_ARCH} ; \ 80 else \ 81 ln -s machine ${BUILDDIR}/usr/include/${MACHINE_ARCH} ; \ 82 fi 83 84 install: install_${SYS_INCLUDE} 85 @echo installing ${LFILES} 86 @-for i in ${LFILES}; do \ 87 rm -f ${DESTDIR}/usr/include/$$i; \ 88 ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \ 89 done 90 @echo installing ${MFILES} 91 @-for i in ${MFILES}; do \ 92 rm -f ${DESTDIR}/usr/include/$$i; \ 93 ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \ 94 done 95 96 .PHONY: install_copies 97 install_copies: 98 @echo copies: ${LDIRS} 99 @-for i in ${LDIRS}; do \ 100 rm -rf ${DESTDIR}/usr/include/$$i; \ 101 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 102 ${DESTDIR}/usr/include/$$i ; \ 103 done 104 pax -rw -pa -L \ 105 `find ${LDIRS} -follow -type f -name '*.h' '!' -path \ 106 'netiso/xebec/*' -print` ${DESTDIR}/usr/include 107 rm -rf ${DESTDIR}/usr/include/machine 108 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 109 ${DESTDIR}/usr/include/machine 110 pax -rw -pa -s "|arch/${MACHINE}/include||" \ 111 arch/${MACHINE}/include/*.h \ 112 ${DESTDIR}/usr/include/machine 113 rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH} 114 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 115 -d arch/${MACHINE_ARCH}/include; then \ 116 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 117 ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 118 pax -rw -pa -s "|arch/${MACHINE_ARCH}/include||" \ 119 arch/${MACHINE_ARCH}/include/*.h \ 120 ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 121 else \ 122 ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH}; \ 123 fi 124 125 .PHONY: install_symlinks 126 install_symlinks: 127 @echo symlinks: ${LDIRS} 128 @for i in ${LDIRS}; do \ 129 rm -rf ${DESTDIR}/usr/include/$$i; \ 130 ln -s /sys/$$i ${DESTDIR}/usr/include/$$i; \ 131 done 132 rm -rf ${DESTDIR}/usr/include/machine 133 ln -s /sys/arch/${MACHINE}/include ${DESTDIR}/usr/include/machine 134 rm -rf ${DESTDIR}/usr/include/${MACHINE_ARCH} 135 if test ${MACHINE} != ${MACHINE_ARCH} -a \ 136 -d arch/${MACHINE_ARCH}/include ; then \ 137 ln -s /sys/arch/${MACHINE_ARCH}/include \ 138 ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \ 139 else \ 140 ln -s machine ${DESTDIR}/usr/include/${MACHINE_ARCH} ; \ 141 fi 142 143 .include <bsd.subdir.mk> 144