]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/clang-darwin.jam
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / src / tools / clang-darwin.jam
1 # Copyright Vladimir Prus 2004.
2 # Copyright Noel Belcourt 2007.
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt
5 # or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 import clang ;
8 import feature : feature ;
9 import os ;
10 import toolset ;
11 import toolset : flags ;
12 import gcc ;
13 import common ;
14 import errors ;
15 import generators ;
16
17 feature.extend-subfeature toolset clang : platform : darwin ;
18
19 toolset.inherit-generators clang-darwin
20 <toolset>clang <toolset-clang:platform>darwin
21 : gcc
22 # Don't inherit PCH generators. They were not tested, and probably
23 # don't work for this compiler.
24 : gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch
25 ;
26
27 generators.override clang-darwin.prebuilt : builtin.lib-generator ;
28 generators.override clang-darwin.prebuilt : builtin.prebuilt ;
29 generators.override clang-darwin.searched-lib-generator : searched-lib-generator ;
30
31 generators.register-c-compiler clang-darwin.compile.m : OBJECTIVE_C : OBJ : <toolset>clang <toolset-clang:platform>darwin ;
32 generators.register-c-compiler clang-darwin.compile.mm : OBJECTIVE_CPP : OBJ : <toolset>clang <toolset-clang:platform>darwin ;
33
34 toolset.inherit-rules clang-darwin : gcc ;
35 toolset.inherit-flags clang-darwin : gcc
36 : <inlining>off <inlining>on <inlining>full <optimization>space
37 <warnings>off <warnings>all <warnings>on
38 <architecture>x86/<address-model>32
39 <architecture>x86/<address-model>64
40 ;
41
42 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
43 {
44 .debug-configuration = true ;
45 }
46
47 # Initializes the clang-darwin toolset
48 # version in optional
49 # name (default clang++) is used to invoke the specified clang complier
50 # compile and link options allow you to specify addition command line options for each version
51 rule init ( version ? : command * : options * )
52 {
53 command = [ common.get-invocation-command clang-darwin : clang++
54 : $(command) : /usr/bin /usr/local/bin ] ;
55
56 # Determine the version
57 local command-string = $(command:J=" ") ;
58 if $(command)
59 {
60 version ?= [ MATCH "^([0-9.]+)"
61 : [ SHELL "$(command-string) -dumpversion" ] ] ;
62 }
63
64 local condition = [ common.check-init-parameters clang
65 : version $(version) ] ;
66
67 common.handle-options clang-darwin : $(condition) : $(command) : $(options) ;
68
69 gcc.init-link-flags clang darwin $(condition) ;
70
71 # - Ranlib.
72 local ranlib = [ feature.get-values <ranlib> : $(options) ] ;
73 toolset.flags clang-darwin.archive .RANLIB $(condition) : $(ranlib[1]) ;
74
75 # - Archive builder.
76 local archiver = [ feature.get-values <archiver> : $(options) ] ;
77 toolset.flags clang-darwin.archive .AR $(condition) : $(archiver[1]) ;
78 }
79
80 SPACE = " " ;
81
82 toolset.flags clang-darwin.compile OPTIONS <cflags> ;
83 toolset.flags clang-darwin.compile.c++ OPTIONS <cxxflags> ;
84 toolset.flags clang-darwin.compile.m OPTIONS <mflags> ;
85 toolset.flags clang-darwin.compile.mm OPTIONS <mflags> ;
86 toolset.flags clang-darwin.compile.mm OPTIONS <mmflags> ;
87 # toolset.flags clang-darwin.compile INCLUDES <include> ;
88
89 # Declare flags and action for compilation.
90 toolset.flags clang-darwin.compile OPTIONS <optimization>off : -O0 ;
91 toolset.flags clang-darwin.compile OPTIONS <optimization>speed : -O3 ;
92 toolset.flags clang-darwin.compile OPTIONS <optimization>space : -Os ;
93
94 # For clang, 'on' and 'full' are identical
95 toolset.flags clang-darwin.compile OPTIONS <inlining>off : -fno-inline ;
96 toolset.flags clang-darwin.compile OPTIONS <inlining>on : -Wno-inline ;
97 toolset.flags clang-darwin.compile OPTIONS <inlining>full : -Wno-inline ;
98
99 toolset.flags clang-darwin.compile OPTIONS <warnings>off : -w ;
100 toolset.flags clang-darwin.compile OPTIONS <warnings>on : -Wall ;
101 toolset.flags clang-darwin.compile OPTIONS <warnings>all : -Wall -pedantic ;
102 toolset.flags clang-darwin.compile OPTIONS <warnings-as-errors>on : -Werror ;
103
104 toolset.flags clang-darwin.compile OPTIONS <debug-symbols>on : -g ;
105 toolset.flags clang-darwin.compile OPTIONS <profiling>on : -pg ;
106 toolset.flags clang-darwin.compile OPTIONS <rtti>off : -fno-rtti ;
107
108 toolset.flags clang-darwin.compile OPTIONS <flags> ;
109
110 actions compile.c
111 {
112 "$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
113 }
114
115 actions compile.c++
116 {
117 "$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
118 }
119
120 actions compile.m
121 {
122 "$(CONFIG_COMMAND)" -x objective-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
123 }
124
125 actions compile.mm
126 {
127 "$(CONFIG_COMMAND)" -x objective-c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
128 }
129
130 flags clang-darwin ARFLAGS <archiveflags> ;
131
132 # Default value. Mostly for the sake of clang-linux
133 # that inherits from gcc, but does not has the same
134 # logic to set the .AR variable. We can put the same
135 # logic in clang-linux, but that's hardly worth the trouble
136 # as on Linux, 'ar' is always available.
137 .AR = ar ;
138 .RANLIB = ranlib -cs ;
139
140 rule archive ( targets * : sources * : properties * )
141 {
142 # Always remove archive and start again. Here's rationale from
143 # Andre Hentz:
144 #
145 # I had a file, say a1.c, that was included into liba.a.
146 # I moved a1.c to a2.c, updated my Jamfiles and rebuilt.
147 # My program was crashing with absurd errors.
148 # After some debugging I traced it back to the fact that a1.o was *still*
149 # in liba.a
150 #
151 # Rene Rivera:
152 #
153 # Originally removing the archive was done by splicing an RM
154 # onto the archive action. That makes archives fail to build on NT
155 # when they have many files because it will no longer execute the
156 # action directly and blow the line length limit. Instead we
157 # remove the file in a different action, just before the building
158 # of the archive.
159 #
160 local clean.a = $(targets[1])(clean) ;
161 TEMPORARY $(clean.a) ;
162 NOCARE $(clean.a) ;
163 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
164 DEPENDS $(clean.a) : $(sources) ;
165 DEPENDS $(targets) : $(clean.a) ;
166 common.RmTemps $(clean.a) : $(targets) ;
167 }
168
169 actions piecemeal archive
170 {
171 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
172 "$(.RANLIB)" "$(<)"
173 }
174
175 flags clang-darwin.link USER_OPTIONS <linkflags> ;
176
177 # Declare actions for linking
178 rule link ( targets * : sources * : properties * )
179 {
180 SPACE on $(targets) = " " ;
181 # Serialize execution of the 'link' action, since
182 # running N links in parallel is just slower.
183 JAM_SEMAPHORE on $(targets) = <s>clang-darwin-link-semaphore ;
184 }
185
186 actions link bind LIBRARIES
187 {
188 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS)
189 }
190
191 actions link.dll bind LIBRARIES
192 {
193 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "@rpath/$(<[1]:D=)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS)
194 }