1 | # (C) Copyright Rene Rivera, 2002-2003. |
---|
2 | # Distributed under the Boost Software License, Version 1.0. |
---|
3 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
4 | |
---|
5 | # The following #// line will be used by the regression test table generation |
---|
6 | # program as the column heading for HTML tables. Must not include version number. |
---|
7 | #//<a href="http://gcc.gnu.org/">GNU<br>GCC</a> |
---|
8 | |
---|
9 | # For adding framwork libraries; like <framework>Python, <framework>Carbon, etc. |
---|
10 | free-feature framework ; |
---|
11 | |
---|
12 | # Specify the loader for bundles. |
---|
13 | free-feature bundle-loader ; |
---|
14 | |
---|
15 | # Controll generation of compiler warnings. |
---|
16 | feature warnings : on off ; |
---|
17 | |
---|
18 | # Type of shared object to create. |
---|
19 | free-feature link-format ; |
---|
20 | |
---|
21 | # compute directories for invoking GCC |
---|
22 | # |
---|
23 | # The gcc toolset can be user-configured using the following |
---|
24 | # variables: |
---|
25 | # |
---|
26 | # GCC_ROOT_DIRECTORY |
---|
27 | # The directory in which GCC was installed. Defaults to |
---|
28 | # unset. Usually, there is no need to set this variable at |
---|
29 | # all. However, if G++ is not in the path it is usually |
---|
30 | # sufficient to configure this one variable. More fine-grained |
---|
31 | # configuration is available by setting the following: |
---|
32 | # |
---|
33 | # GCC_BIN_DIRECTORY |
---|
34 | # the directory prefix used to find the gcc executables. Defaults to |
---|
35 | # $(GCC_ROOT_DIRECTORY)/bin/, or "" if GCC_ROOT_DIRECTORY is |
---|
36 | # not set. |
---|
37 | # |
---|
38 | # GCC_INCLUDE_DIRECTORY |
---|
39 | # the directory in which to find system includes. Defaults to |
---|
40 | # empty. |
---|
41 | # |
---|
42 | # GCC_STDLIB_DIRECTORY |
---|
43 | # the directory in which to find the standard library |
---|
44 | # objects associated with this build of gcc. Defaults to |
---|
45 | # $(GCC_ROOT_DIRECTORY)/lib. |
---|
46 | # |
---|
47 | # GXX |
---|
48 | # The name by which g++ is invoked. You can also use this in |
---|
49 | # lieu of setting the <cxxflags> property to force options such |
---|
50 | # as "-V3.0.4" into the g++ command line: "-sGXX=g++ -V3.0.4". |
---|
51 | # |
---|
52 | # GCC |
---|
53 | # Similar to GXX, the name by which gcc is invoked for "C" |
---|
54 | # language targets. |
---|
55 | |
---|
56 | # singleton variables... |
---|
57 | set-as-singleton GCC_ROOT_DIRECTORY GCC_BIN_DIRECTORY GCC_INCLUDE_DIRECTORY GCC_STDLIB_DIRECTORY ; |
---|
58 | |
---|
59 | flags darwin GCC_BIN_DIRECTORY : $(GCC_BIN_DIRECTORY) ; |
---|
60 | flags darwin GCC_INCLUDE_DIRECTORY : $(GCC_INCLUDE_DIRECTORY) ; |
---|
61 | flags darwin GCC_STDLIB_DIRECTORY : $(GCC_STDLIB_DIRECTORY) ; |
---|
62 | |
---|
63 | if ! $(GCC_BIN_DIRECTORY) { flags darwin GCC_BIN_DIRECTORY : $(GCC_ROOT_DIRECTORY)/bin/ ; } |
---|
64 | if ! $(GCC_BIN_DIRECTORY) { flags darwin GCC_BIN_DIRECTORY : "" ; } |
---|
65 | if ! $(GCC_STDLIB_DIRECTORY) { flags darwin GCC_STDLIB_DIRECTORY : $(GCC_ROOT_DIRECTORY)/lib ; } |
---|
66 | |
---|
67 | flags darwin .GCC_BIN_DIR : $(GCC_BIN_DIRECTORY) ; |
---|
68 | flags darwin .GXX : $(GXX) ; |
---|
69 | flags darwin .GCC : $(GCC) ; |
---|
70 | |
---|
71 | if ! $(.GXX) && $(GCC_ROOT_DIRECTORY) { flags darwin .GXX : g++ ; } |
---|
72 | if ! $(.GXX) { flags darwin .GXX : c++ ; } |
---|
73 | if ! $(.GCC) && $(GCC_ROOT_DIRECTORY) { flags darwin .GCC : gcc ; } |
---|
74 | if ! $(.GCC) { flags darwin .GCC : cc ; } |
---|
75 | |
---|
76 | flags darwin CFLAGS <cflags> ; |
---|
77 | flags darwin C++FLAGS <cxxflags> ; |
---|
78 | flags darwin DEFINES <define> ; |
---|
79 | flags darwin UNDEFS <undef> ; |
---|
80 | flags darwin HDRS <include> ; |
---|
81 | flags darwin SYSHDRS <sysinclude> ; |
---|
82 | flags darwin LIBPATH <library-path> ; |
---|
83 | flags darwin NEEDLIBS <library-file> ; |
---|
84 | flags darwin FINDLIBS <find-library> ; |
---|
85 | flags darwin ARFLAGS <arflags> ; |
---|
86 | flags darwin TARGET_TYPE <target-type> ; |
---|
87 | flags darwin FRAMEWORKS <framework> ; |
---|
88 | flags darwin DLLVERSION <dllversion> ; |
---|
89 | flags darwin DLLVERSION : $(DLLVERSION[1]) ; |
---|
90 | flags darwin BUNDLE_LOADER <bundle-loader> ; |
---|
91 | flags darwin ARFLAGS ; |
---|
92 | |
---|
93 | if ! $(ARFLAGS) { flags darwin ARFLAGS : "" ; } |
---|
94 | if ! $(DLLVERSION) { flags darwin DLLVERSION : $(BOOST_VERSION) ; } |
---|
95 | |
---|
96 | if ! [ MATCH "(gcc)" : $(.GCC) ] |
---|
97 | { |
---|
98 | flags darwin CFLAGS : -Wno-long-double -no-cpp-precomp ; |
---|
99 | } |
---|
100 | # GCC 4.0, the default compiler in Darwin 8.0.0, does not have |
---|
101 | # -fcoalesce-templates. GCC 3.3 needs it. |
---|
102 | if ! [ MATCH "(g[+][+])" : $(.GXX) ] && $(JAMUNAME[3]) < "8.0.0" || |
---|
103 | [ MATCH "(g[+][+]-3.3)" : $(.GXX) ] |
---|
104 | { |
---|
105 | flags darwin C++FLAGS : -fcoalesce-templates ; |
---|
106 | } |
---|
107 | flags darwin LINKFLAGS <runtime-link>static : -static-libgcc ; |
---|
108 | flags darwin CFLAGS <debug-symbols>on : -g ; |
---|
109 | flags darwin LINKFLAGS <debug-symbols>on : -g ; |
---|
110 | flags darwin LINKFLAGS <debug-symbols>off : -Wl,-x ; |
---|
111 | flags darwin CFLAGS <optimization>off : -O0 ; |
---|
112 | flags darwin CFLAGS <optimization>speed : -O3 ; |
---|
113 | flags darwin CFLAGS <optimization>space : -Os ; |
---|
114 | flags darwin CFLAGS <inlining>off : -fno-inline ; |
---|
115 | flags darwin CFLAGS <inlining>on : -Wno-inline ; |
---|
116 | flags darwin CFLAGS <inlining>full : -finline-functions -Wno-inline ; |
---|
117 | flags darwin CFLAGS <profiling>on : -pg ; |
---|
118 | flags darwin LINKFLAGS <profiling>on : -pg ; |
---|
119 | flags darwin C++FLAGS <rtti>off : -fno-rtti ; |
---|
120 | flags darwin C++FLAGS <vtable-thunks>on : -fvtable-thunks ; |
---|
121 | flags darwin C++FLAGS <vtable-thunks>off : -fvtable-thunks=0 ; |
---|
122 | flags darwin CFLAGS <shared-linkable>true : -fPIC ; |
---|
123 | flags darwin CFLAGS <warnings>on : -Wall ; |
---|
124 | flags darwin CFLAGS <warnings>off : -w ; |
---|
125 | |
---|
126 | flags darwin LINK_FORMAT <target-type>$(SHARED_TYPES)/<link-format>bundle : bundle ; |
---|
127 | flags darwin LINK_FORMAT <target-type>$(SHARED_TYPES)/<link-format>dynamic : dynamic ; |
---|
128 | if $(BUNDLE_LOADER) && ! $(LINK_FORMAT) |
---|
129 | { |
---|
130 | flags darwin LINK_FORMAT <target-type>$(SHARED_TYPES) : bundle ; |
---|
131 | } |
---|
132 | |
---|
133 | if $(LINK_FORMAT) = bundle |
---|
134 | { |
---|
135 | flags darwin LINKFLAGS <target-type>$(SHARED_TYPES) : |
---|
136 | -bundle ; |
---|
137 | } |
---|
138 | else |
---|
139 | { |
---|
140 | # flags darwin LINKFLAGS <target-type>$(SHARED_TYPES) : |
---|
141 | # -Wl,-dynamic -nostartfiles -Wl,-dylib -Wl,-ldylib1.o ; |
---|
142 | } |
---|
143 | |
---|
144 | flags darwin .LINKFLAGS <linkflags> ; |
---|
145 | flags darwin DLLFLAGS : ; |
---|
146 | if -bind_at_load in $(.LINKFLAGS) |
---|
147 | { |
---|
148 | flags darwin DLLFLAGS <target-type>$(SHARED_TYPES) : -bind_at_load ; |
---|
149 | .LINKFLAGS = [ difference $(.LINKFLAGS) : -bind_at_load ] ; |
---|
150 | } |
---|
151 | flags darwin LINKFLAGS : $(.LINKFLAGS) ; |
---|
152 | |
---|
153 | |
---|
154 | #### Link #### |
---|
155 | |
---|
156 | rule Link-action |
---|
157 | { |
---|
158 | _ on $(<) = " " ; |
---|
159 | DEPENDS $(<) : $(NEEDLIBS) $(NEEDIMPS) ; |
---|
160 | if $(TARGET_TYPE) in $(SHARED_TYPES) && $(LINK_FORMAT) != bundle |
---|
161 | { |
---|
162 | #~ LINKFLAGS on $(<) += |
---|
163 | #~ "-Wl,-dylib_compatibility_version,$(DLLVERSION) -W,l-dylib_current_version,$(DLLVERSION)" ; |
---|
164 | darwin-Link-DyLib-action $(<) : $(>) ; |
---|
165 | } |
---|
166 | else |
---|
167 | { |
---|
168 | darwin-Link-action $(<) : $(>) ; |
---|
169 | } |
---|
170 | } |
---|
171 | |
---|
172 | actions darwin-Link-action bind NEEDLIBS NEEDIMPS |
---|
173 | { |
---|
174 | $(SHELL_SET)$(gSHELL_LIBPATH)=$(LINK_LIBPATH) |
---|
175 | $(SHELL_EXPORT)$(gSHELL_LIBPATH) |
---|
176 | $(.GCC_BIN_DIR)$(.GXX) $(LINKFLAGS) -o "$(<[1])" "$(>)" \ |
---|
177 | -F$(FRAMEWORKS:D) -framework$(_)$(FRAMEWORKS:D=) \ |
---|
178 | -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) \ |
---|
179 | -bundle_loader$(_)"$(BUNDLE_LOADER)" "$(BUNDLE_LOADER)" |
---|
180 | } |
---|
181 | |
---|
182 | actions darwin-Link-DyLib-action bind NEEDLIBS NEEDIMPS |
---|
183 | { |
---|
184 | $(SHELL_SET)$(gSHELL_LIBPATH)=$(LINK_LIBPATH) |
---|
185 | $(SHELL_EXPORT)$(gSHELL_LIBPATH) |
---|
186 | ld -dynamic -m -r -d $(DLLFLAGS) -o "$(<[1]:S=.lo)" "$(>)" \ |
---|
187 | && \ |
---|
188 | $(.GCC_BIN_DIR)$(.GXX) $(LINKFLAGS) -o "$(<[1])" "$(<[1]:S=.lo)" \ |
---|
189 | -F$(FRAMEWORKS:D) -framework$(_)$(FRAMEWORKS:D=) \ |
---|
190 | -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) -dynamiclib -install_name "$(<[1]:D=:S=.dylib)" \ |
---|
191 | && \ |
---|
192 | rm -f "$(<[1]:S=.lo)" |
---|
193 | } |
---|
194 | |
---|
195 | #### Cc ##### |
---|
196 | |
---|
197 | rule Cc-action |
---|
198 | { |
---|
199 | _ on $(<) = " " ; |
---|
200 | darwin-Cc-action $(<) : $(>) ; |
---|
201 | } |
---|
202 | |
---|
203 | actions darwin-Cc-action |
---|
204 | { |
---|
205 | $(.GCC_BIN_DIR)$(.GCC) -c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -F$(FRAMEWORKS:D) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<)" "$(>)" |
---|
206 | } |
---|
207 | |
---|
208 | #### C++ #### |
---|
209 | rule C++-action |
---|
210 | { |
---|
211 | _ on $(<) = " " ; |
---|
212 | darwin-C++-action $(<) : $(>) ; |
---|
213 | } |
---|
214 | |
---|
215 | actions darwin-C++-action |
---|
216 | { |
---|
217 | $(.GCC_BIN_DIR)$(.GXX) -c -ftemplate-depth-256 -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -F$(FRAMEWORKS:D) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<)" "$(>)" |
---|
218 | } |
---|
219 | |
---|
220 | #### Archive #### |
---|
221 | |
---|
222 | rule Archive-action |
---|
223 | { |
---|
224 | darwin-Archive-action $(<) : $(>) ; |
---|
225 | } |
---|
226 | |
---|
227 | actions updated together piecemeal darwin-Archive-action |
---|
228 | { |
---|
229 | ar -r -s $(ARFLAGS) "$(<:T)" "$(>:T)" |
---|
230 | } |
---|