xref: /linux/scripts/Makefile (revision fd8c09ad0d87783b9b6a27900d66293be45b7bad)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds###
31da177e4SLinus Torvalds# scripts contains sources for various helper programs used throughout
41da177e4SLinus Torvalds# the kernel for the build process.
56520fe55SH. Peter Anvin
6faabed29SMasahiro Yamadahostprogs-always-$(CONFIG_KALLSYMS)			+= kallsyms
7faabed29SMasahiro Yamadahostprogs-always-$(BUILD_C_RECORDMCOUNT)		+= recordmcount
8faabed29SMasahiro Yamadahostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT)		+= sorttable
9faabed29SMasahiro Yamadahostprogs-always-$(CONFIG_ASN1)				+= asn1_compiler
10faabed29SMasahiro Yamadahostprogs-always-$(CONFIG_MODULE_SIG_FORMAT)		+= sign-file
11faabed29SMasahiro Yamadahostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE)	+= insert-sys-cert
12a66d733dSMiguel Ojedahostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_builder
13a66d733dSMiguel Ojedahostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_gen
142f7ab126SMiguel Ojeda
15ab0f4cedSDavid Gowifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
16f82811e2SJamie Cunliffealways-$(CONFIG_RUST)					+= target.json
17c83b16ceSMasahiro Yamadafilechk_rust_target = $< < include/config/auto.conf
18c83b16ceSMasahiro Yamada
19c83b16ceSMasahiro Yamada$(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
20c83b16ceSMasahiro Yamada	$(call filechk,rust_target)
21f82811e2SJamie Cunliffeendif
22c83b16ceSMasahiro Yamada
23c83b16ceSMasahiro Yamadahostprogs += generate_rust_target
242f7ab126SMiguel Ojedagenerate_rust_target-rust := y
25a66d733dSMiguel Ojedarustdoc_test_builder-rust := y
26a66d733dSMiguel Ojedarustdoc_test_gen-rust := y
271da177e4SLinus Torvalds
2810916706SShile ZhangHOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
2972b3942aSYinan LiuHOSTLDLIBS_sorttable = -lpthread
304520c6a4SDavid HowellsHOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
31d5ea4fecSChun-Tse ShaoHOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
32d5ea4fecSChun-Tse ShaoHOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
331da177e4SLinus Torvalds
3457fa1899SShile Zhangifdef CONFIG_UNWINDER_ORC
3557fa1899SShile Zhangifeq ($(ARCH),x86_64)
36cb8a2ef0STiezhu YangSRCARCH := x86
3757fa1899SShile Zhangendif
38cb8a2ef0STiezhu Yangifeq ($(ARCH),loongarch)
39cb8a2ef0STiezhu YangSRCARCH := loongarch
40cb8a2ef0STiezhu Yangendif
41cb8a2ef0STiezhu YangHOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/$(SRCARCH)/include
4257fa1899SShile ZhangHOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
4372b3942aSYinan Liuendif
4472b3942aSYinan Liu
454ed308c4SSteven Rostedt (Google)ifdef CONFIG_BUILDTIME_MCOUNT_SORT
4672b3942aSYinan LiuHOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
4757fa1899SShile Zhangendif
4857fa1899SShile Zhang
495f2fb52fSMasahiro Yamada# The following programs are only built on demand
5041d7ea30SVladimir Olteanhostprogs += unifdef gen_packed_field_checks
5107aea3a7SSam Ravnborg
52596b0474SMasahiro Yamada# The module linker script is preprocessed on demand
53596b0474SMasahiro Yamadatargets += module.lds
54596b0474SMasahiro Yamada
55ce2fd53aSMasahiro Yamadasubdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
56*9c3681f9SSami Tolvanensubdir-$(CONFIG_GENKSYMS) += genksyms
57f2856884SSami Tolvanensubdir-$(CONFIG_GENDWARFKSYMS) += gendwarfksyms
5893c06cbbSSerge E. Hallynsubdir-$(CONFIG_SECURITY_SELINUX) += selinux
59ba199dc9SDeven Bowerssubdir-$(CONFIG_SECURITY_IPE) += ipe
601da177e4SLinus Torvalds
611da177e4SLinus Torvalds# Let clean descend into subdirs
6246a63d4bSMasahiro Yamadasubdir-	+= basic dtc gdb kconfig mod
63