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