Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # SPDX-License-Identifier: GPL-2.0
  2. ###
  3. # scripts contains sources for various helper programs used throughout
  4. # the kernel for the build process.
  5. hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
  6. hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount
  7. hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable
  8. hostprogs-always-$(CONFIG_ASN1) += asn1_compiler
  9. hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file
  10. hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
  11. hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_builder
  12. hostprogs-always-$(CONFIG_RUST_KERNEL_DOCTESTS) += rustdoc_test_gen
  13. ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
  14. always-$(CONFIG_RUST) += target.json
  15. filechk_rust_target = $< < include/config/auto.conf
  16. $(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
  17. $(call filechk,rust_target)
  18. endif
  19. hostprogs += generate_rust_target
  20. generate_rust_target-rust := y
  21. rustdoc_test_builder-rust := y
  22. rustdoc_test_gen-rust := y
  23. HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
  24. HOSTLDLIBS_sorttable = -lpthread
  25. HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
  26. HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
  27. HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
  28. ifdef CONFIG_UNWINDER_ORC
  29. ifeq ($(ARCH),x86_64)
  30. SRCARCH := x86
  31. endif
  32. ifeq ($(ARCH),loongarch)
  33. SRCARCH := loongarch
  34. endif
  35. HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/$(SRCARCH)/include
  36. HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
  37. endif
  38. ifdef CONFIG_BUILDTIME_MCOUNT_SORT
  39. HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
  40. endif
  41. # The following programs are only built on demand
  42. hostprogs += unifdef
  43. # The module linker script is preprocessed on demand
  44. targets += module.lds
  45. subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
  46. subdir-$(CONFIG_MODVERSIONS) += genksyms
  47. subdir-$(CONFIG_SECURITY_SELINUX) += selinux
  48. subdir-$(CONFIG_SECURITY_IPE) += ipe
  49. # Let clean descend into subdirs
  50. subdir- += basic dtc gdb kconfig mod