xref: /openbmc/linux/scripts/Makefile (revision a66d733d)
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
12*a66d733dSMiguel Ojedahostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_builder
13*a66d733dSMiguel Ojedahostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS)		+= rustdoc_test_gen
14c83b16ceSMasahiro Yamadaalways-$(CONFIG_RUST)					+= target.json
152f7ab126SMiguel Ojeda
16c83b16ceSMasahiro Yamadafilechk_rust_target = $< < include/config/auto.conf
17c83b16ceSMasahiro Yamada
18c83b16ceSMasahiro Yamada$(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
19c83b16ceSMasahiro Yamada	$(call filechk,rust_target)
20c83b16ceSMasahiro Yamada
21c83b16ceSMasahiro Yamadahostprogs += generate_rust_target
222f7ab126SMiguel Ojedagenerate_rust_target-rust := y
23*a66d733dSMiguel Ojedarustdoc_test_builder-rust := y
24*a66d733dSMiguel Ojedarustdoc_test_gen-rust := y
251da177e4SLinus Torvalds
2610916706SShile ZhangHOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
2772b3942aSYinan LiuHOSTLDLIBS_sorttable = -lpthread
284520c6a4SDavid HowellsHOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
29d5ea4fecSChun-Tse ShaoHOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
30d5ea4fecSChun-Tse ShaoHOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
311da177e4SLinus Torvalds
3257fa1899SShile Zhangifdef CONFIG_UNWINDER_ORC
3357fa1899SShile Zhangifeq ($(ARCH),x86_64)
3457fa1899SShile ZhangARCH := x86
3557fa1899SShile Zhangendif
3657fa1899SShile ZhangHOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include
3757fa1899SShile ZhangHOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
3872b3942aSYinan Liuendif
3972b3942aSYinan Liu
404ed308c4SSteven Rostedt (Google)ifdef CONFIG_BUILDTIME_MCOUNT_SORT
4172b3942aSYinan LiuHOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
4257fa1899SShile Zhangendif
4357fa1899SShile Zhang
445f2fb52fSMasahiro Yamada# The following programs are only built on demand
4505e96e96SMasahiro Yamadahostprogs += unifdef
4607aea3a7SSam Ravnborg
47596b0474SMasahiro Yamada# The module linker script is preprocessed on demand
48596b0474SMasahiro Yamadatargets += module.lds
49596b0474SMasahiro Yamada
50ce2fd53aSMasahiro Yamadasubdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
511da177e4SLinus Torvaldssubdir-$(CONFIG_MODVERSIONS) += genksyms
5293c06cbbSSerge E. Hallynsubdir-$(CONFIG_SECURITY_SELINUX) += selinux
531da177e4SLinus Torvalds
541da177e4SLinus Torvalds# Let clean descend into subdirs
5546a63d4bSMasahiro Yamadasubdir-	+= basic dtc gdb kconfig mod
56