xref: /freebsd/sys/modules/Makefile (revision 849aef496d2ae19961310f4e92f3a0b928732d26)
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.if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES)
12SUBDIR=${MODULES_OVERRIDE}
13.else
14SUBDIR=	\
15	${_3dfx} \
16	${_3dfx_linux} \
17	${_aac} \
18	${_aacraid} \
19	accf_data \
20	accf_dns \
21	accf_http \
22	acl_nfs4 \
23	acl_posix1e \
24	${_acpi} \
25	ae \
26	${_aesni} \
27	age \
28	${_agp} \
29	ahci \
30	aic7xxx \
31	alc \
32	ale \
33	alq \
34	${_amd_ecc_inject} \
35	${_amdgpio} \
36	${_amdsbwd} \
37	${_amdsmn} \
38	${_amdtemp} \
39	amr \
40	${_an} \
41	${_aout} \
42	${_apm} \
43	${_arcmsr} \
44	${_allwinner} \
45	${_armv8crypto} \
46	${_asmc} \
47	ata \
48	ath \
49	ath_dfs \
50	ath_hal \
51	ath_hal_ar5210 \
52	ath_hal_ar5211 \
53	ath_hal_ar5212 \
54	ath_hal_ar5416 \
55	ath_hal_ar9300 \
56	ath_main \
57	ath_rate \
58	ath_pci \
59	${_autofs} \
60	${_auxio} \
61	${_bce} \
62	${_bcm283x_clkman} \
63	${_bcm283x_pwm} \
64	bfe \
65	bge \
66	bhnd \
67	${_bxe} \
68	${_bios} \
69	${_bktr} \
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	${_ctau} \
102	ctl \
103	${_cxgb} \
104	${_cxgbe} \
105	dc \
106	dcons \
107	dcons_crom \
108	${_dpms} \
109	dummynet \
110	${_efirt} \
111	${_em} \
112	${_ena} \
113	${_epic} \
114	esp \
115	${_et} \
116	evdev \
117	${_exca} \
118	ext2fs \
119	fdc \
120	fdescfs \
121	${_ffec} \
122	filemon \
123	firewire \
124	firmware \
125	fusefs \
126	${_fxp} \
127	gem \
128	geom \
129	${_glxiic} \
130	${_glxsb} \
131	gpio \
132	hifn \
133	hme \
134	${_hpt27xx} \
135	${_hptiop} \
136	${_hptmv} \
137	${_hptnr} \
138	${_hptrr} \
139	hwpmc \
140	${_hwpmc_mips24k} \
141	${_hwpmc_mips74k} \
142	${_hyperv} \
143	i2c \
144	${_iavf} \
145        ${_ibcore} \
146	${_ichwd} \
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	nfslock \
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	${_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	trm \
356	${_twa} \
357	twe \
358	tws \
359	uart \
360	ubsec \
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	${_vpo} \
377	vr \
378	vte \
379	${_wbwd} \
380	${_wi} \
381	wlan \
382	wlan_acl \
383	wlan_amrr \
384	wlan_ccmp \
385	wlan_rssadapt \
386	wlan_tkip \
387	wlan_wep \
388	wlan_xauth \
389	${_wpi} \
390	${_wpifw} \
391	${_x86bios} \
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	${MACHINE_CPUARCH} != "sparc64"
404SUBDIR+=	dtrace
405.endif
406SUBDIR+=	opensolaris
407.endif
408
409.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
410.if exists(${SRCTOP}/sys/opencrypto)
411_crypto=	crypto
412_cryptodev=	cryptodev
413_random_fortuna=random_fortuna
414_random_other=	random_other
415_ktls_ocf=	ktls_ocf
416.endif
417.endif
418
419.if ${MK_CUSE} != "no" || defined(ALL_MODULES)
420SUBDIR+=	cuse
421.endif
422
423.if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
424	defined(ALL_MODULES)
425_carp=		carp
426_toecore=	toecore
427_if_enc=	if_enc
428_if_gif=	if_gif
429_if_gre=	if_gre
430_ipfw_pmod=	ipfw_pmod
431.if ${MK_IPSEC_SUPPORT} != "no"
432_ipsec=		ipsec
433.endif
434.endif
435
436.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
437	defined(ALL_MODULES)
438_if_stf=	if_stf
439.endif
440
441.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES)
442_if_me=		if_me
443_ipdivert=	ipdivert
444_ipfw=		ipfw
445.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
446_ipfw_nat64=	ipfw_nat64
447.endif
448.endif
449
450.if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES)
451_ipfw_nptv6=	ipfw_nptv6
452.endif
453
454.if ${MK_IPFILTER} != "no" || defined(ALL_MODULES)
455_ipfilter=	ipfilter
456.endif
457
458.if ${MK_ISCSI} != "no" || defined(ALL_MODULES)
459SUBDIR+=	cfiscsi
460SUBDIR+=	iscsi
461SUBDIR+=	iscsi_initiator
462.endif
463
464.if !empty(OPT_FDT)
465SUBDIR+=	fdt
466.endif
467
468# Linuxulator
469.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
470    ${MACHINE_CPUARCH} == "i386"
471SUBDIR+=	linprocfs
472SUBDIR+=	linsysfs
473.endif
474.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
475SUBDIR+=	linux
476.endif
477.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
478SUBDIR+=	linux64
479SUBDIR+=	linux_common
480.endif
481
482.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
483    ${MACHINE_CPUARCH} == "i386"
484_ena=		ena
485.if ${MK_OFED} != "no" || defined(ALL_MODULES)
486_ibcore=	ibcore
487_ipoib=		ipoib
488_iser=		iser
489.endif
490_mlx4=		mlx4
491_mlx5=		mlx5
492.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
493	defined(ALL_MODULES)
494_mlx4en=	mlx4en
495_mlx5en=	mlx5en
496.endif
497.if ${MK_OFED} != "no" || defined(ALL_MODULES)
498_mthca=		mthca
499_mlx4ib=	mlx4ib
500_mlx5ib=	mlx5ib
501.endif
502.endif
503
504.if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES)
505_netgraph=	netgraph
506.endif
507
508.if (${MK_PF} != "no" && (${MK_INET_SUPPORT} != "no" || \
509	${MK_INET6_SUPPORT} != "no")) || defined(ALL_MODULES)
510_pf=		pf
511_pflog=		pflog
512.if ${MK_INET_SUPPORT} != "no"
513_pfsync=	pfsync
514.endif
515.endif
516
517.if ${MK_SOURCELESS_UCODE} != "no"
518_bce=		bce
519_fxp=		fxp
520_ispfw=		ispfw
521_ti=		ti
522
523.if ${MACHINE_CPUARCH} != "mips"
524_mwlfw=		mwlfw
525_otusfw=	otusfw
526_ralfw=		ralfw
527_rtwnfw=	rtwnfw
528.endif
529.endif
530
531.if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \
532	${MACHINE_CPUARCH} != "mips" && \
533	${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
534	${MACHINE_CPUARCH} != "riscv"
535_cxgbe=		cxgbe
536.endif
537
538# These rely on 64bit atomics
539.if ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \
540	${MACHINE_CPUARCH} != "mips"
541_mps=		mps
542_mpr=		mpr
543.endif
544
545.if ${MK_TESTS} != "no" || defined(ALL_MODULES)
546SUBDIR+=	tests
547.endif
548
549.if ${MK_ZFS} != "no" || defined(ALL_MODULES)
550SUBDIR+=	zfs
551.endif
552
553.if (${MACHINE_CPUARCH} == "mips" && ${MACHINE_ARCH:Mmips64} == "")
554_hwpmc_mips24k=	hwpmc_mips24k
555_hwpmc_mips74k=	hwpmc_mips74k
556.endif
557
558.if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \
559	${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \
560	${MACHINE_CPUARCH} != "riscv"
561_syscons=	syscons
562_vpo=		vpo
563.endif
564
565.if ${MACHINE_CPUARCH} != "mips"
566# no BUS_SPACE_UNSPECIFIED
567# No barrier instruction support (specific to this driver)
568_sym=		sym
569# intr_disable() is a macro, causes problems
570.if ${MK_SOURCELESS_UCODE} != "no"
571_cxgb=		cxgb
572.endif
573.endif
574
575.if ${MACHINE_CPUARCH} == "aarch64"
576_allwinner=	allwinner
577_armv8crypto=	armv8crypto
578_efirt=		efirt
579_em=		em
580_rockchip=	rockchip
581.endif
582
583.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
584_agp=		agp
585_an=		an
586_aout=		aout
587_bios=		bios
588_bktr=		bktr
589.if ${MK_SOURCELESS_UCODE} != "no"
590_bxe=		bxe
591.endif
592_cardbus=	cardbus
593_cbb=		cbb
594_cpuctl=	cpuctl
595_cpufreq=	cpufreq
596_dpms=		dpms
597_em=		em
598_et=		et
599_exca=		exca
600_if_ndis=	if_ndis
601_io=		io
602_itwd=		itwd
603_ix=		ix
604_ixv=		ixv
605.if ${MK_SOURCELESS_UCODE} != "no"
606_lio=		lio
607.endif
608_nctgpio=	nctgpio
609_ndis=		ndis
610_ntb=		ntb
611_ocs_fc=	ocs_fc
612_pccard=	pccard
613.if ${MK_OFED} != "no" || defined(ALL_MODULES)
614_rdma=		rdma
615.endif
616_safe=		safe
617_speaker=	speaker
618_splash=	splash
619_sppp=		sppp
620_vmware=	vmware
621_wbwd=		wbwd
622_wi=		wi
623
624_aac=		aac
625_aacraid=	aacraid
626_acpi=		acpi
627.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
628.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} > 40201
629_aesni=		aesni
630.endif
631.endif
632_amd_ecc_inject=amd_ecc_inject
633_amdsbwd=	amdsbwd
634_amdsmn=	amdsmn
635_amdtemp=	amdtemp
636_arcmsr=	arcmsr
637_asmc=		asmc
638.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
639_blake2=	blake2
640.endif
641_bytgpio=	bytgpio
642_chvgpio=	chvgpio
643_ciss=		ciss
644_chromebook_platform=	chromebook_platform
645_cmx=		cmx
646_coretemp=	coretemp
647.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
648_hpt27xx=	hpt27xx
649.endif
650_hptiop=	hptiop
651.if ${MK_SOURCELESS_HOST} != "no" && empty(KCSAN_ENABLED)
652_hptmv=		hptmv
653_hptnr=		hptnr
654_hptrr=		hptrr
655.endif
656_hyperv=	hyperv
657_ichwd=		ichwd
658_ida=		ida
659_iir=		iir
660_intelspi=	intelspi
661_ipmi=		ipmi
662_ips=		ips
663_isci=		isci
664_ipw=		ipw
665_iwi=		iwi
666_iwm=		iwm
667_iwn=		iwn
668.if ${MK_SOURCELESS_UCODE} != "no"
669_ipwfw=		ipwfw
670_iwifw=		iwifw
671_iwmfw=		iwmfw
672_iwnfw=		iwnfw
673.endif
674_mly=		mly
675_nfe=		nfe
676_nvd=		nvd
677_nvme=		nvme
678_nvram=		nvram
679.if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
680_padlock=	padlock
681_padlock_rng=	padlock_rng
682_rdrand_rng=	rdrand_rng
683.endif
684_s3=		s3
685_sdhci_acpi=	sdhci_acpi
686_superio=	superio
687_tpm=		tpm
688_twa=		twa
689_vesa=		vesa
690_viawd=		viawd
691_virtio=	virtio
692_wpi=		wpi
693.if ${MK_SOURCELESS_UCODE} != "no"
694_wpifw=		wpifw
695.endif
696_x86bios=	x86bios
697.endif
698
699.if ${MACHINE_CPUARCH} == "amd64"
700_amdgpio=	amdgpio
701_ccp=		ccp
702_efirt=		efirt
703_iavf=		iavf
704_ioat=		ioat
705_ixl=		ixl
706_nvdimm=	nvdimm
707_pms=		pms
708_qlxge=		qlxge
709_qlxgb=		qlxgb
710_vmd=		vmd
711.if ${MK_SOURCELESS_UCODE} != "no"
712_qlxgbe=	qlxgbe
713_qlnx=		qlnx
714.endif
715_sfxge=		sfxge
716_sgx=		sgx
717_sgx_linux=	sgx_linux
718_smartpqi=	smartpqi
719
720.if ${MK_BHYVE} != "no" || defined(ALL_MODULES)
721_vmm=		vmm
722.endif
723.endif
724
725.if ${MACHINE_CPUARCH} == "i386"
726# XXX some of these can move to the general case when de-i386'ed
727# XXX some of these can move now, but are untested on other architectures.
728_3dfx=		3dfx
729_3dfx_linux=	3dfx_linux
730_apm=		apm
731.if ${MK_SOURCELESS_UCODE} != "no"
732_ce=		ce
733.endif
734.if ${MK_SOURCELESS_UCODE} != "no"
735_cp=		cp
736.endif
737_glxiic=	glxiic
738_glxsb=		glxsb
739_pcfclock=	pcfclock
740_pst=		pst
741_sbni=		sbni
742.if ${MK_SOURCELESS_UCODE} != "no"
743_ctau=		ctau
744.endif
745.endif
746
747.if ${MACHINE_CPUARCH} == "arm"
748_cfi=		cfi
749_cpsw=		cpsw
750.endif
751
752.if ${MACHINE_CPUARCH} == "powerpc"
753_agp=		agp
754_an=		an
755_cardbus=	cardbus
756_cbb=		cbb
757_cfi=		cfi
758_cpufreq=	cpufreq
759_exca=		exca
760_ffec=		ffec
761_nvd=		nvd
762_nvme=		nvme
763_pccard=	pccard
764_wi=		wi
765.endif
766
767.if ${MACHINE_ARCH} == "powerpc64"
768_ipmi=		ipmi
769_nvram=		opal_nvram
770.endif
771.if ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc"
772# Don't build powermac_nvram for powerpcspe, it's never supported.
773_nvram+=	powermac_nvram
774.endif
775
776.if ${MACHINE_CPUARCH} == "sparc64"
777_auxio=		auxio
778_em=		em
779_epic=		epic
780.endif
781
782.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
783     ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "i386")
784_cloudabi32=	cloudabi32
785.endif
786.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64"
787_cloudabi64=	cloudabi64
788.endif
789
790.endif
791
792.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64"
793_bcm283x_clkman=  bcm283x_clkman
794_bcm283x_pwm=  bcm283x_pwm
795.endif
796
797SUBDIR+=${MODULES_EXTRA}
798
799.for reject in ${WITHOUT_MODULES}
800SUBDIR:= ${SUBDIR:N${reject}}
801.endfor
802
803# Calling kldxref(8) for each module is expensive.
804.if !defined(NO_XREF)
805.MAKEFLAGS+=	-DNO_XREF
806afterinstall: .PHONY
807	@if type kldxref >/dev/null 2>&1; then \
808		${ECHO} ${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
809		${KLDXREF_CMD} ${DESTDIR}${KMODDIR}; \
810	fi
811.endif
812
813.include "${SYSDIR}/conf/config.mk"
814
815SUBDIR:= ${SUBDIR:u:O}
816
817.include <bsd.subdir.mk>
818