]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/intel-linux.jam
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / tools / build / src / tools / intel-linux.jam
1 # Copyright (c) 2003 Michael Stevens
2 # Copyright (c) 2011 Bryce Lelbach
3 #
4 # Use, modification and distribution is subject to the Boost Software
5 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
6 # http://www.boost.org/LICENSE_1_0.txt)
7
8 import toolset ;
9 import feature ;
10 import toolset : flags ;
11
12 import intel ;
13 import gcc ;
14 import common ;
15 import errors ;
16 import generators ;
17 import type ;
18 import numbers ;
19
20 feature.extend-subfeature toolset intel : platform : linux ;
21
22 toolset.inherit-generators intel-linux
23 <toolset>intel <toolset-intel:platform>linux : gcc : gcc.mingw.link gcc.mingw.link.dll ;
24 generators.override intel-linux.prebuilt : builtin.lib-generator ;
25 generators.override intel-linux.prebuilt : builtin.prebuilt ;
26 generators.override intel-linux.searched-lib-generator : searched-lib-generator ;
27
28 # Override default do-nothing generators.
29 generators.override intel-linux.compile.c.pch : pch.default-c-pch-generator ;
30 generators.override intel-linux.compile.c++.pch : pch.default-cpp-pch-generator ;
31
32 type.set-generated-target-suffix PCH : <toolset>intel <toolset-intel:platform>linux : pchi ;
33
34 toolset.inherit-rules intel-linux : gcc ;
35 toolset.inherit-flags intel-linux : gcc
36 : <inlining>off <inlining>on <inlining>full
37 <optimization>space <optimization>speed
38 <warnings>off <warnings>all <warnings>on
39 <warnings>extra <warnings>pedantic
40 <warnings-as-errors>off <warnings-as-errors>on
41 ;
42
43 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
44 {
45 .debug-configuration = true ;
46 }
47
48 # Initializes the intel-linux toolset
49 # version in mandatory
50 # name (default icpc) is used to invoke the specified intel-linux compiler
51 # compile and link options allow you to specify addition command line options for each version
52 rule init ( version ? : command * : options * )
53 {
54 local condition = [ common.check-init-parameters intel-linux
55 : version $(version) ] ;
56
57 if $(.debug-configuration)
58 {
59 ECHO "notice: intel-linux version is" $(version) ;
60 }
61
62 local default_path ;
63
64 # Intel C++ Composer XE 2011 for Linux, aka Intel C++ Compiler XE 12.0,
65 # aka intel-linux-12.0. In this version, Intel thankfully decides to install
66 # to a sane 'intel' folder in /opt.
67 if [ MATCH "(12[.]0|12)" : $(version) ]
68 { default_path = /opt/intel/bin ; }
69 # Intel C++ Compiler 11.1.
70 else if [ MATCH "(11[.]1)" : $(version) ]
71 { default_path = /opt/intel_cce_11.1.064.x86_64/bin ; }
72 # Intel C++ Compiler 11.0.
73 else if [ MATCH "(11[.]0|11)" : $(version) ]
74 { default_path = /opt/intel_cce_11.0.074.x86_64/bin ; }
75 # Intel C++ Compiler 10.1.
76 else if [ MATCH "(10[.]1)" : $(version) ]
77 { default_path = /opt/intel_cce_10.1.013_x64/bin ; }
78 # Intel C++ Compiler 9.1.
79 else if [ MATCH "(9[.]1)" : $(version) ]
80 { default_path = /opt/intel_cc_91/bin ; }
81 # Intel C++ Compiler 9.0.
82 else if [ MATCH "(9[.]0|9)" : $(version) ]
83 { default_path = /opt/intel_cc_90/bin ; }
84 # Intel C++ Compiler 8.1.
85 else if [ MATCH "(8[.]1)" : $(version) ]
86 { default_path = /opt/intel_cc_81/bin ; }
87 # Intel C++ Compiler 8.0 - this used to be the default, so now it's the
88 # fallback.
89 else
90 { default_path = /opt/intel_cc_80/bin ; }
91
92 if $(.debug-configuration)
93 {
94 ECHO "notice: default search path for intel-linux is" $(default_path) ;
95 }
96
97 command = [ common.get-invocation-command intel-linux : icpc
98 : $(command) : $(default_path) ] ;
99
100 common.handle-options intel-linux : $(condition) : $(command) : $(options) ;
101
102 local root = [ feature.get-values <root> : $(options) ] ;
103 local bin ;
104 if $(command) || $(root)
105 {
106 bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
107 root ?= $(bin:D) ;
108
109 local command-string = $(command:J=" ") ;
110 local version-output = [ SHELL "$(command-string) --version" ] ;
111 local real-version = [ MATCH "([0-9.]+)" : $(version-output) ] ;
112 local major = [ MATCH "([0-9]+).*" : $(real-version) ] ;
113
114 # If we failed to determine major version, use the behaviour for
115 # the current compiler.
116 if $(major) && [ numbers.less $(major) 10 ]
117 {
118 flags intel-linux.compile OPTIONS $(condition)/<inlining>off : "-Ob0" ;
119 flags intel-linux.compile OPTIONS $(condition)/<inlining>on : "-Ob1" ;
120 flags intel-linux.compile OPTIONS $(condition)/<inlining>full : "-Ob2" ;
121 flags intel-linux.compile OPTIONS $(condition)/<optimization>space : "-O1" ;
122 flags intel-linux.compile OPTIONS $(condition)/<optimization>speed : "-O3 -ip" ;
123 }
124 else if $(major) && [ numbers.less $(major) 11 ]
125 {
126 flags intel-linux.compile OPTIONS $(condition)/<inlining>off : "-inline-level=0" ;
127 flags intel-linux.compile OPTIONS $(condition)/<inlining>on : "-inline-level=1" ;
128 flags intel-linux.compile OPTIONS $(condition)/<inlining>full : "-inline-level=2" ;
129 flags intel-linux.compile OPTIONS $(condition)/<optimization>space : "-O1" ;
130 flags intel-linux.compile OPTIONS $(condition)/<optimization>speed : "-O3 -ip" ;
131 }
132 else # newer version of intel do have -Os (at least 11+, don't know about 10)
133 {
134 flags intel-linux.compile OPTIONS $(condition)/<inlining>off : "-inline-level=0" ;
135 flags intel-linux.compile OPTIONS $(condition)/<inlining>on : "-inline-level=1" ;
136 flags intel-linux.compile OPTIONS $(condition)/<inlining>full : "-inline-level=2" ;
137 flags intel-linux.compile OPTIONS $(condition)/<optimization>space : "-Os" ;
138 flags intel-linux.compile OPTIONS $(condition)/<optimization>speed : "-O3 -ip" ;
139 }
140
141 if $(root)
142 {
143 # Libraries required to run the executable may be in either
144 # $(root)/lib (10.1 and earlier)
145 # or
146 # $(root)/lib/architecture-name (11.0 and later:
147 local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ;
148 if $(.debug-configuration)
149 {
150 ECHO notice\: using intel libraries "::" $(condition) "::" $(lib_path) ;
151 }
152 flags intel-linux.link RUN_PATH $(condition) : $(lib_path) ;
153 }
154 }
155 }
156
157 SPACE = " " ;
158
159 flags intel-linux.compile OPTIONS <warnings>off : -w0 ;
160 flags intel-linux.compile OPTIONS <warnings>on : -w1 ;
161 flags intel-linux.compile OPTIONS <warnings>all : -w2 ;
162 flags intel-linux.compile OPTIONS <warnings>extra : -w3 ;
163 flags intel-linux.compile OPTIONS <warnings>pedantic : -w3 -Wcheck ;
164 flags intel-linux.compile OPTIONS <warnings-as-errors>on : -Werror-all ;
165
166 rule compile.c++ ( targets * : sources * : properties * )
167 {
168 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
169 }
170
171 actions compile.c++ bind PCH_FILE
172 {
173 "$(CONFIG_COMMAND)" -c -xc++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)"
174 }
175
176 rule compile.c ( targets * : sources * : properties * )
177 {
178 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
179 }
180
181 actions compile.c bind PCH_FILE
182 {
183 "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)"
184 }
185
186 rule compile.c++.pch ( targets * : sources * : properties * )
187 {
188 }
189 #
190 # Compiling a pch first deletes any existing *.pchi file, as Intel's compiler
191 # won't over-write an existing pch: instead it creates filename$1.pchi, filename$2.pchi
192 # etc - which appear not to do anything except take up disk space :-(
193 #
194 actions compile.c++.pch
195 {
196 rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)"
197 }
198
199 actions compile.fortran
200 {
201 "ifort" -c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
202 }
203
204 rule compile.c.pch ( targets * : sources * : properties * )
205 {
206 }
207
208 actions compile.c.pch
209 {
210 rm -f "$(<)" && "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -pch-create "$(<)" "$(>)"
211 }
212
213 rule link ( targets * : sources * : properties * )
214 {
215 SPACE on $(targets) = " " ;
216 JAM_SEMAPHORE on $(targets) = <s>intel-linux-link-semaphore ;
217 }
218
219 actions link bind LIBRARIES
220 {
221 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS)
222 }
223
224 rule link.dll ( targets * : sources * : properties * )
225 {
226 SPACE on $(targets) = " " ;
227 JAM_SEMAPHORE on $(targets) = <s>intel-linux-link-semaphore ;
228 }
229
230 # Differ from 'link' above only by -shared.
231 actions link.dll bind LIBRARIES
232 {
233 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) $(USER_OPTIONS)
234 }
235
236
237