]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/clang-linux.jam
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / tools / build / src / tools / clang-linux.jam
1 # Copyright (c) 2003 Michael Stevens
2 # Copyright (c) 2010-2011 Bryce Lelbach (blelbach@cct.lsu.edu, maintainer)
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 common ;
9 import toolset ;
10 import feature ;
11 import toolset : flags ;
12
13 import clang ;
14 import gcc ;
15 import common ;
16 import errors ;
17 import generators ;
18 import type ;
19 import numbers ;
20
21 feature.extend-subfeature toolset clang : platform : linux ;
22
23 toolset.inherit-generators clang-linux
24 <toolset>clang <toolset-clang:platform>linux : gcc
25 : gcc.mingw.link gcc.mingw.link.dll gcc.cygwin.link gcc.cygwin.link.dll ;
26 generators.override clang-linux.prebuilt : builtin.lib-generator ;
27 generators.override clang-linux.prebuilt : builtin.prebuilt ;
28 generators.override clang-linux.searched-lib-generator : searched-lib-generator ;
29
30 # Override default do-nothing generators.
31 generators.override clang-linux.compile.c.pch : pch.default-c-pch-generator ;
32 generators.override clang-linux.compile.c++.pch : pch.default-cpp-pch-generator ;
33
34 type.set-generated-target-suffix PCH
35 : <toolset>clang <toolset-clang:platform>linux : pth ;
36
37 toolset.inherit-rules clang-linux : gcc ;
38 toolset.inherit-flags clang-linux : gcc
39 : <inlining>full
40 <threading>multi/<target-os>windows
41 ;
42
43 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
44 .debug-configuration = true ;
45 }
46
47 rule init ( version ? : command * : options * ) {
48 command = [ common.get-invocation-command clang-linux : clang++
49 : $(command) ] ;
50
51 # Determine the version
52 if $(command) {
53 local command-string = \"$(command)\" ;
54 command-string = $(command-string:J=" ") ;
55 version ?= [ MATCH "version ([0-9.]+)"
56 : [ SHELL "$(command-string) --version" ] ] ;
57 }
58
59 local condition = [ common.check-init-parameters clang-linux
60 : version $(version) ] ;
61
62 common.handle-options clang-linux : $(condition) : $(command) : $(options) ;
63 clang.init-cxxstd-flags clang-linux : $(condition) : $(version) ;
64
65 # - Ranlib.
66 local ranlib = [ feature.get-values <ranlib> : $(options) ] ;
67 toolset.flags clang-linux.archive .RANLIB $(condition) : $(ranlib[1]) ;
68
69 # - Archive builder.
70 local archiver = [ feature.get-values <archiver> : $(options) ] ;
71 toolset.flags clang-linux.archive .AR $(condition) : $(archiver[1]) ;
72 }
73
74 ###############################################################################
75 # Flags
76
77 # note: clang silently ignores some of these inlining options
78 # For clang, 'on' and 'full' are identical.
79 toolset.flags clang-linux.compile OPTIONS <inlining>full : -Wno-inline ;
80
81 toolset.flags clang-linux.compile OPTIONS <threading>multi/<target-os>windows : -pthread ;
82 toolset.flags clang-linux.link OPTIONS <threading>multi/<target-os>windows : -pthread ;
83
84 ###############################################################################
85 # C and C++ compilation
86
87 rule compile.c++ ( targets * : sources * : properties * ) {
88 local pch-file = [ on $(<) return $(PCH_FILE) ] ;
89
90 if $(pch-file) {
91 DEPENDS $(<) : $(pch-file) ;
92 clang-linux.compile.c++.with-pch $(targets) : $(sources) ;
93 }
94 else {
95 clang-linux.compile.c++.without-pch $(targets) : $(sources) ;
96 }
97 }
98
99 actions compile.c++.without-pch {
100 "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
101 }
102
103 actions compile.c++.with-pch bind PCH_FILE
104 {
105 "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pch -Xclang "$(PCH_FILE)" -o "$(<)" "$(>)"
106 }
107
108 rule compile.c ( targets * : sources * : properties * )
109 {
110 local pch-file = [ on $(<) return $(PCH_FILE) ] ;
111
112 if $(pch-file) {
113 DEPENDS $(<) : $(pch-file) ;
114 clang-linux.compile.c.with-pch $(targets) : $(sources) ;
115 }
116 else {
117 clang-linux.compile.c.without-pch $(targets) : $(sources) ;
118 }
119 }
120
121 actions compile.c.without-pch
122 {
123 "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
124 }
125
126 actions compile.c.with-pch bind PCH_FILE
127 {
128 "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pch -Xclang "$(PCH_FILE)" -c -o "$(<)" "$(>)"
129 }
130
131 ###############################################################################
132 # PCH emission
133
134 RM = [ common.rm-command ] ;
135
136 rule compile.c++.pch ( targets * : sources * : properties * ) {
137 }
138
139 actions compile.c++.pch {
140 $(RM) -f "$(<)" && "$(CONFIG_COMMAND)" -c -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pch -o "$(<)" "$(>)"
141 }
142
143 rule compile.c.pch ( targets * : sources * : properties * ) {
144 }
145
146 actions compile.c.pch
147 {
148 $(RM) -f "$(<)" && "$(CONFIG_COMMAND)" -c -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pch -o "$(<)" "$(>)"
149 }
150
151 ###############################################################################
152 # Linking
153
154 SPACE = " " ;
155
156 rule link ( targets * : sources * : properties * ) {
157 SPACE on $(targets) = " " ;
158 JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
159 }
160
161 actions link bind LIBRARIES {
162 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
163 }
164
165 rule link.dll ( targets * : sources * : properties * ) {
166 SPACE on $(targets) = " " ;
167 JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
168 }
169
170 # Differ from 'link' above only by -shared.
171 actions link.dll bind LIBRARIES {
172 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname$(SPACE)-Wl,$(<[1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
173 }
174