blob: b082d2f9335746211a8c58da6afe9b91dc6178a6 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002###
3# scripts contains sources for various helper programs used throughout
4# the kernel for the build process.
H. Peter Anvin6520fe52012-05-08 21:22:24 +03005
Rolf Eike Beer2cea4a72018-11-22 16:40:49 +01006CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
7CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
8
Masahiro Yamadafaabed22020-08-01 21:27:18 +09009hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c
10hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
11hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
12hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
13hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
14hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
15hostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert
16hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
Eric Snowbergd1f04412021-01-22 13:10:53 -050017hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Shile Zhang10916702019-12-04 08:46:31 +080019HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
Yinan Liu72b39422021-12-12 19:33:58 +080020HOSTLDLIBS_sorttable = -lpthread
David Howells4520c6a2012-09-21 23:31:13 +010021HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
Rolf Eike Beerfe968c42021-02-12 08:22:27 +010022HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
Rolf Eike Beer2cea4a72018-11-22 16:40:49 +010023HOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
24HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
25HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Shile Zhang57fa1892019-12-04 08:46:32 +080027ifdef CONFIG_UNWINDER_ORC
28ifeq ($(ARCH),x86_64)
29ARCH := x86
30endif
31HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include
32HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
Yinan Liu72b39422021-12-12 19:33:58 +080033endif
34
35ifdef CONFIG_DYNAMIC_FTRACE
36HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
Shile Zhang57fa1892019-12-04 08:46:32 +080037endif
38
Masahiro Yamada5f2fb522020-02-02 01:49:24 +090039# The following programs are only built on demand
40hostprogs += unifdef
Sam Ravnborg07aea3a2006-07-23 20:47:50 +020041
Masahiro Yamada596b0472020-09-08 13:27:08 +090042# The module linker script is preprocessed on demand
43targets += module.lds
44
Masahiro Yamadace2fd53a2018-11-29 12:56:31 +090045subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
Linus Torvalds1da177e2005-04-16 15:20:36 -070046subdir-$(CONFIG_MODVERSIONS) += genksyms
Serge E. Hallyn93c06cb2008-08-26 14:47:57 -050047subdir-$(CONFIG_SECURITY_SELINUX) += selinux
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49# Let clean descend into subdirs
Masahiro Yamada46a63d42019-08-21 16:02:02 +090050subdir- += basic dtc gdb kconfig mod