From de799f73c059c6ea5ac62a4545e244c38f70c99b Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 5 Aug 2013 06:37:56 +0200 Subject: [PATCH] MultiArch* rule: support optional architecture parameter --- build/jam/ArchitectureRules | 47 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules index 29282c246f..9bce49cfd1 100644 --- a/build/jam/ArchitectureRules +++ b/build/jam/ArchitectureRules @@ -649,15 +649,17 @@ rule ArchitectureSetupWarnings architecture } -rule MultiArchIfPrimary ifValue : elseValue +rule MultiArchIfPrimary ifValue : elseValue : architecture { - # MultiArchIfPrimary : ; + # MultiArchIfPrimary : + # [ : = $(TARGET_PACKAGING_ARCH) ] ; # # Returns one of the two given values depending on whether - # TARGET_PACKAGING_ARCH is currently set to the primary packaging - # architecture. + # is the primary packaging architecture. - if $(TARGET_PACKAGING_ARCH) = $(TARGET_PACKAGING_ARCHS[1]) { + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) { return $(ifValue) ; } return $(elseValue) ; @@ -665,37 +667,44 @@ rule MultiArchIfPrimary ifValue : elseValue rule MultiArchConditionalGristFiles files : primaryGrist : secondaryGrist + : architecture { # MultiArchConditionalGristFiles : - # : ; + # : [ : = $(TARGET_PACKAGING_ARCH) ] ; # # Returns with their grist set to either or - # depending on whether TARGET_PACKAGING_ARCH is currently - # set to the primary packaging architecture. + # depending on whether is the primary + # packaging architecture. - local grist = [ MultiArchIfPrimary $(primaryGrist) : $(secondaryGrist) ] ; + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + local grist = [ MultiArchIfPrimary $(primaryGrist) : $(secondaryGrist) + : $(architecture) ] ; return $(files:G=$(grist:E=)) ; } -rule MultiArchDefaultGristFiles files : gristPrefix +rule MultiArchDefaultGristFiles files : gristPrefix : architecture { - # MultiArchDefaultGristFiles : ; + # MultiArchDefaultGristFiles : + # [ : = $(TARGET_PACKAGING_ARCH) ] ; # # Convenient shorthand for MultiArchConditionalGristFiles for the common # case that for a secondary packaging architecture the packaging # architecture name shall be appended to the grist while it shall be omitted - # for the primary packaging architecture. IOW, if TARGET_PACKAGING_ARCH is - # currently set to the primary packaging architecture are returned - # with their grist set to , otherwise are returned with - # their grist set to ! ( being the name of the - # packaging architecture) respectively (if is empty). + # for the primary packaging architecture. IOW, if architecture is the + # primary packaging architecture, are returned with their grist set + # to , otherwise are returned with their grist set to + # ! respectively (if + # is empty). - local secondaryGrist = $(gristPrefix)!$(TARGET_PACKAGING_ARCH) ; - secondaryGrist ?= $(TARGET_PACKAGING_ARCH) ; + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + local secondaryGrist = $(gristPrefix)!$(architecture) ; + secondaryGrist ?= $(architecture) ; return [ MultiArchConditionalGristFiles $(files) : $(gristPrefix) : - $(secondaryGrist) ] ; + $(secondaryGrist) : $(architecture) ] ; }