Makefile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. hostprogs-always-$(CONFIG_TRACEPOINTS) += tracepoint-update
  14. sorttable-objs := sorttable.o elf-parse.o
  15. tracepoint-update-objs := tracepoint-update.o elf-parse.o
  16. ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),)
  17. always-$(CONFIG_RUST) += target.json
  18. filechk_rust_target = $< < include/config/auto.conf
  19. $(obj)/target.json: scripts/generate_rust_target include/config/auto.conf FORCE
  20. $(call filechk,rust_target)
  21. endif
  22. hostprogs += generate_rust_target
  23. generate_rust_target-rust := y
  24. rustdoc_test_builder-rust := y
  25. rustdoc_test_gen-rust := y
  26. HOSTCFLAGS_tracepoint-update.o = -I$(srctree)/tools/include
  27. HOSTCFLAGS_elf-parse.o = -I$(srctree)/tools/include
  28. HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
  29. HOSTLDLIBS_sorttable = -lpthread
  30. HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
  31. HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
  32. HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
  33. ifdef CONFIG_UNWINDER_ORC
  34. ifeq ($(ARCH),x86_64)
  35. SRCARCH := x86
  36. endif
  37. ifeq ($(ARCH),loongarch)
  38. SRCARCH := loongarch
  39. endif
  40. HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/$(SRCARCH)/include
  41. HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
  42. endif
  43. ifdef CONFIG_BUILDTIME_MCOUNT_SORT
  44. HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
  45. endif
  46. # The following programs are only built on demand
  47. hostprogs += unifdef gen_packed_field_checks
  48. # The module linker script is preprocessed on demand
  49. targets += module.lds
  50. subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins
  51. subdir-$(CONFIG_GENKSYMS) += genksyms
  52. subdir-$(CONFIG_GENDWARFKSYMS) += gendwarfksyms
  53. subdir-$(CONFIG_SECURITY_SELINUX) += selinux
  54. subdir-$(CONFIG_SECURITY_IPE) += ipe
  55. # Let clean descend into subdirs
  56. subdir- += basic dtc gdb kconfig mod