1# @(#)Makefile 8.2 (Berkeley) 1/4/94 2# $FreeBSD$ 3# 4# Doing a "make install" builds /usr/include. 5 6.include <src.opts.mk> 7 8CLEANFILES= osreldate.h version 9SUBDIR= arpa protocols rpcsvc rpc xlocale 10SUBDIR_PARALLEL= 11INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ 12 db.h \ 13 dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \ 14 fts.h ftw.h getopt.h glob.h grp.h \ 15 ieeefp.h ifaddrs.h \ 16 inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ 17 locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ 18 ndbm.h netconfig.h \ 19 netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \ 20 printf.h proc_service.h pthread.h \ 21 pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ 22 res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \ 23 signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ 24 stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ 25 strings.h sysexits.h tar.h termios.h tgmath.h \ 26 time.h timeconv.h timers.h ttyent.h \ 27 uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ 28 wchar.h wctype.h wordexp.h xlocale.h 29 30.PATH: ${.CURDIR}/../contrib/libc-vis 31INCS+= vis.h 32 33MHDRS= float.h floatingpoint.h stdarg.h 34 35PHDRS= sched.h _semaphore.h 36 37LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ 38 syslog.h ucontext.h 39 40LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ 41 netipsec netnatm netsmb nfs nfsclient nfsserver sys vm 42 43LSUBDIRS= cam/ata cam/scsi \ 44 dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ 45 dev/hwpmc \ 46 dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \ 47 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ 48 dev/speaker dev/utopia dev/vkbd dev/wi \ 49 fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ 50 fs/procfs fs/smbfs fs/udf fs/unionfs \ 51 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 52 geom/mirror geom/mountver geom/multipath geom/nop \ 53 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 54 net/altq \ 55 netgraph/atm netgraph/netflow \ 56 netinet/cc \ 57 security/audit \ 58 security/mac_biba security/mac_bsdextended security/mac_lomac \ 59 security/mac_mls security/mac_partition \ 60 ufs/ffs ufs/ufs 61 62LSUBSUBDIRS= dev/mpt/mpilib 63 64.if ${MK_BLUETOOTH} != "no" 65LSUBSUBDIRS+= netgraph/bluetooth/include 66.endif 67 68.if ${MK_CUSE} != "no" 69LSUBDIRS+= fs/cuse 70.endif 71 72.if ${MK_GSSAPI} != "no" 73SUBDIR+= gssapi 74INCS+= gssapi.h 75.endif 76 77.if ${MK_HESIOD} != "no" 78INCS+= hesiod.h 79.endif 80 81# Handle the #define aliases for libiconv 82.if ${MK_ICONV} == "yes" 83INCS+= iconv.h 84.endif 85 86.if ${MK_USB} != "no" 87LSUBDIRS+= dev/usb 88.endif 89 90.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 91_dev_powermac_nvram= dev/powermac_nvram 92.endif 93 94# Define SHARED to indicate whether you want symbolic links to the system 95# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 96# probably only useful for developers and should be avoided if you do not 97# wish to tie your /usr/include and /usr/src together. 98#SHARED= symlinks 99SHARED?= copies 100 101INCS+= osreldate.h 102 103SYSDIR= ${.CURDIR}/../sys 104NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 105PARAM_H= ${SYSDIR}/sys/param.h 106MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 107 108SYMLINKS+= ${INCLUDEDIR} ${LIBDIR}/include 109 110osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 111 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 112 sh ${MK_OSRELDATE_SH} 113 114.for i in ${LHDRS} 115INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 116.endfor 117.for i in ${MHDRS} 118INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 119.endfor 120.for i in ${PHDRS} 121INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 122.endfor 123 124.if ${MACHINE} != ${MACHINE_CPUARCH} 125_MARCHS= ${MACHINE_CPUARCH} 126.endif 127.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 128_MARCHS+= x86 129.endif 130 131META_TARGETS+= compat copies symlinks 132stage_includes: ${SHARED} 133 134.include <bsd.prog.mk> 135 136installincludes: ${SHARED} 137${SHARED}: compat 138 139# Take care of stale directory-level symlinks. 140compat: ${META_DEPS} 141.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 142 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 143 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ 144 fi 145.endfor 146 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 147 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 148 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 149 150copies: ${META_DEPS} 151.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 152 ${_MARCHS} 153 if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 154 cd ${DESTDIR}${INCLUDEDIR}/$i; \ 155 for h in *.h; do \ 156 if [ -L $$h ]; then rm -f $$h; fi; \ 157 done; \ 158 fi 159.endfor 160.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} 161 cd ${.CURDIR}/../sys; \ 162 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 163 ${DESTDIR}${INCLUDEDIR}/$i 164.endfor 165 cd ${.CURDIR}/../sys/dev/acpica; \ 166 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 167 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 168 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ 169 ${DESTDIR}${INCLUDEDIR}/dev/acpica 170 cd ${.CURDIR}/../sys/dev/agp; \ 171 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ 172 ${DESTDIR}${INCLUDEDIR}/dev/agp 173 cd ${.CURDIR}/../sys/dev/bktr; \ 174 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ 175 ${DESTDIR}${INCLUDEDIR}/dev/bktr 176.if ${MK_NAND} != "no" 177 cd ${.CURDIR}/../sys/dev/nand; \ 178 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ 179 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 180 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ 181 ${DESTDIR}${INCLUDEDIR}/dev/nand 182.endif 183 cd ${.CURDIR}/../sys/dev/pci; \ 184 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 185 ${DESTDIR}${INCLUDEDIR}/dev/pci 186 cd ${.CURDIR}/../sys/fs/cd9660/; \ 187 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 188 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660 189.if ${MK_IPFILTER} != "no" 190 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 191 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 192 ${DESTDIR}${INCLUDEDIR}/netinet 193.endif 194.if ${MK_PF} != "no" 195 cd ${.CURDIR}/../sys/netpfil/pf; \ 196 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 197 ${DESTDIR}${INCLUDEDIR}/netpfil/pf 198.endif 199 cd ${.CURDIR}/../sys/crypto; \ 200 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 201 ${DESTDIR}${INCLUDEDIR}/crypto 202 cd ${.CURDIR}/../sys/opencrypto; \ 203 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 204 ${DESTDIR}${INCLUDEDIR}/crypto 205 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 206 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 207 ${DESTDIR}${INCLUDEDIR}/machine 208.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 209 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 210 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 211 ${DESTDIR}${INCLUDEDIR}/machine/pc 212.endif 213.for _MARCH in ${_MARCHS} 214.if exists(${.CURDIR}/../sys/${_MARCH}/include) 215 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 216 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 217 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 218 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 219 ${DESTDIR}${INCLUDEDIR}/${_MARCH} 220.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 221 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 222 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 223 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 224 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 225 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc 226.endif 227.endif 228.endfor 229 cd ${.CURDIR}/../sys/rpc; \ 230 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 231 ${DESTDIR}${INCLUDEDIR}/rpc 232 cd ${.CURDIR}/../sys/teken; \ 233 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 234 ${DESTDIR}${INCLUDEDIR}/teken 235 236symlinks: ${META_DEPS} 237 @${ECHO} "Setting up symlinks to kernel source tree..." 238.for i in ${LDIRS} 239 cd ${.CURDIR}/../sys/$i; \ 240 for h in *.h; do \ 241 ${INSTALL_SYMLINK} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 242 done 243.endfor 244.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} 245 cd ${.CURDIR}/../sys/$i; \ 246 for h in *.h; do \ 247 ${INSTALL_SYMLINK} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 248 done 249.endfor 250 cd ${.CURDIR}/../sys/dev/acpica; \ 251 for h in acpiio.h acpi_hpet.h; do \ 252 ${INSTALL_SYMLINK} ../../../../sys/dev/acpica/$$h \ 253 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 254 done 255 cd ${.CURDIR}/../sys/dev/agp; \ 256 for h in agpreg.h; do \ 257 ${INSTALL_SYMLINK} ../../../../sys/dev/agp/$$h \ 258 ${DESTDIR}${INCLUDEDIR}/dev/agp; \ 259 done 260 cd ${.CURDIR}/../sys/dev/bktr; \ 261 for h in ioctl_*.h; do \ 262 ${INSTALL_SYMLINK} ../../../../sys/dev/bktr/$$h \ 263 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \ 264 done 265.if ${MK_NAND} != "no" 266 cd ${.CURDIR}/../sys/dev/nand; \ 267 for h in nandsim.h nand_dev.h; do \ 268 ${INSTALL_SYMLINK} ../../../../sys/dev/nand/$$h \ 269 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 270 done 271.endif 272 cd ${.CURDIR}/../sys/dev/pci; \ 273 for h in pcireg.h; do \ 274 ${INSTALL_SYMLINK} ../../../../sys/dev/pci/$$h \ 275 ${DESTDIR}${INCLUDEDIR}/dev/pci; \ 276 done 277.for i in ${LSUBSUBDIRS} 278 cd ${.CURDIR}/../sys/$i; \ 279 for h in *.h; do \ 280 ${INSTALL_SYMLINK} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 281 done 282.endfor 283.if ${MK_IPFILTER} != "no" 284 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 285 for h in *.h; do \ 286 ${INSTALL_SYMLINK} ../../../sys/contrib/ipfilter/netinet/$$h \ 287 ${DESTDIR}${INCLUDEDIR}/netinet; \ 288 done 289.endif 290.if ${MK_PF} != "no" 291 cd ${.CURDIR}/../sys/netpfil/pf; \ 292 for h in *.h; do \ 293 ${INSTALL_SYMLINK} ../../../../sys/netpfil/pf/$$h \ 294 ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \ 295 done 296.endif 297 cd ${.CURDIR}/../sys/crypto; \ 298 for h in rijndael/rijndael.h; do \ 299 ${INSTALL_SYMLINK} ../../../sys/crypto/$$h \ 300 ${DESTDIR}${INCLUDEDIR}/crypto; \ 301 done 302 cd ${.CURDIR}/../sys/opencrypto; \ 303 for h in *.h; do \ 304 ${INSTALL_SYMLINK} ../../../sys/opencrypto/$$h \ 305 ${DESTDIR}${INCLUDEDIR}/crypto; \ 306 done 307 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 308 for h in *.h; do \ 309 ${INSTALL_SYMLINK} ../../../sys/${MACHINE}/include/$$h \ 310 ${DESTDIR}${INCLUDEDIR}/machine; \ 311 done 312.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 313 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 314 for h in *.h; do \ 315 ${INSTALL_SYMLINK} ../../../../sys/${MACHINE}/include/pc/$$h \ 316 ${DESTDIR}${INCLUDEDIR}/machine/pc; \ 317 done 318.endif 319.for _MARCH in ${_MARCHS} 320.if exists(${.CURDIR}/../sys/${_MARCH}/include) 321 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 322 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 323 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 324 for h in *.h; do \ 325 ${INSTALL_SYMLINK} ../../../sys/${_MARCH}/include/$$h \ 326 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 327 done 328.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 329 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 330 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 331 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 332 for h in *.h; do \ 333 ${INSTALL_SYMLINK} ../../../../sys/${_MARCH}/include/pc/$$h \ 334 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 335 done 336.endif 337.endif 338.endfor 339 cd ${.CURDIR}/../sys/fs/cd9660; \ 340 for h in *.h; do \ 341 ${INSTALL_SYMLINK} ../../../../sys/fs/cd9660/$$h \ 342 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 343 done 344 cd ${.CURDIR}/../sys/rpc; \ 345 for h in types.h; do \ 346 ${INSTALL_SYMLINK} ../../../sys/rpc/$$h \ 347 ${DESTDIR}${INCLUDEDIR}/rpc; \ 348 done 349 350.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 351# we're here because we are building a sysroot... 352# we need MACHINE et al set correctly 353HOST_MACHINE!= uname -m 354HOST_MACHINE_ARCH!= uname -p 355MACHINE:= ${HOST_MACHINE} 356MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 357.endif 358