xref: /freebsd/sys/modules/Makefile (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
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	safexcel \
321	${_sbni} \
322	scc \
323	${_sctp} \
324	sdhci \
325	${_sdhci_acpi} \
326	sdhci_pci \
327	sdio \
328	sem \
329	send \
330	${_sfxge} \
331	sge \
332	${_sgx} \
333	${_sgx_linux} \
334	siftr \
335	siis \
336	sis \
337	sk \
338	${_smartpqi} \
339	smbfs \
340	snp \
341	sound \
342	${_speaker} \
343	spi \
344	${_splash} \
345	${_sppp} \
346	ste \
347	stge \
348	${_superio} \
349	${_sym} \
350	${_syscons} \
351	sysvipc \
352	tcp \
353	${_ti} \
354	tmpfs \
355	${_toecore} \
356	${_tpm} \
357	${_twa} \
358	twe \
359	tws \
360	uart \
361	udf \
362	udf_iconv \
363	ufs \
364	uinput \
365	unionfs \
366	usb \
367	${_vesa} \
368	${_virtio} \
369	vge \
370	${_viawd} \
371	videomode \
372	vkbd \
373	${_vmd} \
374	${_vmm} \
375	${_vmware} \
376	vr \
377	vte \
378	${_wbwd} \
379	${_wi} \
380	wlan \
381	wlan_acl \
382	wlan_amrr \
383	wlan_ccmp \
384	wlan_rssadapt \
385	wlan_tkip \
386	wlan_wep \
387	wlan_xauth \
388	${_wpi} \
389	${_wpifw} \
390	${_x86bios} \
391	xdr \
392	xl \
393	xz \
394	zlib
395
396.if ${MK_AUTOFS} != "no" || defined(ALL_MODULES)
397_autofs=	autofs
398.endif
399
400.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
401.if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != "") && \
402	${MACHINE_CPUARCH} != "mips"
403.if ${KERN_OPTS:MKDTRACE_HOOKS}
404SUBDIR+=	dtrace
405.endif
406.endif
407SUBDIR+=	opensolaris
408.endif
409
410.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
411.if exists(${SRCTOP}/sys/opencrypto)
412_crypto=	crypto
413_cryptodev=	cryptodev
414_random_fortuna=random_fortuna
415_random_other=	random_other
416_ktls_ocf=	ktls_ocf
417.endif
418.endif
419
420.if ${MK_CUSE} != "no" || defined(ALL_MODULES)
421SUBDIR+=	cuse
422.endif
423
424.if ${MK_EFI} != "no"
425.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
426_efirt=		efirt
427.endif
428.endif
429
430.if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
431	defined(ALL_MODULES)
432_carp=		carp
433_toecore=	toecore
434_if_enc=	if_enc
435_if_gif=	if_gif
436_if_gre=	if_gre
437_ipfw_pmod=	ipfw_pmod
438.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
439_ipsec=		ipsec
440.endif
441.if ${KERN_OPTS:MSCTP_SUPPORT} || ${KERN_OPTS:MSCTP}
442_sctp=		sctp
443.endif
444.endif
445
446.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
447	defined(ALL_MODULES)
448_if_stf=	if_stf
449.endif
450
451.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
452_if_me=		if_me
453_ipdivert=	ipdivert
454_ipfw=		ipfw
455.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
456_ipfw_nat64=	ipfw_nat64
457.endif
458.endif
459
460.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
461_ipfw_nptv6=	ipfw_nptv6
462.endif
463
464.if ${MK_IPFILTER} != "no" || defined(ALL_MODULES)
465_ipfilter=	ipfilter
466.endif
467
468.if ${MK_ISCSI} != "no" || defined(ALL_MODULES)
469SUBDIR+=	cfiscsi
470SUBDIR+=	iscsi
471SUBDIR+=	iscsi_initiator
472.endif
473
474.if !empty(OPT_FDT)
475SUBDIR+=	fdt
476.endif
477
478# Linuxulator
479.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
480    ${MACHINE_CPUARCH} == "i386"
481SUBDIR+=	linprocfs
482SUBDIR+=	linsysfs
483.endif
484.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
485SUBDIR+=	linux
486.endif
487.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
488SUBDIR+=	linux64
489SUBDIR+=	linux_common
490.endif
491
492.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
493    ${MACHINE_CPUARCH} == "i386"
494_ena=		ena
495.if ${MK_OFED} != "no" || defined(ALL_MODULES)
496_ibcore=	ibcore
497_ipoib=		ipoib
498_iser=		iser
499.endif
500_mlx4=		mlx4
501_mlx5=		mlx5
502.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
503	defined(ALL_MODULES)
504_mlx4en=	mlx4en
505_mlx5en=	mlx5en
506.endif
507.if ${MK_OFED} != "no" || defined(ALL_MODULES)
508_mthca=		mthca
509_mlx4ib=	mlx4ib
510_mlx5ib=	mlx5ib
511.endif
512.endif
513
514.if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES)
515_netgraph=	netgraph
516.endif
517
518.if (${MK_PF} != "no" && (${MK_INET_SUPPORT} != "no" || \
519	${MK_INET6_SUPPORT} != "no")) || defined(ALL_MODULES)
520_pf=		pf
521_pflog=		pflog
522.if ${MK_INET_SUPPORT} != "no"
523_pfsync=	pfsync
524.endif
525.endif
526
527.if ${MK_SOURCELESS_UCODE} != "no"
528_bce=		bce
529_fxp=		fxp
530_ispfw=		ispfw
531_ti=		ti
532
533.if ${MACHINE_CPUARCH} != "mips"
534_mwlfw=		mwlfw
535_otusfw=	otusfw
536_ralfw=		ralfw
537_rtwnfw=	rtwnfw
538.endif
539.endif
540
541.if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \
542	${MACHINE_CPUARCH} != "mips" && \
543	${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
544	${MACHINE_CPUARCH} != "riscv"
545_cxgbe=		cxgbe
546.endif
547
548.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "arm64"
549_ice=		ice
550.if ${MK_SOURCELESS_UCODE} != "no"
551_ice_ddp=	ice_ddp
552.endif
553.endif
554
555# These rely on 64bit atomics
556.if ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
557	${MACHINE_CPUARCH} != "mips"
558_mps=		mps
559_mpr=		mpr
560.endif
561
562.if ${MK_TESTS} != "no" || defined(ALL_MODULES)
563SUBDIR+=	tests
564.endif
565
566.if ${MK_ZFS} != "no" || defined(ALL_MODULES)
567SUBDIR+=	zfs
568.endif
569
570.if (${MACHINE_CPUARCH} == "mips" && ${MACHINE_ARCH:Mmips64} == "")
571_hwpmc_mips24k=	hwpmc_mips24k
572_hwpmc_mips74k=	hwpmc_mips74k
573.endif
574
575.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
576	${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
577	${MACHINE_CPUARCH} != "riscv"
578_syscons=	syscons
579.endif
580
581.if ${MACHINE_CPUARCH} != "mips"
582# no BUS_SPACE_UNSPECIFIED
583# No barrier instruction support (specific to this driver)
584_sym=		sym
585# intr_disable() is a macro, causes problems
586.if ${MK_SOURCELESS_UCODE} != "no"
587_cxgb=		cxgb
588.endif
589.endif
590
591.if ${MACHINE_CPUARCH} == "aarch64"
592_allwinner=	allwinner
593_armv8crypto=	armv8crypto
594_em=		em
595_rockchip=	rockchip
596.endif
597
598.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
599_agp=		agp
600_an=		an
601_aout=		aout
602_bios=		bios
603.if ${MK_SOURCELESS_UCODE} != "no"
604_bxe=		bxe
605.endif
606_cardbus=	cardbus
607_cbb=		cbb
608_cpuctl=	cpuctl
609_cpufreq=	cpufreq
610_dpms=		dpms
611_em=		em
612_et=		et
613_exca=		exca
614_if_ndis=	if_ndis
615_io=		io
616_itwd=		itwd
617_ix=		ix
618_ixv=		ixv
619.if ${MK_SOURCELESS_UCODE} != "no"
620_lio=		lio
621.endif
622_nctgpio=	nctgpio
623_ndis=		ndis
624_ntb=		ntb
625_ocs_fc=	ocs_fc
626_pccard=	pccard
627.if ${MK_OFED} != "no" || defined(ALL_MODULES)
628_rdma=		rdma
629.endif
630_safe=		safe
631_speaker=	speaker
632_splash=	splash
633_sppp=		sppp
634_vmware=	vmware
635_wbwd=		wbwd
636_wi=		wi
637
638_aac=		aac
639_aacraid=	aacraid
640_acpi=		acpi
641.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
642_aesni=		aesni
643.endif
644_amd_ecc_inject=amd_ecc_inject
645_amdsbwd=	amdsbwd
646_amdsmn=	amdsmn
647_amdtemp=	amdtemp
648_arcmsr=	arcmsr
649_asmc=		asmc
650.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
651_blake2=	blake2
652.endif
653_bytgpio=	bytgpio
654_chvgpio=	chvgpio
655_ciss=		ciss
656_chromebook_platform=	chromebook_platform
657_cmx=		cmx
658_coretemp=	coretemp
659.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
660_hpt27xx=	hpt27xx
661.endif
662_hptiop=	hptiop
663.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
664_hptmv=		hptmv
665_hptnr=		hptnr
666_hptrr=		hptrr
667.endif
668_hyperv=	hyperv
669_ichwd=		ichwd
670_ida=		ida
671_iir=		iir
672_intelspi=	intelspi
673_ipmi=		ipmi
674_ips=		ips
675_isci=		isci
676_ipw=		ipw
677_iwi=		iwi
678_iwm=		iwm
679_iwn=		iwn
680.if ${MK_SOURCELESS_UCODE} != "no"
681_ipwfw=		ipwfw
682_iwifw=		iwifw
683_iwmfw=		iwmfw
684_iwnfw=		iwnfw
685.endif
686_mly=		mly
687_nfe=		nfe
688_nvd=		nvd
689_nvme=		nvme
690_nvram=		nvram
691.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
692_padlock=	padlock
693_padlock_rng=	padlock_rng
694_rdrand_rng=	rdrand_rng
695.endif
696_pchtherm = pchtherm
697_s3=		s3
698_sdhci_acpi=	sdhci_acpi
699_superio=	superio
700_tpm=		tpm
701_twa=		twa
702_vesa=		vesa
703_viawd=		viawd
704_virtio=	virtio
705_wpi=		wpi
706.if ${MK_SOURCELESS_UCODE} != "no"
707_wpifw=		wpifw
708.endif
709_x86bios=	x86bios
710.endif
711
712.if ${MACHINE_CPUARCH} == "amd64"
713_amdgpio=	amdgpio
714_ccp=		ccp
715_iavf=		iavf
716_ioat=		ioat
717_ixl=		ixl
718_nvdimm=	nvdimm
719_pms=		pms
720_qlxge=		qlxge
721_qlxgb=		qlxgb
722_vmd=		vmd
723.if ${MK_SOURCELESS_UCODE} != "no"
724_qlxgbe=	qlxgbe
725_qlnx=		qlnx
726.endif
727_sfxge=		sfxge
728_sgx=		sgx
729_sgx_linux=	sgx_linux
730_smartpqi=	smartpqi
731
732.if ${MK_BHYVE} != "no" || defined(ALL_MODULES)
733.if ${KERN_OPTS:MSMP}
734_vmm=		vmm
735.endif
736.endif
737.endif
738
739.if ${MACHINE_CPUARCH} == "i386"
740# XXX some of these can move to the general case when de-i386'ed
741# XXX some of these can move now, but are untested on other architectures.
742_3dfx=		3dfx
743_3dfx_linux=	3dfx_linux
744_apm=		apm
745.if ${MK_SOURCELESS_HOST} != "no"
746_ce=		ce
747.endif
748.if ${MK_SOURCELESS_UCODE} != "no"
749_cp=		cp
750.endif
751_glxiic=	glxiic
752_glxsb=		glxsb
753_pcfclock=	pcfclock
754_pst=		pst
755_sbni=		sbni
756.endif
757
758.if ${MACHINE_ARCH} == "armv7"
759_cfi=		cfi
760_cpsw=		cpsw
761.endif
762
763.if ${MACHINE_CPUARCH} == "powerpc"
764_aacraid=	aacraid
765_agp=		agp
766_an=		an
767_cardbus=	cardbus
768_cbb=		cbb
769_cfi=		cfi
770_cpufreq=	cpufreq
771_exca=		exca
772_ffec=		ffec
773_nvd=		nvd
774_nvme=		nvme
775_pccard=	pccard
776_wi=		wi
777_virtio=	virtio
778.endif
779
780.if ${MACHINE_ARCH} == "powerpc64"
781_ipmi=		ipmi
782_ixl=		ixl
783_nvram=		opal_nvram
784.endif
785.if ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc"
786# Don't build powermac_nvram for powerpcspe, it's never supported.
787_nvram+=	powermac_nvram
788.endif
789
790.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
791     ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "i386")
792_cloudabi32=	cloudabi32
793.endif
794.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
795_cloudabi64=	cloudabi64
796.endif
797
798.endif
799
800.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64"
801_bcm283x_clkman=  bcm283x_clkman
802_bcm283x_pwm=  bcm283x_pwm
803.endif
804
805SUBDIR+=${MODULES_EXTRA}
806
807.for reject in ${WITHOUT_MODULES}
808SUBDIR:= ${SUBDIR:N${reject}}
809.endfor
810
811# Calling kldxref(8) for each module is expensive.
812.if !defined(NO_XREF)
813.MAKEFLAGS+=	-DNO_XREF
814afterinstall: .PHONY
815	@if type kldxref >/dev/null 2>&1; then \
816		${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
817		${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
818	fi
819.endif
820
821SUBDIR:= ${SUBDIR:u:O}
822
823.include <bsd.subdir.mk>
824