From 29985d877e13f88dfee40ce45fdfb983023f32a5 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 21 Oct 2004 08:13:34 +0000 Subject: [PATCH] Don't duplicate flags when two version of 'darwin' or 'intel-linux' are configured. * tools/gcc.jam (init-link-flags): New parameter 'toolset'. * tools/darwin.jam (init): Move flags inheriting out of here * tools/intel-linux.jam (init): Likewise. [SVN r25817] --- v2/tools/darwin.jam | 11 +++-------- v2/tools/gcc.jam | 34 ++++++++++++++++++++++++---------- v2/tools/intel-linux.jam | 7 ++++--- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index 366160f9d..b4cdf6bda 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -16,6 +16,7 @@ toolset.register darwin ; import gcc ; toolset.inherit-generators darwin : gcc ; toolset.inherit-rules darwin : gcc ; +toolset.inherit-flags darwin : gcc ; # No additional initialization should be necessary rule init ( version ? : command * : options * ) @@ -24,14 +25,8 @@ rule init ( version ? : command * : options * ) local command = [ common.get-invocation-command darwin : g++ : $(command) ] ; common.handle-options darwin : $(condition) : $(command) : $(options) ; - - # we can't pass -s to ld unless we also pass -static - # so we removed -s completly from OPTIONS and add it - # to ST_OPTIONS - gcc.init-link-flags gnu $(condition) ; - toolset.inherit-flags darwin : gcc : $(condition)/off ; - flags darwin.link ST_OPTIONS off : -s ; - + + gcc.init-link-flags darwin darwin $(condition) ; } # Darwin has a different shared library suffix diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index d10ebc3af..0593bdcf2 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -53,7 +53,7 @@ rule init ( version ? : command * : options * ) if ! $(linker) { linker = gnu ; } - init-link-flags $(linker) $(condition) ; + init-link-flags gcc $(linker) $(condition) ; } if [ os.name ] = NT @@ -198,7 +198,7 @@ flags gcc.link OPTIONS static : -static ; # Now, the vendor specific flags # The parameter linker can be either gnu or sun -rule init-link-flags ( linker condition ) +rule init-link-flags ( toolset linker condition ) { switch $(linker) { @@ -208,17 +208,30 @@ rule init-link-flags ( linker condition ) # We use --strip-all flag as opposed to -s since icc # (intel's compiler) is generally option-compatible with # and inherits from gcc toolset, but does not support -s - flags gcc.link OPTIONS $(condition)/off : -Wl,--strip-all ; - flags gcc.link RPATH $(condition) : ; - flags gcc.link RPATH_LINK $(condition) : ; + flags $(toolset).link OPTIONS $(condition)/off : -Wl,--strip-all + : unchecked ; + flags $(toolset).link RPATH $(condition) : : unchecked ; + flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; } + case darwin : + { + # we can't pass -s to ld unless we also pass -static + # so we removed -s completly from OPTIONS and add it + # to ST_OPTIONS + flags $(toolset).link ST_OPTIONS $(condition)/off : -s + : unchecked ; + flags $(toolset).link RPATH $(condition) : : unchecked ; + flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; + } + case sun : { - flags gcc.link OPTIONS $(condition)/off : -Wl,-s ; - flags gcc.link RPATH $(condition) : ; + flags $(toolset).link OPTIONS $(condition)/off : -Wl,-s + : unchecked ; + flags $(toolset).link RPATH $(condition) : : unchecked ; # Solaris linker does not have a separate -rpath-link, but # allows to use -L for the same purpose. - flags gcc.link LINKPATH $(condition) : ; + flags $(toolset).link LINKPATH $(condition) : : unchecked ; # This permits shared libraries with non-PIC code on Solaris # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, @@ -226,12 +239,13 @@ rule init-link-flags ( linker condition ) # is a separate question. # AH, 2004/10/16: it is still necessary because some tests link # against static libraries that were compiled without PIC. - flags gcc.link OPTIONS $(condition)/shared : -mimpure-text ; + flags $(toolset).link OPTIONS $(condition)/shared : -mimpure-text + : unchecked ; } case * : { errors.user-error - "gcc initialization: invalid linker '$(linker)'" : + "$(toolset) initialization: invalid linker '$(linker)'" : "The value '$(linker)' specified for is not recognized." : "Possible values are 'sun', 'gnu'" ; } diff --git a/v2/tools/intel-linux.jam b/v2/tools/intel-linux.jam index c24a0c068..d9a7e0519 100644 --- a/v2/tools/intel-linux.jam +++ b/v2/tools/intel-linux.jam @@ -18,6 +18,8 @@ feature.extend-subfeature toolset intel : platform : linux ; toolset.inherit-generators intel-linux intel linux : gcc ; toolset.inherit-rules intel-linux : gcc ; +toolset.inherit-flags intel-linux : gcc + : off on full space ; # Initializes the intel-linux toolset # version in mandatory @@ -33,9 +35,8 @@ rule init ( version ? : command * : options * ) common.handle-options intel-linux : $(condition) : $(command) : $(options) ; - gcc.init-link-flags gnu $(condition) ; - toolset.inherit-flags intel-linux : gcc - : off on full space ; + gcc.init-link-flags intel-linux gnu $(condition) ; + } flags intel-linux.compile OPTIONS off : "-Ob0" ;