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. 276compat: 277.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto 278 if [ -L ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ 279 rm -f ${SDESTDIR}${INCLUDEDIR}/$i; \ 280 fi 281.endfor 282 mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ 283 -f ${SRCTOP}/etc/mtree/BSD.include.dist \ 284 -p ${SDESTDIR}${INCLUDEDIR} > /dev/null 285 286copies: .PHONY .META 287.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ 288 ${_MARCHS} 289 if [ -d ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ 290 cd ${SDESTDIR}${INCLUDEDIR}/$i; \ 291 for h in *.h; do \ 292 if [ -L $$h ]; then rm -f $$h; fi; \ 293 done; \ 294 fi 295.endfor 296.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} 297 cd ${SRCTOP}/sys; \ 298 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 299 ${SDESTDIR}${INCLUDEDIR}/$i 300.endfor 301 cd ${SRCTOP}/sys/${MACHINE}/include; \ 302 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 303 ${SDESTDIR}${INCLUDEDIR}/machine 304.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 305 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 306 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 307 ${SDESTDIR}${INCLUDEDIR}/machine/pc 308.endif 309.for _MARCH in ${_MARCHS} 310.if exists(${SRCTOP}/sys/${_MARCH}/include) 311 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 312 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 313 cd ${SRCTOP}/sys/${_MARCH}/include; \ 314 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 315 ${SDESTDIR}${INCLUDEDIR}/${_MARCH} 316.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 317 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 318 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 319 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 320 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 321 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc 322.endif 323.endif 324.endfor 325 326symlinks: .PHONY .META 327 @${ECHO} "Setting up symlinks to kernel source tree..." 328.for i in ${LDIRS} 329 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 330 $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 331.endfor 332.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 333 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 334 $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 335.endfor 336 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 337 $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ 338 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 339 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ 340 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 341 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 342 $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ 343 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; 344 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 345 $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ 346 ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ 347 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ 348 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 349 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ 350 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 351 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ 352 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 353 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ 354 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; 355.for i in ${LSUBSUBDIRS} 356 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 357 $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 358.endfor 359.if ${MK_IPFILTER} != "no" 360 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 361 $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ 362 ${SDESTDIR}${INCLUDEDIR}/netinet; 363.endif 364.if ${MK_PF} != "no" 365 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 366 $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ 367 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; 368.endif 369 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ 370 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 371 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 372 $$(printf '../../../%s ' sys/opencrypto/*.h) \ 373 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 374 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 375 $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ 376 ${SDESTDIR}${INCLUDEDIR}/machine; 377.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 378 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 379 $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ 380 ${SDESTDIR}${INCLUDEDIR}/machine/pc; 381.endif 382.for _MARCH in ${_MARCHS} 383.if exists(${SRCTOP}/sys/${_MARCH}/include) 384 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 385 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 386 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 387 $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ 388 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; 389.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 390 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 391 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 392 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 393 $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ 394 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; 395.endif 396.endif 397.endfor 398 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 399 $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ 400 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 401 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 402 $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ 403 ${SDESTDIR}${INCLUDEDIR}/rpc; 404 cd ${SRCTOP}/sys/rpc; 405.if ${MK_CDDL} != "no" 406 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 407 ../../../sys/contrib/openenzfs/include/sys/nvpair.h \ 408 ${SDESTDIR}${INCLUDEDIR}/sys 409.endif 410.if ${MK_MLX5TOOL} != "no" 411 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ 412 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 413.endif 414 415.include <bsd.prog.mk> 416 417installincludes: ${SHARED} 418${SHARED}: compat 419 420.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 421# we're here because we are building a sysroot... 422# we need MACHINE et al set correctly 423HOST_MACHINE!= uname -m 424HOST_MACHINE_ARCH!= uname -p 425MACHINE:= ${HOST_MACHINE} 426MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 427.endif 428