1 # @(#)Makefile 8.2 (Berkeley) 1/4/94
3 # Doing a "make install" builds /usr/include.
8 CLEANFILES= osreldate.h version
9 SUBDIR= arpa protocols rpcsvc rpc xlocale
11 INCS= a.out.h ar.h assert.h bitstring.h byteswap.h \
12 complex.h cpio.h _ctype.h ctype.h \
14 dirent.h dlfcn.h elf.h elf-hints.h endian.h err.h fmtmsg.h fnmatch.h \
15 fstab.h fts.h ftw.h getopt.h glob.h grp.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 \
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
32 .PATH: ${SRCTOP}/contrib/libc-vis
35 MHDRS= float.h floatingpoint.h stdarg.h
39 LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
42 LDIRS= geom net net80211 netgraph netinet netinet6 \
43 netipsec netlink netsmb nfs nfsclient nfsserver sys vm
45 LSUBDIRS= 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 dev/wg \
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 \
57 netgraph/atm netgraph/netflow \
62 security/mac_biba security/mac_bsdextended security/mac_lomac \
63 security/mac_mls security/mac_partition \
64 security/mac_veriexec \
68 LSUBSUBDIRS= dev/mpt/mpilib
70 .PATH: ${SRCTOP}/sys/dev/acpica
73 ACPICADIR= ${INCLUDEDIR}/dev/acpica
75 .PATH: ${SRCTOP}/sys/dev/agp
77 AGPDIR= ${INCLUDEDIR}/dev/agp
79 .PATH: ${SRCTOP}/sys/bsm
89 BSMDIR= ${INCLUDEDIR}/bsm
91 .PATH: ${SRCTOP}/sys/security/audit
95 SECAUDITPACKAGE= libbsm
96 SECAUDITDIR= ${INCLUDEDIR}/security/audit
98 .PATH: ${SRCTOP}/sys/cam
111 CAMDIR= ${INCLUDEDIR}/cam
113 .PATH: ${SRCTOP}/sys/cam/ata
115 CAMATADIR= ${INCLUDEDIR}/cam/ata
117 .PATH: ${SRCTOP}/sys/cam/mmc
121 CAMMMCDIR= ${INCLUDEDIR}/cam/mmc
123 .PATH: ${SRCTOP}/sys/cam/nvme
125 CAMNVMEDIR= ${INCLUDEDIR}/cam/nvme
127 .PATH: ${SRCTOP}/sys/cam/scsi
128 CAMSCSI= scsi_all.h \
133 scsi_enc_internal.h \
143 CAMSCSIDIR= ${INCLUDEDIR}/cam/scsi
145 .PATH: ${SRCTOP}/sys/fs/cd9660
146 FS9660= cd9660_mount.h \
151 FS9660DIR= ${INCLUDEDIR}/isofs/cd9660
153 .PATH: ${SRCTOP}/sys/dev/evdev
155 input-event-codes.h \
157 EVDEVDIR= ${INCLUDEDIR}/dev/evdev
159 .PATH: ${SRCTOP}/sys/dev/hid
162 HIDDIR= ${INCLUDEDIR}/dev/hid
164 .PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities
165 HYPERV= hv_snapshot.h \
167 HYPERVDIR= ${INCLUDEDIR}/dev/hyperv
169 .PATH: ${SRCTOP}/sys/opencrypto
170 OPENCRYPTO= cryptodev.h
171 OPENCRYPTODIR= ${INCLUDEDIR}/crypto
173 .PATH: ${SRCTOP}/sys/dev/pci
175 PCIDIR= ${INCLUDEDIR}/dev/pci
177 .PATH: ${SRCTOP}/sys/dev/veriexec
178 VERIEXEC= veriexec_ioctl.h
179 VERIEXECDIR= ${INCLUDEDIR}/dev/veriexec
181 .PATH: ${SRCTOP}/sys/netpfil/ipfilter/netinet
182 IPFILTER= ip_auth.h \
199 IPFILTERDIR= ${INCLUDEDIR}/netinet
201 .PATH: ${SRCTOP}/sys/netpfil/pf
206 PFDIR= ${INCLUDEDIR}/netpfil/pf
208 .PATH: ${SRCTOP}/sys/rpc
211 RPCDIR= ${INCLUDEDIR}/rpc
213 .PATH: ${SRCTOP}/sys/teken
215 TEKENDIR= ${INCLUDEDIR}/teken
217 .PATH: ${SRCTOP}/sys/contrib/openzfs/include/sys
219 NVPAIRDIR= ${INCLUDEDIR}/sys
221 .PATH: ${SRCTOP}/sys/dev/mlx5
223 MLX5DIR= ${INCLUDEDIR}/dev/mlx5
225 .PATH: ${SRCTOP}/sys/dev/wg
227 WGDIR= ${INCLUDEDIR}/dev/wg
251 .if ${MK_IPFILTER} != "no"
252 INCSGROUPS+= IPFILTER
259 .if ${MK_CDDL} != "no"
263 .if ${MK_MLX5TOOL} != "no"
267 .if ${MK_BLUETOOTH} != "no"
268 LSUBSUBDIRS+= netgraph/bluetooth/include
271 .if ${MK_CUSE} != "no"
275 .if ${MK_GSSAPI} != "no"
280 .if ${MK_HESIOD} != "no"
284 # Handle the #define aliases for libiconv
285 .if ${MK_ICONV} == "yes"
289 .if ${MK_USB} != "no"
293 .if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} != "powerpcspe"
294 _dev_powermac_nvram= dev/powermac_nvram
297 # Define SHARED to indicate whether you want symbolic links to the system
298 # source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is
299 # probably only useful for developers and should be avoided if you do not
300 # wish to tie your /usr/include and /usr/src together.
306 SYSDIR= ${SRCTOP}/sys
307 NEWVERS_SH= ${SYSDIR}/conf/newvers.sh
308 PARAM_H= ${SYSDIR}/sys/param.h
309 MK_OSRELDATE_SH= ${.CURDIR}/mk-osreldate.sh
311 SYMLINKS+= ${LIBDIR:C,[^/]+,..,g:C,^/,,}${INCLUDEDIR} ${LIBDIR}/include
313 osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
314 env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
315 sh ${MK_OSRELDATE_SH}
318 INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
321 INCSLINKS+= machine/$i ${INCLUDEDIR}/$i
324 INCSLINKS+= sys/$i ${INCLUDEDIR}/$i
327 .if ${MACHINE} != ${MACHINE_CPUARCH}
328 _MARCHS= ${MACHINE_CPUARCH}
330 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
334 META_TARGETS+= compat
335 stage_includes: ${SHARED}
336 SDESTDIR= ${SYSROOT:U${DESTDIR}}
338 # Take care of stale directory-level symlinks.
339 # Note: The "|| true" after find is needed in case one of the directories does
342 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \
343 crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true
344 mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \
345 -f ${SRCTOP}/etc/mtree/BSD.include.dist \
346 -p ${SDESTDIR}${INCLUDEDIR} > /dev/null
349 cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \
350 machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \
351 -name "*.h" -print -delete || true
352 .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS}
354 ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
355 ${SDESTDIR}${INCLUDEDIR}/$i
357 cd ${SRCTOP}/sys/${MACHINE}/include; \
358 ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
359 ${SDESTDIR}${INCLUDEDIR}/machine
360 .if exists(${SRCTOP}/sys/${MACHINE}/include/pc)
361 cd ${SRCTOP}/sys/${MACHINE}/include/pc; \
362 ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
363 ${SDESTDIR}${INCLUDEDIR}/machine/pc
365 .for _MARCH in ${_MARCHS}
366 .if exists(${SRCTOP}/sys/${_MARCH}/include)
367 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \
368 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \
369 cd ${SRCTOP}/sys/${_MARCH}/include; \
370 ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
371 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}
372 .if exists(${SRCTOP}/sys/${_MARCH}/include/pc)
373 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \
374 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
375 cd ${SRCTOP}/sys/${_MARCH}/include/pc; \
376 ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
377 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc
382 symlinks: .PHONY .META
383 @${ECHO} "Setting up symlinks to kernel source tree..."
385 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
386 $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i
388 .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec}
389 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
390 $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i
392 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
393 $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \
394 ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \
395 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \
396 ${SDESTDIR}${INCLUDEDIR}/dev/agp; \
397 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
398 $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \
399 ${SDESTDIR}${INCLUDEDIR}/dev/evdev;
400 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
401 $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \
402 ${SDESTDIR}${INCLUDEDIR}/dev/hid; \
403 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \
404 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \
405 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \
406 ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \
407 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \
408 ${SDESTDIR}${INCLUDEDIR}/dev/pci; \
409 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \
410 ${SDESTDIR}${INCLUDEDIR}/dev/veriexec;
411 .for i in ${LSUBSUBDIRS}
412 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
413 $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i
415 .if ${MK_IPFILTER} != "no"
416 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
417 $$(printf '../../../%s ' sys/netpfil/ipfilter/netinet/*.h) \
418 ${SDESTDIR}${INCLUDEDIR}/netinet;
421 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
422 $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \
423 ${SDESTDIR}${INCLUDEDIR}/netpfil/pf;
425 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \
426 ${SDESTDIR}${INCLUDEDIR}/crypto; \
427 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
428 $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \
429 ${SDESTDIR}${INCLUDEDIR}/machine;
430 .if exists(${SRCTOP}/sys/${MACHINE}/include/pc)
431 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
432 $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \
433 ${SDESTDIR}${INCLUDEDIR}/machine/pc;
435 .for _MARCH in ${_MARCHS}
436 .if exists(${SRCTOP}/sys/${_MARCH}/include)
437 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \
438 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \
439 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
440 $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \
441 ${SDESTDIR}${INCLUDEDIR}/${_MARCH};
442 .if exists(${SRCTOP}/sys/${_MARCH}/include/pc)
443 ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \
444 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
445 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
446 $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \
447 ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc;
451 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
452 $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \
453 ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \
454 cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
455 $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \
456 ${SDESTDIR}${INCLUDEDIR}/rpc;
457 cd ${SRCTOP}/sys/rpc;
458 .if ${MK_CDDL} != "no"
459 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \
460 ../../../sys/contrib/openzfs/include/sys/nvpair.h \
461 ${SDESTDIR}${INCLUDEDIR}/sys
463 .if ${MK_MLX5TOOL} != "no"
464 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \
465 ${SDESTDIR}${INCLUDEDIR}/dev/mlx5
468 .include <bsd.prog.mk>
470 installincludes: ${SHARED}
473 .if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
474 # we're here because we are building a sysroot...
475 # we need MACHINE et al set correctly
476 HOST_MACHINE!= uname -m
477 HOST_MACHINE_ARCH!= uname -p
478 MACHINE:= ${HOST_MACHINE}
479 MACHINE_ARCH:= ${HOST_MACHINE_ARCH}