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