summaryrefslogtreecommitdiff
path: root/include/subdir.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-10-21 07:18:10 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-10-21 07:18:10 +0000
commitac40a80f35074b43039e25f8e9d8017cab1a3263 (patch)
treed3b25791cf18f517bf4237e1ba74ae311de08da8 /include/subdir.mk
parentaef9b313b10207e649778819ffa0b886fed3d447 (diff)
downloadmtk-20170518-ac40a80f35074b43039e25f8e9d8017cab1a3263.zip
mtk-20170518-ac40a80f35074b43039e25f8e9d8017cab1a3263.tar.gz
mtk-20170518-ac40a80f35074b43039e25f8e9d8017cab1a3263.tar.bz2
make aliases for package targets if the package directories are in further subdirectories example: if there is a package/libs/foo/compile, then package/foo/compile will be an alias for it
SVN-Revision: 9384
Diffstat (limited to 'include/subdir.mk')
-rw-r--r--include/subdir.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/subdir.mk b/include/subdir.mk
index 68afcc4..d62df7e 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -17,6 +17,10 @@ define subtarget
endef
+
+lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
+diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
+
# Parameters: <subdir>
define subdir
$(call warn,$(1),d,D $(1))
@@ -29,6 +33,8 @@ define subdir
# legacy targets
$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(bd)-$(target): $(1)/$(bd)/$(target))
+ # aliases
+ $(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(target): $(1)/$(bd)/$(target)))
)
)
$(foreach target,$(SUBTARGETS),$(call subtarget,$(1),$(target)))