xref: /freebsd/sys/modules/Makefile (revision 4e99f45480598189d49d45a825533a6c9e12f02c)
1# $FreeBSD$
2
3SYSDIR?=${SRCTOP}/sys
4.include "${SYSDIR}/conf/kern.opts.mk"
5
6SUBDIR_PARALLEL=
7
8# Modules that include binary-only blobs of microcode should be selectable by
9# MK_SOURCELESS_UCODE option (see below).
10
11.include "${SYSDIR}/conf/config.mk"
12
13.if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES)
14SUBDIR=${MODULES_OVERRIDE}
15.else
16SUBDIR=	\
17	${_3dfx} \
18	${_3dfx_linux} \
19	${_aac} \
20	${_aacraid} \
21	accf_data \
22	accf_dns \
23	accf_http \
24	acl_nfs4 \
25	acl_posix1e \
26	${_acpi} \
27	ae \
28	${_aesni} \
29	age \
30	${_agp} \
31	ahci \
32	aic7xxx \
33	alc \
34	ale \
35	alq \
36	${_amd_ecc_inject} \
37	${_amdgpio} \
38	${_amdsbwd} \
39	${_amdsmn} \
40	${_amdtemp} \
41	amr \
42	${_an} \
43	${_aout} \
44	${_apm} \
45	${_arcmsr} \
46	${_allwinner} \
47	${_armv8crypto} \
48	${_asmc} \
49	ata \
50	ath \
51	ath_dfs \
52	ath_hal \
53	ath_hal_ar5210 \
54	ath_hal_ar5211 \
55	ath_hal_ar5212 \
56	ath_hal_ar5416 \
57	ath_hal_ar9300 \
58	ath_main \
59	ath_rate \
60	ath_pci \
61	${_autofs} \
62	${_bce} \
63	${_bcm283x_clkman} \
64	${_bcm283x_pwm} \
65	bfe \
66	bge \
67	bhnd \
68	${_bxe} \
69	${_bios} \
70	${_blake2} \
71	bnxt \
72	bridgestp \
73	bwi \
74	bwn \
75	${_bytgpio} \
76	${_chvgpio} \
77	cam \
78	${_cardbus} \
79	${_carp} \
80	cas \
81	${_cbb} \
82	cc \
83	${_ccp} \
84	cd9660 \
85	cd9660_iconv \
86	${_ce} \
87	${_cfi} \
88	${_chromebook_platform} \
89	${_ciss} \
90	cloudabi \
91	${_cloudabi32} \
92	${_cloudabi64} \
93	${_cmx} \
94	${_coretemp} \
95	${_cp} \
96	${_cpsw} \
97	${_cpuctl} \
98	${_cpufreq} \
99	${_crypto} \
100	${_cryptodev} \
101	ctl \
102	${_cxgb} \
103	${_cxgbe} \
104	dc \
105	dcons \
106	dcons_crom \
107	${_dpms} \
108	dummynet \
109	${_efirt} \
110	${_em} \
111	${_ena} \
112	esp \
113	${_et} \
114	evdev \
115	${_exca} \
116	ext2fs \
117	fdc \
118	fdescfs \
119	${_ffec} \
120	filemon \
121	firewire \
122	firmware \
123	fusefs \
124	${_fxp} \
125	gem \
126	geom \
127	${_glxiic} \
128	${_glxsb} \
129	gpio \
130	hifn \
131	hme \
132	${_hpt27xx} \
133	${_hptiop} \
134	${_hptmv} \
135	${_hptnr} \
136	${_hptrr} \
137	hwpmc \
138	${_hwpmc_mips24k} \
139	${_hwpmc_mips74k} \
140	${_hyperv} \
141	i2c \
142	${_iavf} \
143        ${_ibcore} \
144	${_ichwd} \
145	${_ice} \
146	${_ice_ddp} \
147	${_ida} \
148	if_bridge \
149	if_disc \
150	if_edsc \
151	${_if_enc} \
152	if_epair \
153	${_if_gif} \
154	${_if_gre} \
155	${_if_me} \
156	if_lagg \
157	${_if_ndis} \
158	${_if_stf} \
159	if_tuntap \
160	if_vlan \
161	if_vxlan \
162	iflib \
163	${_iir} \
164	imgact_binmisc \
165	${_intelspi} \
166	${_io} \
167	${_ioat} \
168        ${_ipoib} \
169	${_ipdivert} \
170	${_ipfilter} \
171	${_ipfw} \
172	ipfw_nat \
173	${_ipfw_nat64} \
174	${_ipfw_nptv6} \
175	${_ipfw_pmod} \
176	${_ipmi} \
177	ip6_mroute_mod \
178	ip_mroute_mod \
179	${_ips} \
180	${_ipsec} \
181	${_ipw} \
182	${_ipwfw} \
183	${_isci} \
184	${_iser} \
185	isp \
186	${_ispfw} \
187	${_itwd} \
188	${_iwi} \
189	${_iwifw} \
190	${_iwm} \
191	${_iwmfw} \
192	${_iwn} \
193	${_iwnfw} \
194	${_ix} \
195	${_ixv} \
196	${_ixl} \
197	jme \
198	kbdmux \
199	kgssapi \
200	kgssapi_krb5 \
201	khelp \
202	krpc \
203	ksyms \
204	${_ktls_ocf} \
205	le \
206	lge \
207	libalias \
208	libiconv \
209	libmchain \
210	lindebugfs \
211	linuxkpi \
212	${_lio} \
213	lpt \
214	mac_biba \
215	mac_bsdextended \
216	mac_ifoff \
217	mac_lomac \
218	mac_mls \
219	mac_none \
220	mac_ntpd \
221	mac_partition \
222	mac_portacl \
223	mac_seeotheruids \
224	mac_stub \
225	mac_test \
226	malo \
227	md \
228	mdio \
229	mem \
230	mfi \
231	mii \
232	mlx \
233	mlxfw \
234	${_mlx4} \
235	${_mlx4ib} \
236	${_mlx4en} \
237	${_mlx5} \
238	${_mlx5en} \
239	${_mlx5ib} \
240	${_mly} \
241	mmc \
242	mmcsd \
243	${_mpr} \
244	${_mps} \
245	mpt \
246	mqueue \
247	mrsas \
248	msdosfs \
249	msdosfs_iconv \
250	msk \
251	${_mthca} \
252	mvs \
253	mwl \
254	${_mwlfw} \
255	mxge \
256	my \
257	${_nctgpio} \
258	${_ndis} \
259	${_netgraph} \
260	${_nfe} \
261	nfscl \
262	nfscommon \
263	nfsd \
264	nfslockd \
265	nfssvc \
266	nge \
267	nmdm \
268	nullfs \
269	${_ntb} \
270	${_nvd} \
271	${_nvdimm} \
272	${_nvme} \
273	${_nvram} \
274	oce \
275	${_ocs_fc} \
276	otus \
277	${_otusfw} \
278	ow \
279	${_padlock} \
280	${_padlock_rng} \
281	${_pccard} \
282	${_pchtherm} \
283	${_pcfclock} \
284	${_pf} \
285	${_pflog} \
286	${_pfsync} \
287	plip \
288	${_pms} \
289	ppbus \
290	ppc \
291	ppi \
292	pps \
293	procfs \
294	proto \
295	pseudofs \
296	${_pst} \
297	pty  \
298	puc \
299	pwm \
300	${_qlxge} \
301	${_qlxgb} \
302	${_qlxgbe} \
303	${_qlnx} \
304	ral \
305	${_ralfw} \
306	${_random_fortuna} \
307	${_random_other} \
308	rc4 \
309	${_rdma} \
310	${_rdrand_rng} \
311	re \
312	rl \
313	${_rockchip} \
314	rtwn \
315	rtwn_pci \
316	rtwn_usb \
317	${_rtwnfw} \
318	${_s3} \
319	${_safe} \
320	${_sbni} \
321	scc \
322	sdhci \
323	${_sdhci_acpi} \
324	sdhci_pci \
325	sdio \
326	sem \
327	send \
328	${_sfxge} \
329	sge \
330	${_sgx} \
331	${_sgx_linux} \
332	siftr \
333	siis \
334	sis \
335	sk \
336	${_smartpqi} \
337	smbfs \
338	snp \
339	sound \
340	${_speaker} \
341	spi \
342	${_splash} \
343	${_sppp} \
344	ste \
345	stge \
346	${_superio} \
347	${_sym} \
348	${_syscons} \
349	sysvipc \
350	tcp \
351	${_ti} \
352	tmpfs \
353	${_toecore} \
354	${_tpm} \
355	${_twa} \
356	twe \
357	tws \
358	uart \
359	udf \
360	udf_iconv \
361	ufs \
362	uinput \
363	unionfs \
364	usb \
365	${_vesa} \
366	${_virtio} \
367	vge \
368	${_viawd} \
369	videomode \
370	vkbd \
371	${_vmd} \
372	${_vmm} \
373	${_vmware} \
374	vr \
375	vte \
376	${_wbwd} \
377	${_wi} \
378	wlan \
379	wlan_acl \
380	wlan_amrr \
381	wlan_ccmp \
382	wlan_rssadapt \
383	wlan_tkip \
384	wlan_wep \
385	wlan_xauth \
386	${_wpi} \
387	${_wpifw} \
388	${_x86bios} \
389	xdr \
390	xl \
391	xz \
392	zlib
393
394.if ${MK_AUTOFS} != "no" || defined(ALL_MODULES)
395_autofs=	autofs
396.endif
397
398.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
399.if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != "") && \
400	${MACHINE_CPUARCH} != "mips"
401.if ${KERN_OPTS:MKDTRACE_HOOKS}
402SUBDIR+=	dtrace
403.endif
404.endif
405SUBDIR+=	opensolaris
406.endif
407
408.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
409.if exists(${SRCTOP}/sys/opencrypto)
410_crypto=	crypto
411_cryptodev=	cryptodev
412_random_fortuna=random_fortuna
413_random_other=	random_other
414_ktls_ocf=	ktls_ocf
415.endif
416.endif
417
418.if ${MK_CUSE} != "no" || defined(ALL_MODULES)
419SUBDIR+=	cuse
420.endif
421
422.if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
423	defined(ALL_MODULES)
424_carp=		carp
425_toecore=	toecore
426_if_enc=	if_enc
427_if_gif=	if_gif
428_if_gre=	if_gre
429_ipfw_pmod=	ipfw_pmod
430.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
431_ipsec=		ipsec
432.endif
433.endif
434
435.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
436	defined(ALL_MODULES)
437_if_stf=	if_stf
438.endif
439
440.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
441_if_me=		if_me
442_ipdivert=	ipdivert
443_ipfw=		ipfw
444.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
445_ipfw_nat64=	ipfw_nat64
446.endif
447.endif
448
449.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
450_ipfw_nptv6=	ipfw_nptv6
451.endif
452
453.if ${MK_IPFILTER} != "no" || defined(ALL_MODULES)
454_ipfilter=	ipfilter
455.endif
456
457.if ${MK_ISCSI} != "no" || defined(ALL_MODULES)
458SUBDIR+=	cfiscsi
459SUBDIR+=	iscsi
460SUBDIR+=	iscsi_initiator
461.endif
462
463.if !empty(OPT_FDT)
464SUBDIR+=	fdt
465.endif
466
467# Linuxulator
468.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
469    ${MACHINE_CPUARCH} == "i386"
470SUBDIR+=	linprocfs
471SUBDIR+=	linsysfs
472.endif
473.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
474SUBDIR+=	linux
475.endif
476.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
477SUBDIR+=	linux64
478SUBDIR+=	linux_common
479.endif
480
481.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
482    ${MACHINE_CPUARCH} == "i386"
483_ena=		ena
484.if ${MK_OFED} != "no" || defined(ALL_MODULES)
485_ibcore=	ibcore
486_ipoib=		ipoib
487_iser=		iser
488.endif
489_mlx4=		mlx4
490_mlx5=		mlx5
491.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
492	defined(ALL_MODULES)
493_mlx4en=	mlx4en
494_mlx5en=	mlx5en
495.endif
496.if ${MK_OFED} != "no" || defined(ALL_MODULES)
497_mthca=		mthca
498_mlx4ib=	mlx4ib
499_mlx5ib=	mlx5ib
500.endif
501.endif
502
503.if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES)
504_netgraph=	netgraph
505.endif
506
507.if (${MK_PF} != "no" && (${MK_INET_SUPPORT} != "no" || \
508	${MK_INET6_SUPPORT} != "no")) || defined(ALL_MODULES)
509_pf=		pf
510_pflog=		pflog
511.if ${MK_INET_SUPPORT} != "no"
512_pfsync=	pfsync
513.endif
514.endif
515
516.if ${MK_SOURCELESS_UCODE} != "no"
517_bce=		bce
518_fxp=		fxp
519_ispfw=		ispfw
520_ti=		ti
521
522.if ${MACHINE_CPUARCH} != "mips"
523_mwlfw=		mwlfw
524_otusfw=	otusfw
525_ralfw=		ralfw
526_rtwnfw=	rtwnfw
527.endif
528.endif
529
530.if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \
531	${MACHINE_CPUARCH} != "mips" && \
532	${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
533	${MACHINE_CPUARCH} != "riscv"
534_cxgbe=		cxgbe
535.endif
536
537.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "arm64"
538_ice=		ice
539.if ${MK_SOURCELESS_UCODE} != "no"
540_ice_ddp=	ice_ddp
541.endif
542.endif
543
544# These rely on 64bit atomics
545.if ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
546	${MACHINE_CPUARCH} != "mips"
547_mps=		mps
548_mpr=		mpr
549.endif
550
551.if ${MK_TESTS} != "no" || defined(ALL_MODULES)
552SUBDIR+=	tests
553.endif
554
555.if ${MK_ZFS} != "no" || defined(ALL_MODULES)
556SUBDIR+=	zfs
557.endif
558
559.if (${MACHINE_CPUARCH} == "mips" && ${MACHINE_ARCH:Mmips64} == "")
560_hwpmc_mips24k=	hwpmc_mips24k
561_hwpmc_mips74k=	hwpmc_mips74k
562.endif
563
564.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
565	${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
566	${MACHINE_CPUARCH} != "riscv"
567_syscons=	syscons
568.endif
569
570.if ${MACHINE_CPUARCH} != "mips"
571# no BUS_SPACE_UNSPECIFIED
572# No barrier instruction support (specific to this driver)
573_sym=		sym
574# intr_disable() is a macro, causes problems
575.if ${MK_SOURCELESS_UCODE} != "no"
576_cxgb=		cxgb
577.endif
578.endif
579
580.if ${MACHINE_CPUARCH} == "aarch64"
581_allwinner=	allwinner
582_armv8crypto=	armv8crypto
583_efirt=		efirt
584_em=		em
585_rockchip=	rockchip
586.endif
587
588.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
589_agp=		agp
590_an=		an
591_aout=		aout
592_bios=		bios
593.if ${MK_SOURCELESS_UCODE} != "no"
594_bxe=		bxe
595.endif
596_cardbus=	cardbus
597_cbb=		cbb
598_cpuctl=	cpuctl
599_cpufreq=	cpufreq
600_dpms=		dpms
601_em=		em
602_et=		et
603_exca=		exca
604_if_ndis=	if_ndis
605_io=		io
606_itwd=		itwd
607_ix=		ix
608_ixv=		ixv
609.if ${MK_SOURCELESS_UCODE} != "no"
610_lio=		lio
611.endif
612_nctgpio=	nctgpio
613_ndis=		ndis
614_ntb=		ntb
615_ocs_fc=	ocs_fc
616_pccard=	pccard
617.if ${MK_OFED} != "no" || defined(ALL_MODULES)
618_rdma=		rdma
619.endif
620_safe=		safe
621_speaker=	speaker
622_splash=	splash
623_sppp=		sppp
624_vmware=	vmware
625_wbwd=		wbwd
626_wi=		wi
627
628_aac=		aac
629_aacraid=	aacraid
630_acpi=		acpi
631.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
632_aesni=		aesni
633.endif
634_amd_ecc_inject=amd_ecc_inject
635_amdsbwd=	amdsbwd
636_amdsmn=	amdsmn
637_amdtemp=	amdtemp
638_arcmsr=	arcmsr
639_asmc=		asmc
640.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
641_blake2=	blake2
642.endif
643_bytgpio=	bytgpio
644_chvgpio=	chvgpio
645_ciss=		ciss
646_chromebook_platform=	chromebook_platform
647_cmx=		cmx
648_coretemp=	coretemp
649.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
650_hpt27xx=	hpt27xx
651.endif
652_hptiop=	hptiop
653.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
654_hptmv=		hptmv
655_hptnr=		hptnr
656_hptrr=		hptrr
657.endif
658_hyperv=	hyperv
659_ichwd=		ichwd
660_ida=		ida
661_iir=		iir
662_intelspi=	intelspi
663_ipmi=		ipmi
664_ips=		ips
665_isci=		isci
666_ipw=		ipw
667_iwi=		iwi
668_iwm=		iwm
669_iwn=		iwn
670.if ${MK_SOURCELESS_UCODE} != "no"
671_ipwfw=		ipwfw
672_iwifw=		iwifw
673_iwmfw=		iwmfw
674_iwnfw=		iwnfw
675.endif
676_mly=		mly
677_nfe=		nfe
678_nvd=		nvd
679_nvme=		nvme
680_nvram=		nvram
681.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
682_padlock=	padlock
683_padlock_rng=	padlock_rng
684_rdrand_rng=	rdrand_rng
685.endif
686_pchtherm = pchtherm
687_s3=		s3
688_sdhci_acpi=	sdhci_acpi
689_superio=	superio
690_tpm=		tpm
691_twa=		twa
692_vesa=		vesa
693_viawd=		viawd
694_virtio=	virtio
695_wpi=		wpi
696.if ${MK_SOURCELESS_UCODE} != "no"
697_wpifw=		wpifw
698.endif
699_x86bios=	x86bios
700.endif
701
702.if ${MACHINE_CPUARCH} == "amd64"
703_amdgpio=	amdgpio
704_ccp=		ccp
705_efirt=		efirt
706_iavf=		iavf
707_ioat=		ioat
708_ixl=		ixl
709_nvdimm=	nvdimm
710_pms=		pms
711_qlxge=		qlxge
712_qlxgb=		qlxgb
713_vmd=		vmd
714.if ${MK_SOURCELESS_UCODE} != "no"
715_qlxgbe=	qlxgbe
716_qlnx=		qlnx
717.endif
718_sfxge=		sfxge
719_sgx=		sgx
720_sgx_linux=	sgx_linux
721_smartpqi=	smartpqi
722
723.if ${MK_BHYVE} != "no" || defined(ALL_MODULES)
724.if ${KERN_OPTS:MSMP}
725_vmm=		vmm
726.endif
727.endif
728.endif
729
730.if ${MACHINE_CPUARCH} == "i386"
731# XXX some of these can move to the general case when de-i386'ed
732# XXX some of these can move now, but are untested on other architectures.
733_3dfx=		3dfx
734_3dfx_linux=	3dfx_linux
735_apm=		apm
736.if ${MK_SOURCELESS_HOST} != "no"
737_ce=		ce
738.endif
739.if ${MK_SOURCELESS_UCODE} != "no"
740_cp=		cp
741.endif
742_glxiic=	glxiic
743_glxsb=		glxsb
744_pcfclock=	pcfclock
745_pst=		pst
746_sbni=		sbni
747.endif
748
749.if ${MACHINE_CPUARCH} == "arm"
750_cfi=		cfi
751_cpsw=		cpsw
752.endif
753
754.if ${MACHINE_CPUARCH} == "powerpc"
755_aacraid=	aacraid
756_agp=		agp
757_an=		an
758_cardbus=	cardbus
759_cbb=		cbb
760_cfi=		cfi
761_cpufreq=	cpufreq
762_exca=		exca
763_ffec=		ffec
764_nvd=		nvd
765_nvme=		nvme
766_pccard=	pccard
767_wi=		wi
768_virtio=	virtio
769.endif
770
771.if ${MACHINE_ARCH} == "powerpc64"
772_ipmi=		ipmi
773_ixl=		ixl
774_nvram=		opal_nvram
775.endif
776.if ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc"
777# Don't build powermac_nvram for powerpcspe, it's never supported.
778_nvram+=	powermac_nvram
779.endif
780
781.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
782     ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "i386")
783_cloudabi32=	cloudabi32
784.endif
785.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
786_cloudabi64=	cloudabi64
787.endif
788
789.endif
790
791.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64"
792_bcm283x_clkman=  bcm283x_clkman
793_bcm283x_pwm=  bcm283x_pwm
794.endif
795
796SUBDIR+=${MODULES_EXTRA}
797
798.for reject in ${WITHOUT_MODULES}
799SUBDIR:= ${SUBDIR:N${reject}}
800.endfor
801
802# Calling kldxref(8) for each module is expensive.
803.if !defined(NO_XREF)
804.MAKEFLAGS+=	-DNO_XREF
805afterinstall: .PHONY
806	@if type kldxref >/dev/null 2>&1; then \
807		${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
808		${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
809	fi
810.endif
811
812SUBDIR:= ${SUBDIR:u:O}
813
814.include <bsd.subdir.mk>
815