18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci###
38c2ecf20Sopenharmony_ci# scripts contains sources for various helper programs used throughout
48c2ecf20Sopenharmony_ci# the kernel for the build process.
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciCRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto)
78c2ecf20Sopenharmony_ciCRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null)
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_BUILD_BIN2C)			+= bin2c
108c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_KALLSYMS)			+= kallsyms
118c2ecf20Sopenharmony_cihostprogs-always-$(BUILD_C_RECORDMCOUNT)		+= recordmcount
128c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT)		+= sorttable
138c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_ASN1)				+= asn1_compiler
148c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_MODULE_SIG_FORMAT)		+= sign-file
158c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING)	+= extract-cert
168c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE)	+= insert-sys-cert
178c2ecf20Sopenharmony_cihostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST)	+= extract-cert
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciHOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
208c2ecf20Sopenharmony_ciHOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
218c2ecf20Sopenharmony_ciHOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS)
228c2ecf20Sopenharmony_ciHOSTLDLIBS_sign-file = $(CRYPTO_LIBS)
238c2ecf20Sopenharmony_ciHOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS)
248c2ecf20Sopenharmony_ciHOSTLDLIBS_extract-cert = $(CRYPTO_LIBS)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciifdef CONFIG_UNWINDER_ORC
278c2ecf20Sopenharmony_ci# Additional ARCH settings for x86
288c2ecf20Sopenharmony_ciifeq ($(ARCH),x86_64)
298c2ecf20Sopenharmony_ciARCH := x86
308c2ecf20Sopenharmony_ciendif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci# Additional ARCH settings for loongarch
338c2ecf20Sopenharmony_ciifeq ($(ARCH),loongarch64)
348c2ecf20Sopenharmony_ciARCH := loongarch
358c2ecf20Sopenharmony_ciendif
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciHOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/$(ARCH)/include
388c2ecf20Sopenharmony_ciHOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
398c2ecf20Sopenharmony_ciHOSTLDLIBS_sorttable = -lpthread
408c2ecf20Sopenharmony_ciendif
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci# The following programs are only built on demand
438c2ecf20Sopenharmony_cihostprogs += unifdef
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci# The module linker script is preprocessed on demand
468c2ecf20Sopenharmony_citargets += module.lds
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cisubdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
498c2ecf20Sopenharmony_cisubdir-$(CONFIG_MODVERSIONS) += genksyms
508c2ecf20Sopenharmony_cisubdir-$(CONFIG_SECURITY_SELINUX) += selinux
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci# Let clean descend into subdirs
538c2ecf20Sopenharmony_cisubdir-	+= basic dtc gdb kconfig mod
54