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