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