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= geom net net80211 netgraph netinet netinet6 \ 42 netipsec netsmb nfs nfsclient nfsserver sys vm 43 44LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ 45 dev/hwpmc dev/hyperv \ 46 dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ 47 dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ 48 dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ 49 fs/devfs fs/fdescfs fs/msdosfs 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 net/route \ 56 netgraph/atm netgraph/netflow \ 57 netinet/cc \ 58 netinet/netdump \ 59 netinet/tcp_stacks \ 60 security/mac_biba security/mac_bsdextended security/mac_lomac \ 61 security/mac_mls security/mac_partition \ 62 security/mac_veriexec \ 63 sys/disk \ 64 ufs/ffs ufs/ufs 65 66LSUBSUBDIRS= dev/mpt/mpilib 67 68.PATH: ${SRCTOP}/sys/dev/acpica 69ACPICA= acpi_hpet.h \ 70 acpiio.h 71ACPICADIR= ${INCLUDEDIR}/dev/acpica 72 73.PATH: ${SRCTOP}/sys/dev/agp 74AGP= agpreg.h 75AGPDIR= ${INCLUDEDIR}/dev/agp 76 77.PATH: ${SRCTOP}/sys/bsm 78BSM= audit.h \ 79 audit_errno.h \ 80 audit_internal.h \ 81 audit_record.h \ 82 audit_domain.h \ 83 audit_fcntl.h \ 84 audit_kevents.h \ 85 audit_socket_type.h 86BSMPACKAGE= libbsm 87BSMDIR= ${INCLUDEDIR}/bsm 88 89.PATH: ${SRCTOP}/sys/security/audit 90SECAUDIT= audit.h \ 91 audit_ioctl.h \ 92 audit_private.h 93SECAUDITPACKAGE= libbsm 94SECAUDITDIR= ${INCLUDEDIR}/security/audit 95 96.PATH: ${SRCTOP}/sys/cam 97CAM= cam.h \ 98 cam_ccb.h \ 99 cam_compat.h \ 100 cam_debug.h \ 101 cam_iosched.h \ 102 cam_periph.h \ 103 cam_queue.h \ 104 cam_sim.h \ 105 cam_xpt.h \ 106 cam_xpt_internal.h \ 107 cam_xpt_periph.h \ 108 cam_xpt_sim.h 109CAMDIR= ${INCLUDEDIR}/cam 110 111.PATH: ${SRCTOP}/sys/cam/ata 112CAMATA= ata_all.h 113CAMATADIR= ${INCLUDEDIR}/cam/ata 114 115.PATH: ${SRCTOP}/sys/cam/mmc 116CAMMMC= mmc.h \ 117 mmc_bus.h \ 118 mmc_all.h 119CAMMMCDIR= ${INCLUDEDIR}/cam/mmc 120 121.PATH: ${SRCTOP}/sys/cam/nvme 122CAMNVME= nvme_all.h 123CAMNVMEDIR= ${INCLUDEDIR}/cam/nvme 124 125.PATH: ${SRCTOP}/sys/cam/scsi 126CAMSCSI= scsi_all.h \ 127 scsi_cd.h \ 128 scsi_ch.h \ 129 scsi_da.h \ 130 scsi_enc.h \ 131 scsi_enc_internal.h \ 132 scsi_iu.h \ 133 scsi_message.h \ 134 scsi_pass.h \ 135 scsi_pt.h \ 136 scsi_sa.h \ 137 scsi_ses.h \ 138 scsi_sg.h \ 139 scsi_targetio.h \ 140 smp_all.h 141CAMSCSIDIR= ${INCLUDEDIR}/cam/scsi 142 143.PATH: ${SRCTOP}/sys/fs/cd9660 144FS9660= cd9660_mount.h \ 145 cd9660_node.h \ 146 cd9660_rrip.h \ 147 iso.h \ 148 iso_rrip.h 149FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 150 151.PATH: ${SRCTOP}/sys/dev/evdev 152EVDEV= input.h \ 153 input-event-codes.h \ 154 uinput.h 155EVDEVDIR= ${INCLUDEDIR}/dev/evdev 156 157.PATH: ${SRCTOP}/sys/dev/hid 158HID= hid.h \ 159 hidraw.h 160HIDDIR= ${INCLUDEDIR}/dev/hid 161 162.PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities 163HYPERV= hv_snapshot.h \ 164 hyperv.h 165HYPERVDIR= ${INCLUDEDIR}/dev/hyperv 166 167.PATH: ${SRCTOP}/sys/opencrypto 168OPENCRYPTO= cryptodev.h 169OPENCRYPTODIR= ${INCLUDEDIR}/crypto 170 171.PATH: ${SRCTOP}/sys/dev/pci 172PCI= pcireg.h 173PCIDIR= ${INCLUDEDIR}/dev/pci 174 175.PATH: ${SRCTOP}/sys/dev/veriexec 176VERIEXEC= veriexec_ioctl.h 177VERIEXECDIR= ${INCLUDEDIR}/dev/veriexec 178 179.PATH: ${SRCTOP}/sys/contrib/ipfilter/netinet 180IPFILTER= ip_auth.h \ 181 ip_compat.h \ 182 ip_dstlist.h \ 183 ip_fil.h \ 184 ip_frag.h \ 185 ip_htable.h \ 186 ip_lookup.h \ 187 ip_nat.h \ 188 ip_pool.h \ 189 ip_proxy.h \ 190 ip_rules.h \ 191 ip_scan.h \ 192 ip_state.h \ 193 ip_sync.h \ 194 ipf_rb.h \ 195 ipl.h \ 196 radix_ipf.h 197IPFILTERDIR= ${INCLUDEDIR}/netinet 198 199.PATH: ${SRCTOP}/sys/netpfil/pf 200PF= pf.h \ 201 pf_altq.h \ 202 pf_mtag.h 203PFPACKAGE= pf 204PFDIR= ${INCLUDEDIR}/netpfil/pf 205 206.PATH: ${SRCTOP}/sys/rpc 207RPC= rpcsec_tls.h \ 208 types.h 209RPCDIR= ${INCLUDEDIR}/rpc 210 211.PATH: ${SRCTOP}/sys/teken 212TEKEN= teken.h 213TEKENDIR= ${INCLUDEDIR}/teken 214 215.PATH: ${SRCTOP}/sys/contrib/openzfs/include/sys 216NVPAIR= nvpair.h 217NVPAIRDIR= ${INCLUDEDIR}/sys 218 219.PATH: ${SRCTOP}/sys/dev/mlx5 220MLX5= mlx5io.h 221MLX5DIR= ${INCLUDEDIR}/dev/mlx5 222 223INCSGROUPS= INCS \ 224 ACPICA \ 225 AGP \ 226 BSM \ 227 CAM \ 228 CAMATA \ 229 CAMMMC \ 230 CAMNVME \ 231 CAMSCSI \ 232 CRYPTO \ 233 EVDEV \ 234 FS9660 \ 235 HID \ 236 HYPERV \ 237 OPENCRYPTO \ 238 PCI \ 239 RPC \ 240 SECAUDIT \ 241 TEKEN \ 242 VERIEXEC 243 244.if ${MK_IPFILTER} != "no" 245INCSGROUPS+= IPFILTER 246.endif 247 248.if ${MK_PF} != "no" 249INCSGROUPS+= PF 250.endif 251 252.if ${MK_CDDL} != "no" 253INCSGROUPS+= NVPAIR 254.endif 255 256.if ${MK_MLX5TOOL} != "no" 257INCSGROUPS+= MLX5 258.endif 259 260.if ${MK_BLUETOOTH} != "no" 261LSUBSUBDIRS+= netgraph/bluetooth/include 262.endif 263 264.if ${MK_CUSE} != "no" 265LSUBDIRS+= fs/cuse 266.endif 267 268.if ${MK_GSSAPI} != "no" 269SUBDIR+= gssapi 270INCS+= gssapi.h 271.endif 272 273.if ${MK_HESIOD} != "no" 274INCS+= hesiod.h 275.endif 276 277# Handle the #define aliases for libiconv 278.if ${MK_ICONV} == "yes" 279INCS+= iconv.h 280.endif 281 282.if ${MK_USB} != "no" 283LSUBDIRS+= dev/usb 284.endif 285 286.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} != "powerpcspe" 287_dev_powermac_nvram= dev/powermac_nvram 288.endif 289 290# Define SHARED to indicate whether you want symbolic links to the system 291# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is 292# probably only useful for developers and should be avoided if you do not 293# wish to tie your /usr/include and /usr/src together. 294#SHARED= symlinks 295SHARED?= copies 296 297INCS+= osreldate.h 298 299SYSDIR= ${SRCTOP}/sys 300NEWVERS_SH= ${SYSDIR}/conf/newvers.sh 301PARAM_H= ${SYSDIR}/sys/param.h 302MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh 303 304SYMLINKS+= ${LIBDIR:C,[^/]+,..,g:C,^/,,}${INCLUDEDIR} ${LIBDIR}/include 305 306osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH} 307 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \ 308 sh ${MK_OSRELDATE_SH} 309 310.for i in ${LHDRS} 311INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 312.endfor 313.for i in ${MHDRS} 314INCSLINKS+= machine/$i ${INCLUDEDIR}/$i 315.endfor 316.for i in ${PHDRS} 317INCSLINKS+= sys/$i ${INCLUDEDIR}/$i 318.endfor 319 320.if ${MACHINE} != ${MACHINE_CPUARCH} 321_MARCHS= ${MACHINE_CPUARCH} 322.endif 323.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 324_MARCHS+= x86 325.endif 326 327META_TARGETS+= compat 328stage_includes: ${SHARED} 329SDESTDIR= ${SYSROOT:U${DESTDIR}} 330 331# Take care of stale directory-level symlinks. 332# Note: The "|| true" after find is needed in case one of the directories does 333# not exist (yet). 334compat: 335 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ 336 crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true 337 mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ 338 -f ${SRCTOP}/etc/mtree/BSD.include.dist \ 339 -p ${SDESTDIR}${INCLUDEDIR} > /dev/null 340 341copies: .PHONY .META 342 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ 343 machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ 344 -name "*.h" -print -delete || true 345.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} 346 cd ${SRCTOP}/sys; \ 347 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ 348 ${SDESTDIR}${INCLUDEDIR}/$i 349.endfor 350 cd ${SRCTOP}/sys/${MACHINE}/include; \ 351 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 352 ${SDESTDIR}${INCLUDEDIR}/machine 353.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 354 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ 355 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 356 ${SDESTDIR}${INCLUDEDIR}/machine/pc 357.endif 358.for _MARCH in ${_MARCHS} 359.if exists(${SRCTOP}/sys/${_MARCH}/include) 360 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 361 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 362 cd ${SRCTOP}/sys/${_MARCH}/include; \ 363 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 364 ${SDESTDIR}${INCLUDEDIR}/${_MARCH} 365.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 366 ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ 367 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 368 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ 369 ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ 370 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc 371.endif 372.endif 373.endfor 374 375symlinks: .PHONY .META 376 @${ECHO} "Setting up symlinks to kernel source tree..." 377.for i in ${LDIRS} 378 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 379 $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 380.endfor 381.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} 382 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 383 $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 384.endfor 385 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 386 $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ 387 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ 388 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ 389 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ 390 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 391 $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ 392 ${SDESTDIR}${INCLUDEDIR}/dev/evdev; 393 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 394 $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ 395 ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ 396 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ 397 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 398 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ 399 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ 400 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ 401 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ 402 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ 403 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; 404.for i in ${LSUBSUBDIRS} 405 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 406 $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i 407.endfor 408.if ${MK_IPFILTER} != "no" 409 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 410 $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ 411 ${SDESTDIR}${INCLUDEDIR}/netinet; 412.endif 413.if ${MK_PF} != "no" 414 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 415 $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ 416 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; 417.endif 418 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \ 419 ${SDESTDIR}${INCLUDEDIR}/crypto; \ 420 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 421 $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ 422 ${SDESTDIR}${INCLUDEDIR}/machine; 423.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) 424 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 425 $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ 426 ${SDESTDIR}${INCLUDEDIR}/machine/pc; 427.endif 428.for _MARCH in ${_MARCHS} 429.if exists(${SRCTOP}/sys/${_MARCH}/include) 430 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 431 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ 432 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 433 $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ 434 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; 435.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) 436 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ 437 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ 438 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 439 $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ 440 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; 441.endif 442.endif 443.endfor 444 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 445 $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ 446 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ 447 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 448 $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ 449 ${SDESTDIR}${INCLUDEDIR}/rpc; 450 cd ${SRCTOP}/sys/rpc; 451.if ${MK_CDDL} != "no" 452 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ 453 ../../../sys/contrib/openzfs/include/sys/nvpair.h \ 454 ${SDESTDIR}${INCLUDEDIR}/sys 455.endif 456.if ${MK_MLX5TOOL} != "no" 457 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ 458 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 459.endif 460 461.include <bsd.prog.mk> 462 463installincludes: ${SHARED} 464${SHARED}: compat 465 466.if ${MACHINE} == "host" && !defined(_SKIP_BUILD) 467# we're here because we are building a sysroot... 468# we need MACHINE et al set correctly 469HOST_MACHINE!= uname -m 470HOST_MACHINE_ARCH!= uname -p 471MACHINE:= ${HOST_MACHINE} 472MACHINE_ARCH:= ${HOST_MACHINE_ARCH} 473.endif 474