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