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)
8 import feature : feature ;
11 import toolset : flags ;
17 feature.extend-subfeature toolset intel : platform : darwin ;
19 toolset.inherit-generators intel-darwin
20 <toolset>intel <toolset-intel:platform>darwin
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
27 generators.override intel-darwin.prebuilt : builtin.lib-generator ;
28 generators.override intel-darwin.prebuilt : builtin.prebuilt ;
29 generators.override intel-darwin.searched-lib-generator : searched-lib-generator ;
31 toolset.inherit-rules intel-darwin : gcc ;
32 toolset.inherit-flags intel-darwin : gcc
33 : <inlining>off <inlining>on <inlining>full <optimization>space
34 <warnings>off <warnings>all <warnings>on
35 <architecture>x86/<address-model>32
36 <architecture>x86/<address-model>64
39 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
41 .debug-configuration = true ;
44 # vectorization diagnostics
45 feature vectorize : off on full ;
47 # Initializes the intel-darwin toolset
48 # version in mandatory
49 # name (default icc) is used to invoke the specified intel complier
50 # compile and link options allow you to specify addition command line options for each version
51 rule init ( version ? : command * : options * )
53 local condition = [ common.check-init-parameters intel-darwin
54 : version $(version) ] ;
56 command = [ common.get-invocation-command intel-darwin : icc
57 : $(command) : /opt/intel_cc_80/bin ] ;
59 common.handle-options intel-darwin : $(condition) : $(command) : $(options) ;
61 gcc.init-link-flags intel-darwin darwin $(condition) ;
63 # handle <library-path>
64 # local library-path = [ feature.get-values <library-path> : $(options) ] ;
65 # flags intel-darwin.link USER_OPTIONS $(condition) : [ feature.get-values <dll-path> : $(options) ] ;
67 local root = [ feature.get-values <root> : $(options) ] ;
69 if $(command) || $(root)
71 bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
76 # Libraries required to run the executable may be in either
77 # $(root)/lib (10.1 and earlier)
79 # $(root)/lib/architecture-name (11.0 and later:
80 local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ;
81 if $(.debug-configuration)
83 ECHO notice: using intel libraries :: $(condition) :: $(lib_path) ;
85 flags intel-darwin.link RUN_PATH $(condition) : $(lib_path) ;
89 local m = [ MATCH (..).* : $(version) ] ;
90 local n = [ MATCH (.)\\. : $(m) ] ;
98 flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -Ob0 ;
99 flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -Ob1 ;
100 flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -Ob2 ;
101 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ;
102 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ;
103 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ;
104 flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-libcxa -lstdc++ -lpthread ;
105 flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-libcxa -lstdc++ -lpthread ;
108 flags intel-darwin.compile OPTIONS $(condition)/<inlining>off : -inline-level=0 ;
109 flags intel-darwin.compile OPTIONS $(condition)/<inlining>on : -inline-level=1 ;
110 flags intel-darwin.compile OPTIONS $(condition)/<inlining>full : -inline-level=2 ;
111 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>off : -vec-report0 ;
112 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>on : -vec-report1 ;
113 flags intel-darwin.compile OPTIONS $(condition)/<vectorize>full : -vec-report5 ;
114 flags intel-darwin.link OPTIONS $(condition)/<runtime-link>static : -static -static-intel -lstdc++ -lpthread ;
115 flags intel-darwin.link OPTIONS $(condition)/<runtime-link>shared : -shared-intel -lstdc++ -lpthread ;
118 local minor = [ MATCH ".*\\.(.).*" : $(version) ] ;
120 # wchar_t char_traits workaround for compilers older than 10.2
121 if $(major) = "9" || ( $(major) = "10" && ( $(minor) = "0" || $(minor) = "1" ) ) {
122 flags intel-darwin.compile DEFINES $(condition) : __WINT_TYPE__=int : unchecked ;
128 flags intel-darwin.compile OPTIONS <cflags> ;
129 flags intel-darwin.compile.c++ OPTIONS <cxxflags> ;
130 # flags intel-darwin.compile INCLUDES <include> ;
132 flags intel-darwin.compile OPTIONS <optimization>space : -O1 ; # no specific space optimization flag in icc
135 .cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i
136 conroe conroe-xe conroe-l allendale merom
137 merom-xe kentsfield kentsfield-xe penryn wolfdale
138 yorksfield nehalem sandy-bridge ivy-bridge haswell ;
139 .cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3
140 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ;
141 .cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ;
143 flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ;
144 flags intel-darwin.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ;
146 flags intel-darwin.compile.c OPTIONS <warnings>off : -w0 ;
147 flags intel-darwin.compile.c OPTIONS <warnings>on : -w1 ;
148 flags intel-darwin.compile.c OPTIONS <warnings>all : -w2 ;
150 flags intel-darwin.compile.c++ OPTIONS <warnings>off : -w0 ;
151 flags intel-darwin.compile.c++ OPTIONS <warnings>on : -w1 ;
152 flags intel-darwin.compile.c++ OPTIONS <warnings>all : -w2 ;
156 "$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
161 "$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
164 flags intel-darwin ARFLAGS <archiveflags> ;
166 # Default value. Mostly for the sake of intel-linux
167 # that inherits from gcc, but does not has the same
168 # logic to set the .AR variable. We can put the same
169 # logic in intel-linux, but that's hardly worth the trouble
170 # as on Linux, 'ar' is always available.
173 rule archive ( targets * : sources * : properties * )
175 # Always remove archive and start again. Here's rationale from
178 # I had a file, say a1.c, that was included into liba.a.
179 # I moved a1.c to a2.c, updated my Jamfiles and rebuilt.
180 # My program was crashing with absurd errors.
181 # After some debugging I traced it back to the fact that a1.o was *still*
186 # Originally removing the archive was done by splicing an RM
187 # onto the archive action. That makes archives fail to build on NT
188 # when they have many files because it will no longer execute the
189 # action directly and blow the line length limit. Instead we
190 # remove the file in a different action, just before the building
193 local clean.a = $(targets[1])(clean) ;
194 TEMPORARY $(clean.a) ;
196 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
197 DEPENDS $(clean.a) : $(sources) ;
198 DEPENDS $(targets) : $(clean.a) ;
199 common.RmTemps $(clean.a) : $(targets) ;
202 actions piecemeal archive
204 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
208 flags intel-darwin.link USER_OPTIONS <linkflags> ;
210 # Declare actions for linking
211 rule link ( targets * : sources * : properties * )
213 SPACE on $(targets) = " " ;
214 # Serialize execution of the 'link' action, since
215 # running N links in parallel is just slower.
216 JAM_SEMAPHORE on $(targets) = <s>intel-darwin-link-semaphore ;
219 actions link bind LIBRARIES
221 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)
224 actions link.dll bind LIBRARIES
226 "$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" -single_module -dynamiclib -install_name "$(<[1]:D=)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)