linux-tools.mk 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ################################################################################
  2. #
  3. # linux-tools
  4. #
  5. ################################################################################
  6. # Vampirising sources from the kernel tree, so no source nor site specified.
  7. # Instead, we directly build in the sources of the linux package. We can do
  8. # that, because we're not building in the same location and the same files.
  9. #
  10. # So, all tools refer to $(LINUX_DIR) instead of $(@D).
  11. # Note: we need individual tools makefiles to be included *before* we build
  12. # the list of build and install hooks below to guarantee that each tool has
  13. # a chance to register itself once, and only once. Therefore, the makefiles
  14. # are named linux-tool-*.mk.in, so they won't be picked up by the top-level
  15. # Makefile, but can be included here, guaranteeing the single inclusion and
  16. # the proper ordering.
  17. include $(sort $(wildcard package/linux-tools/*.mk.in))
  18. # We only need the kernel to be extracted, not actually built
  19. LINUX_TOOLS_PATCH_DEPENDENCIES = linux
  20. # Install Linux kernel tools in the staging directory since some tools
  21. # may install shared libraries and headers (e.g. cpupower).
  22. LINUX_TOOLS_INSTALL_STAGING = YES
  23. LINUX_TOOLS_DEPENDENCIES += $(foreach tool,$(LINUX_TOOLS),\
  24. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  25. $($(call UPPERCASE,$(tool))_DEPENDENCIES)))
  26. LINUX_TOOLS_POST_BUILD_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
  27. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  28. $(call UPPERCASE,$(tool))_BUILD_CMDS))
  29. LINUX_TOOLS_POST_INSTALL_STAGING_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
  30. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  31. $(call UPPERCASE,$(tool))_INSTALL_STAGING_CMDS))
  32. LINUX_TOOLS_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
  33. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  34. $(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))
  35. define LINUX_TOOLS_LINUX_CONFIG_FIXUPS
  36. $(foreach tool,$(LINUX_TOOLS),\
  37. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  38. $($(call UPPERCASE,$(tool))_LINUX_CONFIG_FIXUPS))
  39. )
  40. endef
  41. define LINUX_TOOLS_INSTALL_INIT_SYSTEMD
  42. $(foreach tool,$(LINUX_TOOLS),\
  43. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  44. $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSTEMD))
  45. )
  46. endef
  47. define LINUX_TOOLS_INSTALL_INIT_SYSV
  48. $(foreach tool,$(LINUX_TOOLS),\
  49. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  50. $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV))
  51. )
  52. endef
  53. define LINUX_TOOLS_INSTALL_INIT_OPENRC
  54. $(foreach tool,$(LINUX_TOOLS),\
  55. $(if $(BR2_PACKAGE_LINUX_TOOLS_$(call UPPERCASE,$(tool))),\
  56. $(or $($(call UPPERCASE,$(tool))_INSTALL_INIT_OPENRC),\
  57. $($(call UPPERCASE,$(tool))_INSTALL_INIT_SYSV)))
  58. )
  59. endef
  60. $(eval $(generic-package))