summaryrefslogtreecommitdiff
path: root/package/Makefile.package.in
diff options
context:
space:
mode:
Diffstat (limited to 'package/Makefile.package.in')
-rw-r--r--package/Makefile.package.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/package/Makefile.package.in b/package/Makefile.package.in
index 5987d3823..afa8d0e9f 100644
--- a/package/Makefile.package.in
+++ b/package/Makefile.package.in
@@ -55,6 +55,24 @@ define KCONFIG_DISABLE_OPT
echo "# $(1) is not set" >> $(2)
endef
+# Helper functions to determine the name of a package and its
+# directory from its makefile directory, using the $(MAKEFILE_LIST)
+# variable provided by make. This is used by the *TARGETS macros to
+# automagically find where the package is located. Note that the
+# pkgdir macro is carefully written to handle the case of the Linux
+# package, for which the package directory is an empty string.
+define pkgdir
+$(dir $(lastword $(MAKEFILE_LIST)))
+endef
+
+define pkgname
+$(lastword $(subst /, ,$(call pkgdir)))
+endef
+
+define pkgparentdir
+$(patsubst %$(call pkgname)/,%,$(call pkgdir))
+endef
+
# Define extractors for different archive suffixes
INFLATE.bz2 = $(BZCAT)
INFLATE.gz = $(ZCAT)