]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Vladimir Prus 2004. |
2 | # Copyright Toon Knapen 2004. | |
3 | # Copyright Catherine Morton 2015. | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
5 | # (See accompanying file LICENSE.txt |
6 | # or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
7 | |
8 | # | |
f67539c2 | 9 | # B2 V2 toolset for the IBM XL C++ compiler |
7c673cae FG |
10 | # |
11 | ||
12 | import toolset : flags ; | |
13 | import feature ; | |
14 | import common ; | |
15 | import generators ; | |
16 | import os ; | |
17 | ||
18 | feature.extend toolset : xlcpp ; | |
19 | toolset.inherit xlcpp : unix ; | |
20 | generators.override xlcpp.prebuilt : builtin.prebuilt ; | |
21 | generators.override xlcpp.searched-lib-generator : searched-lib-generator ; | |
22 | ||
23 | # Configure the xlcpp toolset | |
24 | rule init ( version ? : command * : options * ) | |
25 | { | |
f67539c2 | 26 | local condition = [ |
7c673cae | 27 | common.check-init-parameters xlcpp : version $(version) ] ; |
f67539c2 | 28 | |
7c673cae FG |
29 | command = [ common.get-invocation-command xlcpp : xlC |
30 | : $(command) : "/usr/xlcpp/bin/xlC" ] ; | |
f67539c2 | 31 | |
7c673cae FG |
32 | common.handle-options xlcpp : $(condition) : $(command) : $(options) ; |
33 | } | |
34 | ||
35 | # Declare generators | |
36 | generators.register-c-compiler xlcpp.compile.c : C : OBJ : <toolset>xlcpp ; | |
37 | generators.register-c-compiler xlcpp.compile.c++ : CPP : OBJ : <toolset>xlcpp ; | |
38 | ||
39 | # Allow C++ style comments in C files | |
40 | flags xlcpp CFLAGS : -qnoxlcompatmacros ; | |
41 | ||
42 | # Declare flags | |
43 | flags xlcpp CFLAGS <optimization>off : -qNOOPTimize ; | |
44 | flags xlcpp CFLAGS <optimization>speed : ; | |
45 | flags xlcpp CFLAGS <optimization>space : -O2 -qcompact ; | |
46 | ||
47 | # Discretionary inlining (not recommended) | |
48 | flags xlcpp CFLAGS <inlining>off : -qnoinline ; | |
49 | flags xlcpp CFLAGS <inlining>on : -qinline ; | |
50 | #flags xlcpp CFLAGS <inlining>full : -qinline ; | |
51 | flags xlcpp CFLAGS <inlining>full : ; | |
52 | ||
53 | # Exception handling | |
54 | flags xlcpp C++FLAGS <exception-handling>off : -qnoeh ; | |
55 | flags xlcpp C++FLAGS <exception-handling>on : -qeh ; | |
56 | ||
57 | # Run-time Type Identification | |
58 | flags xlcpp C++FLAGS <rtti>off : -qnortti ; | |
59 | flags xlcpp C++FLAGS <rtti>on : -qrtti ; | |
60 | ||
61 | # Enable 64-bit memory addressing model | |
62 | flags xlcpp CFLAGS <address-model>64 : -q64 ; | |
63 | flags xlcpp LINKFLAGS <address-model>64 : -q64 ; | |
64 | flags xlcpp ARFLAGS <target-os>aix/<address-model>64 : -X 64 ; | |
65 | ||
66 | # Use absolute path when generating debug information | |
67 | flags xlcpp CFLAGS <debug-symbols>on : -g -qfullpath ; | |
68 | flags xlcpp LINKFLAGS <debug-symbols>on : -g -qfullpath ; | |
69 | flags xlcpp LINKFLAGS <debug-symbols>off : -s ; | |
70 | ||
71 | if [ os.name ] = AIX | |
72 | { | |
73 | flags xlcpp.compile C++FLAGS : -qfuncsect ; | |
74 | ||
75 | # The -bnoipath strips the prepending (relative) path of libraries from | |
76 | # the loader section in the target library or executable. Hence, during | |
77 | # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded | |
78 | # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without | |
79 | # this option, the prepending (relative) path + library name is | |
80 | # hard-coded in the loader section, causing *only* this path to be | |
81 | # searched during load-time. Note that the AIX linker does not have an | |
82 | # -soname equivalent, this is as close as it gets. | |
83 | # | |
92f5a8d4 | 84 | # The above options are definitely for AIX 5.x, and most likely also for |
7c673cae FG |
85 | # AIX 4.x and AIX 6.x. For details about the AIX linker see: |
86 | # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf | |
87 | # | |
88 | flags xlcpp.link LINKFLAGS <link>shared : -bnoipath ; | |
89 | ||
90 | # Run-time linking | |
91 | flags xlcpp.link EXE-LINKFLAGS <link>shared : -brtl ; | |
92 | } | |
93 | else | |
94 | { | |
95 | # Linux PPC | |
96 | flags xlcpp.compile CFLAGS <link>shared : -qpic=large ; | |
97 | flags xlcpp FINDLIBS : rt ; | |
92f5a8d4 TL |
98 | |
99 | flags xlcpp.compile OPTIONS <local-visibility>hidden : -qvisibility=hidden ; | |
100 | flags xlcpp.compile OPTIONS <local-visibility>protected : -qvisibility=protected ; | |
101 | flags xlcpp.compile OPTIONS <local-visibility>global : -qvisibility=default ; | |
7c673cae FG |
102 | } |
103 | ||
104 | # Profiling | |
105 | flags xlcpp CFLAGS <profiling>on : -pg ; | |
106 | flags xlcpp LINKFLAGS <profiling>on : -pg ; | |
107 | ||
f67539c2 TL |
108 | # Declare flags and actions for compilation |
109 | flags xlcpp.compile.c++ OPTIONS <cxxstd>98 : -std=c++03 ; | |
110 | flags xlcpp.compile.c++ OPTIONS <cxxstd>03 : -std=c++03 ; | |
111 | flags xlcpp.compile.c++ OPTIONS <cxxstd>0x : -std=c++11 ; | |
112 | flags xlcpp.compile.c++ OPTIONS <cxxstd>11 : -std=c++11 ; | |
113 | flags xlcpp.compile.c++ OPTIONS <cxxstd>1y : -std=c++1y ; | |
114 | flags xlcpp.compile.c++ OPTIONS <cxxstd>14 : -std=c++1y ; | |
20effc67 TL |
115 | flags xlcpp.compile.c++ OPTIONS <cxxstd>1z : -std=c++1y ; |
116 | flags xlcpp.compile.c++ OPTIONS <cxxstd>17 : -std=c++1y ; | |
117 | flags xlcpp.compile.c++ OPTIONS <cxxstd>2a : -std=c++1y ; | |
118 | flags xlcpp.compile.c++ OPTIONS <cxxstd>20 : -std=c++1y ; | |
f67539c2 TL |
119 | flags xlcpp.compile.c++ OPTIONS <cxxstd>latest : -std=c++1y ; |
120 | ||
7c673cae FG |
121 | flags xlcpp.compile OPTIONS <cflags> ; |
122 | flags xlcpp.compile.c++ OPTIONS <cxxflags> ; | |
123 | flags xlcpp DEFINES <define> ; | |
124 | flags xlcpp UNDEFS <undef> ; | |
125 | flags xlcpp HDRS <include> ; | |
126 | flags xlcpp STDHDRS <sysinclude> ; | |
127 | flags xlcpp.link OPTIONS <linkflags> ; | |
128 | flags xlcpp ARFLAGS <arflags> ; | |
129 | ||
130 | flags xlcpp LIBPATH <library-path> ; | |
131 | flags xlcpp NEEDLIBS <library-file> ; | |
132 | flags xlcpp FINDLIBS <find-shared-library> ; | |
133 | flags xlcpp FINDLIBS <find-static-library> ; | |
134 | ||
135 | # Select the compiler name according to the threading model. | |
136 | flags xlcpp VA_C_COMPILER <threading>single : xlc ; | |
137 | flags xlcpp VA_C_COMPILER <threading>multi : xlc ; | |
138 | flags xlcpp VA_CXX_COMPILER <threading>single : xlC ; | |
139 | flags xlcpp VA_CXX_COMPILER <threading>multi : xlC ; | |
140 | ||
141 | SPACE = " " ; | |
142 | ||
143 | flags xlcpp.link.dll HAVE_SONAME <target-os>linux : "" ; | |
144 | ||
145 | actions xlcpp.link bind NEEDLIBS | |
146 | { | |
147 | $(VA_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) | |
148 | } | |
149 | ||
150 | actions xlcpp.link.dll bind NEEDLIBS | |
151 | { | |
f67539c2 | 152 | xlC -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) |
7c673cae FG |
153 | } |
154 | ||
155 | actions xlcpp.compile.c | |
156 | { | |
157 | $(VA_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" | |
158 | } | |
159 | ||
160 | actions xlcpp.compile.c++ | |
161 | { | |
162 | $(VA_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" | |
163 | } | |
164 | ||
165 | actions updated together piecemeal xlcpp.archive | |
166 | { | |
167 | ar $(ARFLAGS) ru "$(<)" "$(>)" | |
168 | } |