]>
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. | |
5 | # (See accompanying file LICENSE_1_0.txt | |
6 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | # | |
9 | # Boost.Build V2 toolset for the IBM XL C++ compiler | |
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 | { | |
26 | local condition = [ | |
27 | common.check-init-parameters xlcpp : version $(version) ] ; | |
28 | ||
29 | command = [ common.get-invocation-command xlcpp : xlC | |
30 | : $(command) : "/usr/xlcpp/bin/xlC" ] ; | |
31 | ||
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 | # | |
84 | # The above options are definately for AIX 5.x, and most likely also for | |
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 ; | |
98 | } | |
99 | ||
100 | # Profiling | |
101 | flags xlcpp CFLAGS <profiling>on : -pg ; | |
102 | flags xlcpp LINKFLAGS <profiling>on : -pg ; | |
103 | ||
104 | flags xlcpp.compile OPTIONS <cflags> ; | |
105 | flags xlcpp.compile.c++ OPTIONS <cxxflags> ; | |
106 | flags xlcpp DEFINES <define> ; | |
107 | flags xlcpp UNDEFS <undef> ; | |
108 | flags xlcpp HDRS <include> ; | |
109 | flags xlcpp STDHDRS <sysinclude> ; | |
110 | flags xlcpp.link OPTIONS <linkflags> ; | |
111 | flags xlcpp ARFLAGS <arflags> ; | |
112 | ||
113 | flags xlcpp LIBPATH <library-path> ; | |
114 | flags xlcpp NEEDLIBS <library-file> ; | |
115 | flags xlcpp FINDLIBS <find-shared-library> ; | |
116 | flags xlcpp FINDLIBS <find-static-library> ; | |
117 | ||
118 | # Select the compiler name according to the threading model. | |
119 | flags xlcpp VA_C_COMPILER <threading>single : xlc ; | |
120 | flags xlcpp VA_C_COMPILER <threading>multi : xlc ; | |
121 | flags xlcpp VA_CXX_COMPILER <threading>single : xlC ; | |
122 | flags xlcpp VA_CXX_COMPILER <threading>multi : xlC ; | |
123 | ||
124 | SPACE = " " ; | |
125 | ||
126 | flags xlcpp.link.dll HAVE_SONAME <target-os>linux : "" ; | |
127 | ||
128 | actions xlcpp.link bind NEEDLIBS | |
129 | { | |
130 | $(VA_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) | |
131 | } | |
132 | ||
133 | actions xlcpp.link.dll bind NEEDLIBS | |
134 | { | |
135 | xlC -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) | |
136 | } | |
137 | ||
138 | actions xlcpp.compile.c | |
139 | { | |
140 | $(VA_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" | |
141 | } | |
142 | ||
143 | actions xlcpp.compile.c++ | |
144 | { | |
145 | $(VA_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" | |
146 | } | |
147 | ||
148 | actions updated together piecemeal xlcpp.archive | |
149 | { | |
150 | ar $(ARFLAGS) ru "$(<)" "$(>)" | |
151 | } |