SystemLibraryRules revision dc83a48d
1rule Libstdc++ForImage
2{
3	# Libstdc++ForImage
4	#
5	# Returns the c++-standard-library to be put onto the image.
6
7	if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
8		# the libstdc++.so for our legacy compiler (needs to be built)
9		return libstdc++.r4.so ;
10	}
11
12	# libstdc++.so for other architectures comes with the gcc_syslibs
13	# package, so there's no library to put onto the image directly.
14	return ;
15}
16
17
18rule TargetLibstdc++ asPath
19{
20	# TargetLibstdc++ [ <asPath> ]
21	#
22	# Returns the c++-standard-library for the target.
23	# Invoking with <asPath> = true will return the full library path.
24
25	if $(TARGET_PLATFORM) = haiku {
26		if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
27			# the libstdc++.so for our legacy compiler (needs to be built)
28			return libstdc++.r4.so ;
29		}
30		# return libstdc++.so from the gcc_syslibs build feature.
31		local flags ;
32		if $(asPath) = true {
33			flags += path ;
34		}
35		return [
36			BuildFeatureAttribute gcc_syslibs : libstdc++.so : $(flags)
37		] ;
38	} else {
39		if $(TARGET_PLATFORM) = libbe_test {
40			# Use the existing host library
41			return stdc++.r4 ;
42		}
43		# TODO: return libstdc++.so for non-Haiku target platform if needed
44	}
45}
46
47
48rule TargetLibsupc++ asPath
49{
50	# TargetLibsupc++ [ <asPath> ]
51	#
52	# Returns the c++-support-library for the target.
53	# Invoking with <asPath> = true will return the full library path.
54
55	if $(TARGET_PLATFORM) = haiku {
56		if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
57			# there is no libsupc++.so for the legacy compiler
58			return ;
59		}
60		# return libsupc++.so from the gcc_syslibs build feature.
61		local flags ;
62		if $(asPath) = true {
63			flags += path ;
64		}
65		return [
66			BuildFeatureAttribute gcc_syslibs : libsupc++.so : $(flags)
67		] ;
68	} else {
69		# TODO: return libsupc++.so for non-Haiku target platform if needed
70	}
71}
72
73
74rule TargetStaticLibsupc++ asPath
75{
76	# TargetStaticLibsupc++ [ <asPath> ]
77	#
78	# Returns the static c++-support-library for the target.
79	# Invoking with <asPath> = true will return the full library path.
80
81	if $(TARGET_PLATFORM) = haiku {
82		# return libsupc++.a from the gcc_syslibs_devel build feature.
83		local flags ;
84		if $(asPath) = true {
85			flags += path ;
86		}
87		return [
88			BuildFeatureAttribute gcc_syslibs_devel : libsupc++.a : $(flags)
89		] ;
90	} else {
91		# TODO: return libsupc++.a for non-Haiku target platform if needed
92	}
93}
94
95
96rule TargetKernelLibsupc++ asPath
97{
98	# TargetKernelLibsupc++ [ <asPath> ]
99	#
100	# Returns the static kernel c++-support-library for the target.
101	# Invoking with <asPath> = true will return the full library path.
102
103	if $(TARGET_PLATFORM) = haiku {
104		# return libsupc++-kernel.a from the gcc_syslibs_devel build feature.
105		local flags ;
106		if $(asPath) = true {
107			flags += path ;
108		}
109		return [
110			BuildFeatureAttribute gcc_syslibs_devel
111				: libsupc++-kernel.a : $(flags)
112		] ;
113	} else {
114		# There is no libsupc++-kernel.a for non-Haiku target platform
115	}
116}
117
118
119rule TargetBootLibsupc++ asPath
120{
121	# TargetBootLibsupc++ [ <asPath> ]
122	#
123	# Returns the static bootloader c++-support-library for the target.
124	# Invoking with <asPath> = true will return the full library path.
125
126	if $(TARGET_PLATFORM) = haiku {
127		if $(TARGET_PACKAGING_ARCH) = x86_64 {
128			# we need to use the 32-bit libsupc++.a built by the cross-compiler
129			return $(TARGET_BOOT_LIBSUPC++) ;
130
131			# TODO: ideally, we would build this as part of gcc_syslibs_devel,
132			#       but that isn't currently possible, as that would require
133			#       32-bit support (libraries and glue-code) on x86_64-Haiku.
134		}
135		# no special boot version of libsupc++.a needed, so we return
136		# libsupc++-kernel.a from the gcc_syslibs_devel build feature.
137		local flags ;
138		if $(asPath) = true {
139			flags += path ;
140		}
141		return [
142			BuildFeatureAttribute gcc_syslibs_devel
143				: libsupc++-kernel.a : $(flags)
144		] ;
145	} else {
146		# There is no libsupc++-boot.a for non-Haiku target platform
147	}
148}
149
150
151rule TargetLibgcc asPath
152{
153	# TargetLibgcc [ <asPath> ]
154	#
155	# Returns the default libgcc(s) for the target. On x86_gcc2, this is the
156	# static libgcc, on everything else this will return the shared libgcc_s
157	# followed by the static libgcc (both are needed as they do not contain
158	# the same set of symbols).
159	# Invoking with <asPath> = true will return the full library path.
160
161	if $(TARGET_PLATFORM) = haiku {
162		local flags ;
163		if $(asPath) = true {
164			flags += path ;
165		}
166		if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
167			# return libgcc.a from the gcc_syslibs_devel build feature.
168			return [
169				BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags)
170			] ;
171		} else {
172			# return libgcc_s.so from the gcc_syslibs build feature and libgcc.a
173			# from the gcc_syslibs_devel build feature.
174			return [
175				BuildFeatureAttribute gcc_syslibs : libgcc_s.so : $(flags)
176			] [
177				BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags)
178			] ;
179		}
180	} else {
181		# TODO: return libgcc for non-Haiku target platform if needed
182	}
183}
184
185
186rule TargetStaticLibgcc asPath
187{
188	# TargetStaticLibgcc [ <asPath> ]
189	#
190	# Returns the static libgcc for the target.
191	# Invoking with <asPath> = true will return the full library path.
192
193	if $(TARGET_PLATFORM) = haiku {
194		# return libgcc.a from the gcc_syslibs_devel build feature.
195		local flags ;
196		if $(asPath) = true {
197			flags += path ;
198		}
199		return [
200			BuildFeatureAttribute gcc_syslibs_devel : libgcc.a : $(flags)
201		] ;
202	} else {
203		# TODO: return libgcc.a for non-Haiku target platform if needed
204	}
205}
206
207
208rule TargetKernelLibgcc asPath
209{
210	# TargetKernelLibgcc [ <asPath> ]
211	#
212	# Returns the static kernel libgcc for the target.
213	# Invoking with <asPath> = true will return the full library path.
214
215	if $(TARGET_PLATFORM) = haiku {
216		# return libgcc-kernel.a from the gcc_syslibs_devel build feature.
217		local flags ;
218		if $(asPath) = true {
219			flags += path ;
220		}
221		return [
222			BuildFeatureAttribute gcc_syslibs_devel
223				: libgcc-kernel.a : $(flags)
224		] ;
225	} else {
226		# there is no libgcc-kernel.a for non-Haiku target platform
227	}
228}
229
230
231rule TargetBootLibgcc asPath
232{
233	# TargetBootLibgcc [ <asPath> ]
234	#
235	# Returns the static bootloader libgcc for the target.
236	# Invoking with <asPath> = true will return the full library path.
237
238	if $(TARGET_PLATFORM) = haiku {
239		if $(TARGET_PACKAGING_ARCH) = x86_64 {
240			# we need to use the 32-bit libgcc.a built by the cross-compiler
241			return $(TARGET_BOOT_LIBGCC) ;
242
243			# TODO: ideally, we would build this as part of gcc_syslibs_devel,
244			#       but that isn't currently possible, as that would require
245			#       32-bit support (libraries and glue-code) on x86_64-Haiku.
246		}
247		# no special boot version of libgcc needed, so we return
248		# libgcc-kernel.a from the gcc_syslibs_devel build feature.
249		local flags ;
250		if $(asPath) = true {
251			flags += path ;
252		}
253		return [
254			BuildFeatureAttribute gcc_syslibs_devel
255				: libgcc-kernel.a : $(flags)
256		] ;
257	} else {
258		# there is no libgcc-boot.a for non-Haiku target platform
259	}
260}
261
262
263rule TargetStaticLibgcceh asPath
264{
265	# TargetStaticLibgcceh [ <asPath> ]
266	#
267	# Returns the static libgcc_eh for the target.
268	# Invoking with <asPath> = true will return the full library path.
269
270	if $(TARGET_PLATFORM) = haiku {
271		# return libgcc.a from the gcc_syslibs_devel build feature.
272		local flags ;
273		if $(asPath) = true {
274			flags += path ;
275		}
276		return [
277			BuildFeatureAttribute gcc_syslibs_devel : libgcc_eh.a : $(flags)
278		] ;
279	} else {
280		# TODO: return libgcc_eh.a for non-Haiku target platform if needed
281	}
282}
283
284
285rule TargetKernelLibgcceh asPath
286{
287	# TargetKernelLibgcceh [ <asPath> ]
288	#
289	# Returns the static kernel libgcc_eh for the target.
290	# Invoking with <asPath> = true will return the full library path.
291
292	if $(TARGET_PLATFORM) = haiku {
293		# return libgcc_eh-kernel.a from the gcc_syslibs_devel build feature.
294		local flags ;
295		if $(asPath) = true {
296			flags += path ;
297		}
298		return [
299			BuildFeatureAttribute gcc_syslibs_devel
300				: libgcc_eh-kernel.a : $(flags)
301		] ;
302	} else {
303		# there is no libgcc_eh-kernel.a for non-Haiku target platform
304	}
305}
306
307
308rule C++HeaderDirectories architecture
309{
310	# C++HeaderDirectories
311	#
312	# Returns the c++ header directories to use for the given architecture.
313
314	local c++HeaderDirs ;
315	if $(architecture) = x86_gcc2 {
316		c++HeaderDirs = [ FDirName $(HAIKU_TOP) headers cpp ] ;
317	} else if $(PLATFORM) = bootstrap_stage0 {
318		# Currently, no c++-headers are needed for stage0 of the boostrap.
319	} else {
320		local baseDir = [
321			BuildFeatureAttribute gcc_syslibs_devel : c++-headers : path
322		] ;
323		if $(baseDir) {
324			c++HeaderDirs =
325				$(baseDir)
326				[ FDirName $(baseDir) $(HAIKU_GCC_MACHINE_$(architecture)) ]
327				[ FDirName $(baseDir) backward ]
328				[ FDirName $(baseDir) ext ]
329				;
330		}
331	}
332
333	return $(c++HeaderDirs) ;
334}
335
336rule GccHeaderDirectories architecture
337{
338	# GccHeaderDirectories
339	#
340	# Returns the gcc header directories to use for the given architecture.
341
342	local gccHeaderDirs ;
343	if $(architecture) = x86_gcc2 {
344		gccHeaderDirs = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ;
345	} else if $(PLATFORM) = bootstrap_stage0 {
346		gccHeaderDirs =
347			[ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include ]
348			[ FDirName $(HAIKU_GCC_LIB_DIR_$(architecture)) include-fixed ]
349			;
350	} else {
351		local baseDir = [
352			BuildFeatureAttribute gcc_syslibs_devel : gcc-headers : path
353		] ;
354		if $(baseDir) {
355			gccHeaderDirs =
356				[ FDirName $(baseDir) include ]
357				[ FDirName $(baseDir) include-fixed ]
358				;
359		}
360	}
361
362	return $(gccHeaderDirs) ;
363}
364