summaryrefslogtreecommitdiff
path: root/scripts/mk/vendor.mk
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mk/vendor.mk')
-rw-r--r--scripts/mk/vendor.mk18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
new file mode 100644
index 0000000..aa75cd6
--- /dev/null
+++ b/scripts/mk/vendor.mk
@@ -0,0 +1,18 @@
+# Makefile snippet defining the following vendor-related variables:
+#
+# DEB_VENDOR: output of dpkg-vendor --query Vendor
+# DEB_PARENT_VENDOR: output of dpkg-vendor --query Parent (can be empty)
+#
+# The snippet also defines a macro "dpkg_vendor_derives_from" that you can
+# use to verify if the current vendor derives from another vendor with a
+# simple test like this one:
+# ifeq ($(call dpkg_vendor_derives_from ubuntu),yes)
+# ...
+# endif
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+DEB_VENDOR = $(call dpkg_late_eval,DEB_VENDOR,dpkg-vendor --query Vendor)
+DEB_PARENT_VENDOR = $(call dpkg_late_eval,DEB_PARENT_VENDOR,dpkg-vendor --query Parent)
+
+dpkg_vendor_derives_from = dpkg-vendor --derives-from $(1) && echo yes || echo no