]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/tools/clang-darwin.jam
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / tools / build / src / tools / clang-darwin.jam
index 11f62d298b3ffd0de77d2b979422f884a57c2f4d..a2f880d13742786dd07c574fb5e40b998987bda1 100644 (file)
@@ -1,8 +1,9 @@
 # Copyright Vladimir Prus 2004.
 # Copyright Noel Belcourt 2007.
+# Copyright Nikita Kniazev 2020-2021.
 # Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt
-# or copy at http://www.boost.org/LICENSE_1_0.txt)
+# (See accompanying file LICENSE.txt
+# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
 
 import clang ;
 import feature : feature ;
@@ -19,17 +20,16 @@ feature.extend-subfeature toolset clang : platform : darwin ;
 toolset.inherit-generators clang-darwin
   <toolset>clang <toolset-clang:platform>darwin
   : gcc
-  # Don't inherit PCH generators. They were not tested, and probably
-  # don't work for this compiler.
-  : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch
+  : gcc.mingw.link gcc.mingw.link.dll
   ;
 
 generators.override clang-darwin.prebuilt : builtin.lib-generator ;
 generators.override clang-darwin.prebuilt : builtin.prebuilt ;
 generators.override clang-darwin.searched-lib-generator : searched-lib-generator ;
 
-generators.register-c-compiler clang-darwin.compile.m : OBJECTIVE_C : OBJ : <toolset>clang <toolset-clang:platform>darwin ;
-generators.register-c-compiler clang-darwin.compile.mm : OBJECTIVE_CPP : OBJ : <toolset>clang <toolset-clang:platform>darwin ;
+# Override default do-nothing generators.
+generators.override clang-darwin.compile.c.pch   : pch.default-c-pch-generator   ;
+generators.override clang-darwin.compile.c++.pch : pch.default-cpp-pch-generator ;
 
 toolset.inherit-rules clang-darwin : gcc ;
 toolset.inherit-flags clang-darwin : gcc
@@ -51,15 +51,11 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 #   compile and link options allow you to specify addition command line options for each version
 rule init ( version ? :  command * : options * )
 {
-    command = [ common.get-invocation-command clang-darwin : clang++
-        : $(command) : /usr/bin /usr/local/bin ] ;
-
-    # Determine the version
-    local command-string = $(command:J=" ") ;
-    if $(command)
-    {
-        version ?= [ MATCH "version ([0-9]+[.][0-9]+)"
-            : [ SHELL "$(command-string) --version" ] ] ;
+    command = [ common.find-compiler clang-darwin : clang++ : $(version) : $(command)
+                : /usr/bin /usr/local/bin ] ;
+    local command-string = [ common.make-command-string $(command) ] ;
+    if ! $(version) { # ?= operator does not short-circuit
+    version ?= [ get-short-version $(command-string) ] ;
     }
 
     local condition = [ common.check-init-parameters clang
@@ -68,30 +64,30 @@ rule init ( version ? :  command * : options * )
     common.handle-options clang-darwin : $(condition) : $(command) : $(options) ;
     clang.init-cxxstd-flags clang-darwin : $(condition) : $(version) ;
 
-    # - Ranlib.
-    local ranlib = [ feature.get-values <ranlib> : $(options) ] ;
-    toolset.flags clang-darwin.archive .RANLIB $(condition) : $(ranlib[1]) ;
-
     # - Archive builder.
     local archiver = [ feature.get-values <archiver> : $(options) ] ;
     toolset.flags clang-darwin.archive .AR $(condition) : $(archiver[1]) ;
 }
 
-SPACE = " " ;
+rule get-full-version ( command-string )
+{
+    import clang-linux ;
+    return [ clang-linux.get-full-version $(command-string) ] ;
+}
 
-toolset.flags clang-darwin.compile.m OPTIONS <mflags> ;
-toolset.flags clang-darwin.compile.mm OPTIONS <mflags> ;
-toolset.flags clang-darwin.compile.mm OPTIONS <mmflags> ;
+rule get-short-version ( command-string )
+{
+    import clang-linux ;
+    return [ clang-linux.get-short-version $(command-string) ] ;
+}
+
+SPACE = " " ;
 
 # Declare flags and action for compilation.
 
 # For clang, 'on' and 'full' are identical
 toolset.flags clang-darwin.compile OPTIONS <inlining>full : -Wno-inline ;
 
-# SJW 12/2017: Support for <flags> is widely inconsistent.
-# shouldn't this be handled by the common gcc?
-toolset.flags clang-darwin.compile OPTIONS <flags> ;
-
 # LTO
 toolset.flags clang-darwin.compile OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
 toolset.flags clang-darwin.link OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
@@ -106,76 +102,32 @@ toolset.flags clang-darwin.link OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libs
 toolset.flags clang-darwin.compile OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
 toolset.flags clang-darwin.link OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
 
-actions compile.c
-{
-    "$(CONFIG_COMMAND)" -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
-}
-
-actions compile.c++
-{
-    "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
-}
-
-actions compile.m
+rule compile.c ( targets * : sources * : properties * )
 {
-    "$(CONFIG_COMMAND)" -x objective-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+    DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
 }
 
-actions compile.mm
+rule compile.c++ ( targets * : sources * : properties * )
 {
-    "$(CONFIG_COMMAND)" -x objective-c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+    DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
 }
 
-# Default value. Mostly for the sake of clang-linux
-# that inherits from gcc, but does not has the same
-# logic to set the .AR variable. We can put the same
-# logic in clang-linux, but that's hardly worth the trouble
-# as on Linux, 'ar' is always available.
-.AR = ar ;
-.RANLIB = ranlib -cs ;
+.include-pch = "-include-pch " ;
 
-rule archive ( targets * : sources * : properties * )
+actions compile.c bind PCH_FILE
 {
-  # Always remove archive and start again. Here's rationale from
-  # Andre Hentz:
-  #
-  # I had a file, say a1.c, that was included into liba.a.
-  # I moved a1.c to a2.c, updated my Jamfiles and rebuilt.
-  # My program was crashing with absurd errors.
-  # After some debugging I traced it back to the fact that a1.o was *still*
-  # in liba.a
-  #
-  # Rene Rivera:
-  #
-  # Originally removing the archive was done by splicing an RM
-  # onto the archive action. That makes archives fail to build on NT
-  # when they have many files because it will no longer execute the
-  # action directly and blow the line length limit. Instead we
-  # remove the file in a different action, just before the building
-  # of the archive.
-  #
-  local clean.a = $(targets[1])(clean) ;
-  TEMPORARY $(clean.a) ;
-  NOCARE $(clean.a) ;
-  LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
-  DEPENDS $(clean.a) : $(sources) ;
-  DEPENDS $(targets) : $(clean.a) ;
-  common.RmTemps $(clean.a) : $(targets) ;
+    "$(CONFIG_COMMAND)" -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(.include-pch)"$(PCH_FILE)" -c -o "$(<)" "$(>)"
 }
 
-actions piecemeal archive
+actions compile.c++ bind PCH_FILE
 {
-  "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
-  "$(.RANLIB)" "$(<)"
+    "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(.include-pch)"$(PCH_FILE)" -c -o "$(<)" "$(>)"
 }
 
 # Declare actions for linking
 rule link ( targets * : sources * : properties * )
 {
   SPACE on $(targets) = " " ;
-  # Serialize execution of the 'link' action, since
-  # running N links in parallel is just slower.
-  JAM_SEMAPHORE on $(targets) = <s>clang-darwin-link-semaphore ;
 }
 
 actions link bind LIBRARIES