]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/clang-linux.jam
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / tools / clang-linux.jam
CommitLineData
7c673cae
FG
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
b32b8144 8import common ;
7c673cae
FG
9import toolset ;
10import feature ;
11import toolset : flags ;
12
13import clang ;
14import gcc ;
15import common ;
16import errors ;
17import generators ;
18import type ;
19import numbers ;
20
21feature.extend-subfeature toolset clang : platform : linux ;
22
23toolset.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 ;
26generators.override clang-linux.prebuilt : builtin.lib-generator ;
27generators.override clang-linux.prebuilt : builtin.prebuilt ;
28generators.override clang-linux.searched-lib-generator : searched-lib-generator ;
29
30# Override default do-nothing generators.
31generators.override clang-linux.compile.c.pch : pch.default-c-pch-generator ;
32generators.override clang-linux.compile.c++.pch : pch.default-cpp-pch-generator ;
33
34type.set-generated-target-suffix PCH
35 : <toolset>clang <toolset-clang:platform>linux : pth ;
36
37toolset.inherit-rules clang-linux : gcc ;
38toolset.inherit-flags clang-linux : gcc
11fdf7f2
TL
39 : <inlining>full
40 <threading>multi/<target-os>windows
41 ;
7c673cae
FG
42
43if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
44 .debug-configuration = true ;
45}
46
47rule init ( version ? : command * : options * ) {
48 command = [ common.get-invocation-command clang-linux : clang++
49 : $(command) ] ;
50
51 # Determine the version
7c673cae 52 if $(command) {
b32b8144
FG
53 local command-string = \"$(command)\" ;
54 command-string = $(command-string:J=" ") ;
7c673cae
FG
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) ;
11fdf7f2 63 clang.init-cxxstd-flags clang-linux : $(condition) : $(version) ;
b32b8144
FG
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]) ;
7c673cae
FG
72}
73
74###############################################################################
75# Flags
76
7c673cae 77# note: clang silently ignores some of these inlining options
7c673cae 78# For clang, 'on' and 'full' are identical.
7c673cae
FG
79toolset.flags clang-linux.compile OPTIONS <inlining>full : -Wno-inline ;
80
11fdf7f2
TL
81toolset.flags clang-linux.compile OPTIONS <threading>multi/<target-os>windows : -pthread ;
82toolset.flags clang-linux.link OPTIONS <threading>multi/<target-os>windows : -pthread ;
7c673cae
FG
83
84###############################################################################
85# C and C++ compilation
86
87rule compile.c++ ( targets * : sources * : properties * ) {
7c673cae
FG
88 local pth-file = [ on $(<) return $(PCH_FILE) ] ;
89
90 if $(pth-file) {
91 DEPENDS $(<) : $(pth-file) ;
92 clang-linux.compile.c++.with-pch $(targets) : $(sources) ;
93 }
94 else {
95 clang-linux.compile.c++.without-pth $(targets) : $(sources) ;
96 }
97}
98
99actions compile.c++.without-pth {
100 "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
101}
102
103actions compile.c++.with-pch bind PCH_FILE
104{
105 "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -o "$(<)" "$(>)"
106}
107
108rule compile.c ( targets * : sources * : properties * )
109{
7c673cae
FG
110 local pth-file = [ on $(<) return $(PCH_FILE) ] ;
111
112 if $(pth-file) {
113 DEPENDS $(<) : $(pth-file) ;
114 clang-linux.compile.c.with-pch $(targets) : $(sources) ;
115 }
116 else {
117 clang-linux.compile.c.without-pth $(targets) : $(sources) ;
118 }
119}
120
121actions compile.c.without-pth
122{
123 "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
124}
125
126actions compile.c.with-pch bind PCH_FILE
127{
128 "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -include-pth -Xclang "$(PCH_FILE)" -c -o "$(<)" "$(>)"
129}
130
131###############################################################################
132# PCH emission
133
b32b8144
FG
134RM = [ common.rm-command ] ;
135
7c673cae 136rule compile.c++.pch ( targets * : sources * : properties * ) {
7c673cae
FG
137}
138
139actions compile.c++.pch {
b32b8144 140 $(RM) -f "$(<)" && "$(CONFIG_COMMAND)" -c -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)"
7c673cae
FG
141}
142
143rule compile.c.pch ( targets * : sources * : properties * ) {
7c673cae
FG
144}
145
146actions compile.c.pch
147{
b32b8144 148 $(RM) -f "$(<)" && "$(CONFIG_COMMAND)" -c -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -Xclang -emit-pth -o "$(<)" "$(>)"
7c673cae
FG
149}
150
151###############################################################################
152# Linking
153
154SPACE = " " ;
155
156rule link ( targets * : sources * : properties * ) {
7c673cae
FG
157 SPACE on $(targets) = " " ;
158 JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
159}
160
161actions 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
165rule link.dll ( targets * : sources * : properties * ) {
7c673cae
FG
166 SPACE on $(targets) = " " ;
167 JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
168}
169
7c673cae
FG
170# Differ from 'link' above only by -shared.
171actions 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