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