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