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 8PACKAGE=runtime 9CLEANFILES= osreldate.h version 10SUBDIR= arpa protocols rpcsvc rpc xlocale 11SUBDIR_PARALLEL= 12INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ 13 db.h \ 14 dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \ 15 fts.h ftw.h getopt.h glob.h grp.h \ 16 ieeefp.h ifaddrs.h \ 17 inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ 18 locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ 19 ndbm.h netconfig.h \ 20 netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \ 21 printf.h proc_service.h pthread.h \ 22 pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ 23 res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \ 24 signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ 25 stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ 26 strings.h sysexits.h tar.h termios.h tgmath.h \ 27 time.h timeconv.h timers.h ttyent.h \ 28 uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \ 29 wchar.h wctype.h wordexp.h xlocale.h 30 31.PATH: ${SRCTOP}/contrib/libc-vis 32INCS+= vis.h 33 34MHDRS= float.h floatingpoint.h stdarg.h 35 36PHDRS= sched.h _semaphore.h 37 38LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ 39 syslog.h ucontext.h 40 41LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ 42 netipsec netsmb nfs nfsclient nfsserver sys vm 43 44LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ 45 dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ 46 dev/hwpmc dev/hyperv \ 47 dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ 48 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ 49 dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ 50 fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ 51 fs/procfs fs/smbfs fs/udf fs/unionfs \ 52 geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ 53 geom/mirror geom/mountver geom/multipath geom/nop \ 54 geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ 55 net/altq \ 56 net/route \ 57 netgraph/atm netgraph/netflow \ 58 netinet/cc \ 59 netinet/netdump \ 60 netinet/tcp_stacks \ 61 security/audit \ 62 security/mac_biba security/mac_bsdextended security/mac_lomac \ 63 security/mac_mls security/mac_partition \ 64 security/mac_veriexec \ 65 sys/disk \ 66 ufs/ffs ufs/ufs 67 68LSUBSUBDIRS= dev/mpt/mpilib 69 70.PATH: ${SRCTOP}/sys/dev/acpica 71ACPICA= acpi_hpet.h \ 72 acpiio.h 73ACPICADIR= ${INCLUDEDIR}/dev/acpica 74 75.PATH: ${SRCTOP}/sys/dev/agp 76AGP= agpreg.h 77AGPDIR= ${INCLUDEDIR}/dev/agp 78 79.PATH: ${SRCTOP}/sys/fs/cd9660 80FS9660= cd9660_mount.h \ 81 cd9660_node.h \ 82 cd9660_rrip.h \ 83 iso.h \ 84 iso_rrip.h 85FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 86 87.PATH: ${SRCTOP}/sys/crypto 88CRYPTO= rijndael/rijndael.h 89CRYPTODIR= ${INCLUDEDIR}/crypto 90 91.PATH: ${SRCTOP}/sys/dev/evdev 92EVDEV= input.h \ 93 input-event-codes.h \ 94 uinput.h 95EVDEVDIR= ${INCLUDEDIR}/dev/evdev 96 97.PATH: ${SRCTOP}/sys/dev/hid 98HID= hid.h \ 99 hidraw.h 100HIDDIR= ${INCLUDEDIR}/dev/hid 101 102.PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities 103HYPERV= hv_snapshot.h \ 104 hyperv.h 105HYPERVDIR= ${INCLUDEDIR}/dev/hyperv 106 107.PATH: ${SRCTOP}/sys/opencrypto 108OPENCRYPTO= _cryptodev.h \ 109 cbc_mac.h \ 110 cryptodev.h \ 111 deflate.h \ 112 gfmult.h \ 113 gmac.h \ 114 rmd160.h \ 115 xform.h \ 116 xform_auth.h \ 117 xform_comp.h \ 118 xform_enc.h \ 119 xform_poly1305.h 120OPENCRYPTODIR= ${INCLUDEDIR}/crypto 121 122.PATH: ${SRCTOP}/sys/dev/pci 123PCI= pcireg.h 124PCIDIR= ${INCLUDEDIR}/dev/pci 125 126.PATH: ${SRCTOP}/sys/dev/veriexec 127VERIEXEC= veriexec_ioctl.h 128VERIEXECDIR= ${INCLUDEDIR}/dev/veriexec 129 130.PATH: ${SRCTOP}/sys/contrib/ipfilter/netinet 131IPFILTER= ip_auth.h \ 132 ip_compat.h \ 133 ip_dstlist.h \ 134 ip_fil.h \ 135 ip_frag.h \ 136 ip_htable.h \ 137 ip_lookup.h \ 138 ip_nat.h \ 139 ip_pool.h \ 140 ip_proxy.h \ 141 ip_rules.h \ 142 ip_scan.h \ 143 ip_state.h \ 144 ip_sync.h \ 145 ipf_rb.h \ 146 ipl.h \ 147 radix_ipf.h 148IPFILTERDIR= ${INCLUDEDIR}/netinet 149 150.PATH: ${SRCTOP}/sys/netpfil/pf 151PF= pf.h \ 152 pf_altq.h \ 153 pf_mtag.h 154PFPACKAGE= pf 155PFDIR= ${INCLUDEDIR}/netpfil/pf 156 157.PATH: ${SRCTOP}/sys/rpc 158RPC= rpcsec_tls.h \ 159 types.h 160RPCDIR= ${INCLUDEDIR}/rpc 161 162.PATH: ${SRCTOP}/sys/teken 163TEKEN= teken.h 164TEKENDIR= ${INCLUDEDIR}/teken 165 166.PATH: ${SRCTOP}/sys/contrib/openzfs/include/sys 167NVPAIR= nvpair.h 168NVPAIRDIR= ${INCLUDEDIR}/sys 169 170.PATH: ${SRCTOP}/sys/dev/mlx5 171MLX5= mlx5io.h 172MLX5DIR= ${INCLUDEDIR}/dev/mlx5 173 174INCSGROUPS= INCS \ 175 ACPICA \ 176 AGP \ 177 CRYPTO \ 178 EVDEV \ 179 FS9660 \ 180 HID \ 181 HYPERV \ 182 OPENCRYPTO \ 183 PCI \ 184 RPC \ 185 TEKEN \ 186 VERIEXEC 187 188.if ${MK_IPFILTER} != "no" 189INCSGROUPS+= IPFILTER 190.endif 191 192.if ${MK_PF} != "no" 193INCSGROUPS+= PF 194.endif 195 196.if ${MK_CDDL} != "no" 197INCSGROUPS+= NVPAIR 198.endif 199 200.if ${MK_MLX5TOOL} != "no" 201INCSGROUPS+= MLX5 202.endif 203 204.if ${MK_BLUETOOTH} != "no" 205LSUBSUBDIRS+= netgraph/bluetooth/include 206.endif 207 208.if ${MK_CUSE} != "no" 209LSUBDIRS+= fs/cuse 210.endif 211 212.if ${MK_GSSAPI} != "no" 213SUBDIR+= gssapi 214INCS+= gssapi.h 215.endif 216 217.if ${MK_HESIOD} != "no" 218INCS+= hesiod.h 219.endif 220 221# Handle the #define aliases for libiconv 222.if ${MK_ICONV} == "yes" 223INCS+= iconv.h 224.endif 225 226.if ${MK_USB} != "no" 227LSUBDIRS+= dev/usb 228.endif 229 230.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} != "powerpcspe" 231_dev_powermac_nvram= dev/powermac_nvram 232.endif 233 234# Define SHARED to indicate whether you want symbolic links to the system 235# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 236# probably only useful for developers and should be avoided if you do not 237# wish to tie your /usr/include and /usr/src together. 238#SHARED= symlinks 239SHARED?= copies 240 241INCS+= osreldate.h 242 243SYSDIR= ${SRCTOP}/sys 244NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 245PARAM_H= ${SYSDIR}/sys/param.h 246MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 247 248SYMLINKS+= ${LIBDIR:C,[^/]+,..,g:C,^/,,}${INCLUDEDIR} ${LIBDIR}/include 249 250osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 251 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 252 sh ${MK_OSRELDATE_SH} 253 254.for i in ${LHDRS} 255INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 256.endfor 257.for i in ${MHDRS} 258INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 259.endfor 260.for i in ${PHDRS} 261INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 262.endfor 263 264.if ${MACHINE} != ${MACHINE_CPUARCH} 265_MARCHS= ${MACHINE_CPUARCH} 266.endif 267.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 268_MARCHS+= x86 269.endif 270 271META_TARGETS+= compat 272stage_includes: ${SHARED} 273SDESTDIR= ${SYSROOT:U${DESTDIR}} 274 275# Take care of stale directory-level symlinks. 276# Note: The "|| true" after find is needed in case one of the directories does 277# not exist (yet). 278compat: 279 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ 280 crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true 281 mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ 282 -f ${SRCTOP}/etc/mtree/BSD.include.dist \ 283 -p ${SDESTDIR}${INCLUDEDIR} > /dev/null 284 285copies: .PHONY .META 286 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ 287 machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ 288 -name "*.h" -print -delete || true 289.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} 290 cd ${SRCTOP}/sys; \ 291 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 292 ${SDESTDIR}${INCLUDEDIR}/$i 293.endfor 294 cd ${SRCTOP}/sys/${MACHINE}/include; \ 295 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 296 ${SDESTDIR}${INCLUDEDIR}/machine 297.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 298 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 299 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 300 ${SDESTDIR}${INCLUDEDIR}/machine/pc 301.endif 302.for _MARCH in ${_MARCHS} 303.if exists(${SRCTOP}/sys/${_MARCH}/include) 304 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 305 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 306 cd ${SRCTOP}/sys/${_MARCH}/include; \ 307 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 308 ${SDESTDIR}${INCLUDEDIR}/${_MARCH} 309.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 310 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 311 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 312 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 313 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 314 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc 315.endif 316.endif 317.endfor 318 319symlinks: .PHONY .META 320 @${ECHO} "Setting up symlinks to kernel source tree..." 321.for i in ${LDIRS} 322 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 323 $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 324.endfor 325.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 326 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 327 $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 328.endfor 329 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 330 $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ 331 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 332 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ 333 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 334 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 335 $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ 336 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; 337 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 338 $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ 339 ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ 340 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ 341 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 342 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ 343 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 344 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ 345 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 346 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ 347 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; 348.for i in ${LSUBSUBDIRS} 349 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 350 $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 351.endfor 352.if ${MK_IPFILTER} != "no" 353 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 354 $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ 355 ${SDESTDIR}${INCLUDEDIR}/netinet; 356.endif 357.if ${MK_PF} != "no" 358 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 359 $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ 360 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; 361.endif 362 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ 363 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 364 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 365 $$(printf '../../../%s ' sys/opencrypto/*.h) \ 366 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 367 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 368 $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ 369 ${SDESTDIR}${INCLUDEDIR}/machine; 370.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 371 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 372 $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ 373 ${SDESTDIR}${INCLUDEDIR}/machine/pc; 374.endif 375.for _MARCH in ${_MARCHS} 376.if exists(${SRCTOP}/sys/${_MARCH}/include) 377 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 378 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 379 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 380 $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ 381 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; 382.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 383 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 384 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 385 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 386 $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ 387 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; 388.endif 389.endif 390.endfor 391 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 392 $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ 393 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 394 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 395 $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ 396 ${SDESTDIR}${INCLUDEDIR}/rpc; 397 cd ${SRCTOP}/sys/rpc; 398.if ${MK_CDDL} != "no" 399 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 400 ../../../sys/contrib/openzfs/include/sys/nvpair.h \ 401 ${SDESTDIR}${INCLUDEDIR}/sys 402.endif 403.if ${MK_MLX5TOOL} != "no" 404 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ 405 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 406.endif 407 408.include <bsd.prog.mk> 409 410installincludes: ${SHARED} 411${SHARED}: compat 412 413.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 414# we're here because we are building a sysroot... 415# we need MACHINE et al set correctly 416HOST_MACHINE!= uname -m 417HOST_MACHINE_ARCH!= uname -p 418MACHINE:= ${HOST_MACHINE} 419MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 420.endif 421