summaryrefslogtreecommitdiff
path: root/scripts/mk
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mk')
-rw-r--r--scripts/mk/architecture.mk2
-rw-r--r--scripts/mk/buildtools.mk19
-rw-r--r--scripts/mk/vendor.mk38
3 files changed, 51 insertions, 8 deletions
diff --git a/scripts/mk/architecture.mk b/scripts/mk/architecture.mk
index 8520c5b2a..0af96019d 100644
--- a/scripts/mk/architecture.mk
+++ b/scripts/mk/architecture.mk
@@ -4,7 +4,7 @@
dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)))
-dpkg_architecture_setvar = $(1) ?= $(call dpkg_lazy_eval,$(1),dpkg-architecture -q$(1))
+dpkg_architecture_setvar = export $(1) ?= $(call dpkg_lazy_eval,$(1),dpkg-architecture -q$(1))
$(foreach machine,BUILD HOST TARGET,\
$(foreach var,ARCH ARCH_ABI ARCH_LIBC ARCH_OS ARCH_CPU ARCH_BITS ARCH_ENDIAN GNU_CPU GNU_SYSTEM GNU_TYPE MULTIARCH,\
diff --git a/scripts/mk/buildtools.mk b/scripts/mk/buildtools.mk
index d5638f50e..cdf7734d3 100644
--- a/scripts/mk/buildtools.mk
+++ b/scripts/mk/buildtools.mk
@@ -1,5 +1,6 @@
# This Makefile snippet defines the following variables for host tools:
#
+# AS: assembler
# CPP: C preprocessor
# CC: C compiler
# CXX: C++ compiler
@@ -9,6 +10,12 @@
# F77: Fortran 77 compiler
# FC: Fortran 9x compiler
# LD: linker
+# STRIP: strip objects
+# OBJCOPY: copy objects
+# OBJDUMP: dump objects
+# NM: names lister
+# AR: archiver
+# RANLIB: archive index generator
# PKG_CONFIG: pkg-config tool
#
# All the above variables have a counterpart variable for the build tool,
@@ -25,6 +32,7 @@ include $(dpkg_datadir)/architecture.mk
# not defined or contain the make built-in defaults. On native builds if
# TOOL is defined and TOOL_FOR_BUILD is not, we fallback to use TOOL.
define dpkg_buildtool_setvar
+ifeq (,$(findstring $(3),$(DEB_BUILD_OPTIONS)))
ifeq ($(origin $(1)),default)
$(1) = $(DEB_HOST_GNU_TYPE)-$(2)
endif
@@ -37,6 +45,10 @@ $(1)_FOR_BUILD ?= $$($(1))
endif
endif
$(1)_FOR_BUILD ?= $(DEB_BUILD_GNU_TYPE)-$(2)
+else
+$(1) = :
+$(1)_FOR_BUILD = :
+endif
ifdef DPKG_EXPORT_BUILDTOOLS
export $(1)
@@ -44,6 +56,7 @@ export $(1)_FOR_BUILD
endif
endef
+$(eval $(call dpkg_buildtool_setvar,AS,as))
$(eval $(call dpkg_buildtool_setvar,CPP,gcc -E))
$(eval $(call dpkg_buildtool_setvar,CC,gcc))
$(eval $(call dpkg_buildtool_setvar,CXX,g++))
@@ -53,4 +66,10 @@ $(eval $(call dpkg_buildtool_setvar,GCJ,gcj))
$(eval $(call dpkg_buildtool_setvar,F77,f77))
$(eval $(call dpkg_buildtool_setvar,FC,f77))
$(eval $(call dpkg_buildtool_setvar,LD,ld))
+$(eval $(call dpkg_buildtool_setvar,STRIP,strip,nostrip))
+$(eval $(call dpkg_buildtool_setvar,OBJCOPY,objcopy))
+$(eval $(call dpkg_buildtool_setvar,OBJDUMP,objdump))
+$(eval $(call dpkg_buildtool_setvar,NM,nm))
+$(eval $(call dpkg_buildtool_setvar,AR,ar))
+$(eval $(call dpkg_buildtool_setvar,RANLIB,ranlib))
$(eval $(call dpkg_buildtool_setvar,PKG_CONFIG,pkg-config))
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
index aa75cd6fc..f3b1565bb 100644
--- a/scripts/mk/vendor.mk
+++ b/scripts/mk/vendor.mk
@@ -3,16 +3,40 @@
# 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
+# This Makefile snippet also defines a set "dpkg_vendor_derives_from"
+# macros that can be used to verify if the current vendor derives from
+# another vendor. The unversioned variant defaults to the v0 version if
+# undefined, which can be defined explicitly to one of the versions or the
+# versioned macros can be used directly. The following are example usages:
+#
+# - dpkg_vendor_derives_from (since dpkg 1.16.1)
+#
+# ifeq ($(shell $(call dpkg_vendor_derives_from,ubuntu)),yes)
+# ...
+# endif
+#
+# - dpkg_vendor_derives_from_v0 (since dpkg 1.19.3)
+#
+# ifeq ($(shell $(call dpkg_vendor_derives_from_v0,ubuntu)),yes)
+# ...
+# endif
+#
+# - dpkg_vendor_derives_from_v1 (since dpkg 1.19.3)
+#
+# dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v1)
+# ifeq ($(call dpkg_vendor_derives_from,ubuntu),yes)
+# ...
+# endif
+# ifeq ($(call dpkg_vendor_derives_from_v1,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
+dpkg_vendor_derives_from_v0 = dpkg-vendor --derives-from $(1) && echo yes || echo no
+dpkg_vendor_derives_from_v1 = $(shell $(dpkg_vendor_derives_from_v0))
+
+dpkg_vendor_derives_from ?= $(dpkg_vendor_derives_from_v0)