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 printf.h \ 20 proc_service.h pthread.h pthread_np.h pthread_workqueue.h \ 21 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# APSL headers 31INCS+= Availability.h \ 32 AvailabilityInternal.h \ 33 AvailabilityMacros.h \ 34 CrashReporterClient.h \ 35 MacTypes.h \ 36 NSSystemDirectories.h \ 37 TargetConditionals.h \ 38 _simple.h \ 39 _types.h \ 40 aliasdb.h \ 41 ils.h \ 42 libinfo.h \ 43 si_data.h \ 44 si_module.h \ 45 util.h \ 46 utmp.h 47 48SUBDIR+= apple gen libkern mach mach_debug os servers 49 50.PATH: ${.CURDIR}/../contrib/libc-vis 51INCS+= vis.h 52 53MHDRS= float.h floatingpoint.h stdarg.h 54 55PHDRS= sched.h _semaphore.h 56 57LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ 58 syslog.h ucontext.h 59 60LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ 61 netipsec netnatm netsmb nfs nfsclient nfsserver sys vm 62 63LSUBDIRS= cam/ata cam/scsi \ 64 dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ 65 dev/hwpmc \ 66 dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \ 67 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ 68 dev/speaker dev/utopia dev/vkbd dev/wi \ 69 fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ 70 fs/procfs fs/smbfs fs/udf fs/unionfs \ 71 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 72 geom/mirror geom/mountver geom/multipath geom/nop \ 73 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 74 net/altq \ 75 netgraph/atm netgraph/netflow \ 76 security/audit \ 77 security/mac_biba security/mac_bsdextended security/mac_lomac \ 78 security/mac_mls security/mac_partition \ 79 ufs/ffs ufs/ufs \ 80 sys/mach sys/mach_debug 81 82LSUBSUBDIRS= dev/mpt/mpilib sys/mach/ipc sys/mach/device 83 84# these exist due to them not having been present in BSD.include.dist 85# as well as a bug in bsd.incs.mk - can be removed after a grace period 86WRONGLY_ADDED_AS_FILES= gen apple/uuid 87 88.if ${MK_BLUETOOTH} != "no" 89LSUBSUBDIRS+= netgraph/bluetooth/include 90.endif 91 92.if ${MK_CUSE} != "no" 93LSUBDIRS+= fs/cuse 94.endif 95 96.if ${MK_GSSAPI} != "no" 97SUBDIR+= gssapi 98INCS+= gssapi.h 99.endif 100 101.if ${MK_HESIOD} != "no" 102INCS+= hesiod.h 103.endif 104 105# Handle the #define aliases for libiconv 106.if ${MK_ICONV} == "yes" 107INCS+= iconv.h 108.endif 109 110.if ${MK_USB} != "no" 111LSUBDIRS+= dev/usb 112.endif 113 114.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" 115_dev_powermac_nvram= dev/powermac_nvram 116.endif 117 118# Define SHARED to indicate whether you want symbolic links to the system 119# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 120# probably only useful for developers and should be avoided if you do not 121# wish to tie your /usr/include and /usr/src together. 122#SHARED= symlinks 123SHARED?= copies 124 125INCS+= osreldate.h 126 127SYSDIR= ${.CURDIR}/../sys 128NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 129PARAM_H= ${SYSDIR}/sys/param.h 130MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 131 132SYMLINKS+= ${INCLUDEDIR} ${LIBDIR}/include 133 134osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 135 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 136 sh ${MK_OSRELDATE_SH} 137 138.for i in ${LHDRS} 139INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 140.endfor 141.for i in ${MHDRS} 142INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 143.endfor 144.for i in ${PHDRS} 145INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 146.endfor 147 148.if ${MACHINE} != ${MACHINE_CPUARCH} 149_MARCHS= ${MACHINE_CPUARCH} 150.endif 151.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 152_MARCHS+= x86 153.endif 154 155.if ${MK_STAGING} == "yes" 156# tell bsd.incs.mk that we have it covered 157NO_STAGE_INCLUDES= 158.endif 159 160.include <bsd.prog.mk> 161 162.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) 163.if make(all) 164DESTDIR= ${STAGE_OBJTOP} 165 166all: stage_include 167installincludes: buildincludes 168buildincludes: stage_prep 169 170stage_prep: 171 @mkdir -p ${DESTDIR}${INCLUDEDIR} 172 @touch $@ 173 174stage_include: .dirdep installincludes 175 @touch $@ 176.endif 177.endif 178 179installincludes: ${SHARED} 180${SHARED}: compat 181 182# Take care of stale directory-level symlinks. 183compat: 184.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 185 if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 186 rm -f ${DESTDIR}${INCLUDEDIR}/$i; \ 187 fi 188.endfor 189 mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \ 190 -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ 191 -p ${DESTDIR}${INCLUDEDIR} > /dev/null 192.if ${MK_DIRDEPS_BUILD} == "yes" 193 @touch ${.TARGET} 194.endif 195 196copies: 197.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 198 ${_MARCHS} 199 if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \ 200 cd ${DESTDIR}${INCLUDEDIR}/$i; \ 201 for h in *.h; do \ 202 if [ -L $$h ]; then rm -f $$h; fi; \ 203 done; \ 204 fi 205.endfor 206.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS} 207 cd ${.CURDIR}/../sys; \ 208 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 209 ${DESTDIR}${INCLUDEDIR}/$i 210.endfor 211 cd ${.CURDIR}/../sys/dev/acpica; \ 212 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ 213 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 214 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ 215 ${DESTDIR}${INCLUDEDIR}/dev/acpica 216 cd ${.CURDIR}/../sys/dev/agp; \ 217 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ 218 ${DESTDIR}${INCLUDEDIR}/dev/agp 219 cd ${.CURDIR}/../sys/dev/bktr; \ 220 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \ 221 ${DESTDIR}${INCLUDEDIR}/dev/bktr 222.if ${MK_NAND} != "no" 223 cd ${.CURDIR}/../sys/dev/nand; \ 224 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \ 225 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 226 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \ 227 ${DESTDIR}${INCLUDEDIR}/dev/nand 228.endif 229 cd ${.CURDIR}/../sys/dev/pci; \ 230 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ 231 ${DESTDIR}${INCLUDEDIR}/dev/pci 232 cd ${.CURDIR}/../sys/fs/cd9660/; \ 233 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 234 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660 235.if ${MK_IPFILTER} != "no" 236 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 237 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 238 ${DESTDIR}${INCLUDEDIR}/netinet 239.endif 240.if ${MK_PF} != "no" 241 cd ${.CURDIR}/../sys/netpfil/pf; \ 242 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 243 ${DESTDIR}${INCLUDEDIR}/netpfil/pf 244.endif 245 cd ${.CURDIR}/../sys/crypto; \ 246 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ 247 ${DESTDIR}${INCLUDEDIR}/crypto 248 cd ${.CURDIR}/../sys/opencrypto; \ 249 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 250 ${DESTDIR}${INCLUDEDIR}/crypto 251 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 252 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 253 ${DESTDIR}${INCLUDEDIR}/machine 254.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 255 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 256 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 257 ${DESTDIR}${INCLUDEDIR}/machine/pc 258.endif 259.for _MARCH in ${_MARCHS} 260.if exists(${.CURDIR}/../sys/${_MARCH}/include) 261 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 262 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 263 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 264 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 265 ${DESTDIR}${INCLUDEDIR}/${_MARCH} 266.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 267 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 268 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 269 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 270 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 271 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc 272.endif 273.endif 274.endfor 275 cd ${.CURDIR}/../sys/rpc; \ 276 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ 277 ${DESTDIR}${INCLUDEDIR}/rpc 278 cd ${.CURDIR}/../sys/teken; \ 279 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ 280 ${DESTDIR}${INCLUDEDIR}/teken 281.if exists(${.CURDIR}/../sys/sys/mach) 282 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 283 ${DESTDIR}${INCLUDEDIR}/sys/mach 284 cd ${.CURDIR}/../sys/sys/mach ; \ 285 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \ 286 ${DESTDIR}${INCLUDEDIR}/sys/mach 287.endif 288.if exists(${.CURDIR}/../sys/sys/mach/ipc) 289 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 290 ${DESTDIR}${INCLUDEDIR}/sys/mach/ipc 291 cd ${.CURDIR}/../sys/sys/mach/ipc ; \ 292 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 293 ${DESTDIR}${INCLUDEDIR}/sys/mach/ipc 294.endif 295.if exists(${.CURDIR}/../sys/sys/mach_debug) 296 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 297 ${DESTDIR}${INCLUDEDIR}/sys/mach_debug 298 cd ${.CURDIR}/../sys/sys/mach_debug ; \ 299 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \ 300 ${DESTDIR}${INCLUDEDIR}/sys/mach_debug 301.endif 302.if exists(${.CURDIR}/../sys/sys/mach/device) 303 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 304 ${DESTDIR}${INCLUDEDIR}/sys/mach/device 305 cd ${.CURDIR}/../sys/sys/mach/device ; \ 306 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h *.defs \ 307 ${DESTDIR}${INCLUDEDIR}/sys/mach/device 308.endif 309.if ${MK_DIRDEPS_BUILD} == "yes" 310 @touch ${.OBJDIR}/${.TARGET} 311.endif 312.for _F in ${WRONGLY_ADDED_AS_FILES} 313 if [ -f ${DESTDIR}${INCLUDEDIR}/${_F} ]; then \ 314 rm -f ${DESTDIR}${INCLUDEDIR}/${_F}; \ 315 mkdir ${DESTDIR}${INCLUDEDIR}/${_F}; \ 316 fi 317.endfor 318 319 320 321symlinks: 322 @${ECHO} "Setting up symlinks to kernel source tree..." 323 mkdir -p ${DESTDIR}${INCLUDEDIR}/apple/System 324 ln -fs ../sys ${DESTDIR}${INCLUDEDIR}/apple/System/sys 325.for i in ${LDIRS} 326 cd ${.CURDIR}/../sys/$i; \ 327 for h in *.h; do \ 328 ${INSTALL_SYMLINK} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 329 done 330.endfor 331.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} 332 cd ${.CURDIR}/../sys/$i; \ 333 for h in *.h; do \ 334 ${INSTALL_SYMLINK} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 335 done 336.endfor 337 cd ${.CURDIR}/../sys/dev/acpica; \ 338 for h in acpiio.h acpi_hpet.h; do \ 339 ${INSTALL_SYMLINK} ../../../../sys/dev/acpica/$$h \ 340 ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ 341 done 342 cd ${.CURDIR}/../sys/dev/agp; \ 343 for h in agpreg.h; do \ 344 ${INSTALL_SYMLINK} ../../../../sys/dev/agp/$$h \ 345 ${DESTDIR}${INCLUDEDIR}/dev/agp; \ 346 done 347 cd ${.CURDIR}/../sys/dev/bktr; \ 348 for h in ioctl_*.h; do \ 349 ${INSTALL_SYMLINK} ../../../../sys/dev/bktr/$$h \ 350 ${DESTDIR}${INCLUDEDIR}/dev/bktr; \ 351 done 352.if ${MK_NAND} != "no" 353 cd ${.CURDIR}/../sys/dev/nand; \ 354 for h in nandsim.h nand_dev.h; do \ 355 ${INSTALL_SYMLINK} ../../../../sys/dev/nand/$$h \ 356 ${DESTDIR}${INCLUDEDIR}/dev/nand; \ 357 done 358.endif 359 cd ${.CURDIR}/../sys/dev/pci; \ 360 for h in pcireg.h; do \ 361 ${INSTALL_SYMLINK} ../../../../sys/dev/pci/$$h \ 362 ${DESTDIR}${INCLUDEDIR}/dev/pci; \ 363 done 364.for i in ${LSUBSUBDIRS} 365 cd ${.CURDIR}/../sys/$i; \ 366 for h in *.h; do \ 367 ${INSTALL_SYMLINK} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \ 368 done 369.endfor 370.if ${MK_IPFILTER} != "no" 371 cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \ 372 for h in *.h; do \ 373 ${INSTALL_SYMLINK} ../../../sys/contrib/ipfilter/netinet/$$h \ 374 ${DESTDIR}${INCLUDEDIR}/netinet; \ 375 done 376.endif 377.if ${MK_PF} != "no" 378 cd ${.CURDIR}/../sys/netpfil/pf; \ 379 for h in *.h; do \ 380 ${INSTALL_SYMLINK} ../../../../sys/netpfil/pf/$$h \ 381 ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \ 382 done 383.endif 384 cd ${.CURDIR}/../sys/crypto; \ 385 for h in rijndael/rijndael.h; do \ 386 ${INSTALL_SYMLINK} ../../../sys/crypto/$$h \ 387 ${DESTDIR}${INCLUDEDIR}/crypto; \ 388 done 389 cd ${.CURDIR}/../sys/opencrypto; \ 390 for h in *.h; do \ 391 ${INSTALL_SYMLINK} ../../../sys/opencrypto/$$h \ 392 ${DESTDIR}${INCLUDEDIR}/crypto; \ 393 done 394 cd ${.CURDIR}/../sys/${MACHINE}/include; \ 395 for h in *.h; do \ 396 ${INSTALL_SYMLINK} ../../../sys/${MACHINE}/include/$$h \ 397 ${DESTDIR}${INCLUDEDIR}/machine; \ 398 done 399.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc) 400 cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \ 401 for h in *.h; do \ 402 ${INSTALL_SYMLINK} ../../../../sys/${MACHINE}/include/pc/$$h \ 403 ${DESTDIR}${INCLUDEDIR}/machine/pc; \ 404 done 405.endif 406.for _MARCH in ${_MARCHS} 407.if exists(${.CURDIR}/../sys/${_MARCH}/include) 408 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 409 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 410 cd ${.CURDIR}/../sys/${_MARCH}/include; \ 411 for h in *.h; do \ 412 ${INSTALL_SYMLINK} ../../../sys/${_MARCH}/include/$$h \ 413 ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ 414 done 415.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc) 416 ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ 417 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 418 cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \ 419 for h in *.h; do \ 420 ${INSTALL_SYMLINK} ../../../../sys/${_MARCH}/include/pc/$$h \ 421 ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 422 done 423.endif 424.endif 425.endfor 426 cd ${.CURDIR}/../sys/fs/cd9660; \ 427 for h in *.h; do \ 428 ${INSTALL_SYMLINK} ../../../../sys/fs/cd9660/$$h \ 429 ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 430 done 431 cd ${.CURDIR}/../sys/rpc; \ 432 for h in types.h; do \ 433 ${INSTALL_SYMLINK} ../../../sys/rpc/$$h \ 434 ${DESTDIR}${INCLUDEDIR}/rpc; \ 435 done 436.if ${MK_DIRDEPS_BUILD} == "yes" 437 @touch ${.OBJDIR}/${.TARGET} 438.endif 439 440.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 441# we're here because we are building a sysroot... 442# we need MACHINE et al set correctly 443HOST_MACHINE!= uname -m 444HOST_MACHINE_ARCH!= uname -p 445MACHINE:= ${HOST_MACHINE} 446MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 447.endif 448