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