xref: /haiku/src/system/libroot/Jamfile (revision 850f2d1e58cc443f77353c7fc0ce0c158c1fd328)
1SubDir HAIKU_TOP src system libroot ;
2
3UsePrivateHeaders libroot runtime_loader ;
4
5local architectureObject ;
6for architectureObject in [ MultiArchSubDirSetup ] {
7	on $(architectureObject) {
8		local architecture = $(TARGET_PACKAGING_ARCH) ;
9
10		UsePrivateSystemHeaders ;
11
12		local libgccAsSingleObject ;
13		if $(architecture) = x86_gcc2 {
14			libgccAsSingleObject
15				= <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o ;
16			# One object to link them all...
17			TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH) on
18				<$(architecture)>libroot_libgcc_$(TARGET_ARCH).o =
19				[ on <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o
20					return $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH)) ]
21				--whole-archive ;
22			MergeObject $(libgccAsSingleObject) : : [ TargetLibgcc ] ;
23		}
24
25		local librootObjects =
26			$(libgccAsSingleObject)
27
28			os_main.o
29			os_arch_$(TARGET_ARCH).o
30
31			posix_arch_$(TARGET_ARCH).o
32			posix_crypt.o
33			posix_locale.o
34			posix_main.o
35			posix_pthread.o
36			posix_signal.o
37			posix_stdio.o
38			posix_gnu_arch_$(TARGET_ARCH).o
39			posix_gnu_ctype.o
40			posix_gnu_ext.o
41			posix_gnu_iconv.o
42			posix_gnu_libio.o
43			posix_gnu_locale.o
44			posix_gnu_misc.o
45			posix_gnu_regex.o
46			posix_gnu_stdio.o
47			posix_gnu_stdlib.o
48			posix_gnu_string.o
49			posix_gnu_wcsmbs.o
50			posix_stdlib.o
51			posix_string.o
52			posix_string_arch_$(TARGET_ARCH).o
53			posix_sys.o
54			posix_time.o
55			posix_unistd.o
56			posix_wchar.o
57			;
58		librootObjects = $(librootObjects:G=$(architecture)) ;
59
60		local librootDebugObjects =
61			posix_malloc_debug.o
62			;
63		librootDebugObjects = $(librootDebugObjects:G=$(architecture)) ;
64
65		local librootNoDebugObjects =
66			posix_malloc.o
67			;
68		librootNoDebugObjects = $(librootNoDebugObjects:G=$(architecture)) ;
69
70		local libroot = [ MultiArchDefaultGristFiles libroot.so ] ;
71		local librootDebug = $(libroot:B=libroot_debug) ;
72
73		DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ;
74		DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ;
75
76		SetVersionScript $(libroot) : libroot_versions ;
77		SetVersionScript $(librootDebug) : libroot_versions ;
78
79		SharedLibrary $(libroot)
80			:
81			libroot_init.c
82			:
83			$(librootObjects)
84			$(librootNoDebugObjects)
85			[ TargetStaticLibsupc++ ]
86			[ TargetLibgcc ]
87			;
88
89		# Use the standard libroot.so soname, so when the debug version is
90		# pre-loaded it prevents the standard version to be loaded as well.
91		HAIKU_SONAME on $(librootDebug) = libroot.so ;
92
93		SharedLibrary $(librootDebug)
94			:
95			libroot_init.c
96			:
97			$(librootObjects)
98			$(librootDebugObjects)
99			[ TargetStaticLibsupc++ ]
100			[ TargetLibgcc ]
101			;
102
103
104		# Copy libroot.so and update the copy's revision section. We link
105		# everything against the original, but the copy will end up on the disk
106		# image (this way we avoid unnecessary dependencies). The copy will be
107		# located in a subdirectory.
108		if $(TARGET_PLATFORM) = haiku {
109			local targetDir = [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET)
110				revisioned ] ;
111			local revisionedLibroot = [ MultiArchDefaultGristFiles
112				libroot.so : revisioned ] ;
113			local revisionedLibrootDebug
114				= $(librootDebug:G=$(revisionedLibroot:G)) ;
115
116			MakeLocate $(revisionedLibroot) : $(targetDir) ;
117			CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ;
118
119			MakeLocate $(revisionedLibrootDebug) : $(targetDir) ;
120			CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ;
121		}
122	}
123}
124
125SubInclude HAIKU_TOP src system libroot add-ons ;
126SubInclude HAIKU_TOP src system libroot os ;
127SubInclude HAIKU_TOP src system libroot posix ;
128SubInclude HAIKU_TOP src system libroot stubbed ;
129