xref: /haiku/src/system/libroot/Jamfile (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
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_musl.o
39			posix_gnu_arch_$(TARGET_ARCH).o
40			posix_gnu_ctype.o
41			posix_gnu_ext.o
42			posix_gnu_iconv.o
43			posix_gnu_libio.o
44			posix_gnu_locale.o
45			posix_gnu_math.o
46			posix_gnu_misc.o
47			posix_gnu_regex.o
48			posix_gnu_stdio.o
49			posix_gnu_stdlib.o
50			posix_gnu_wcsmbs.o
51			posix_stdlib.o
52			posix_string.o
53			posix_string_arch_$(TARGET_ARCH).o
54			posix_sys.o
55			posix_time.o
56			posix_unistd.o
57			posix_wchar.o
58			;
59		librootObjects = $(librootObjects:G=$(architecture)) ;
60
61		local librootDebugObjects =
62			posix_malloc_debug.o
63			;
64		librootDebugObjects = $(librootDebugObjects:G=$(architecture)) ;
65
66		local librootNoDebugObjects =
67			posix_malloc.o
68			;
69		librootNoDebugObjects = $(librootNoDebugObjects:G=$(architecture)) ;
70
71		local libroot = [ MultiArchDefaultGristFiles libroot.so ] ;
72		local librootDebug = $(libroot:B=libroot_debug) ;
73
74		DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ;
75		DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ;
76
77		SetVersionScript $(libroot) : libroot_versions ;
78		SetVersionScript $(librootDebug) : libroot_versions ;
79
80		if $(architecture) != x86_gcc2 {
81			# force __cxa_pure_virtual to be linked instead of weak
82			# TODO: remove once we handle weak symbols correctly!
83			LINKFLAGS on $(libroot) += -Wl,-u,__cxa_pure_virtual ;
84			LINKFLAGS on $(librootDebug) += -Wl,-u,__cxa_pure_virtual ;
85		}
86
87		SharedLibrary $(libroot)
88			:
89			libroot_init.c
90			:
91			$(librootObjects)
92			$(librootNoDebugObjects)
93			[ TargetStaticLibsupc++ ]
94			[ TargetLibgcc ]
95			;
96
97		# Use the standard libroot.so soname, so when the debug version is
98		# pre-loaded it prevents the standard version to be loaded as well.
99		HAIKU_SONAME on $(librootDebug) = libroot.so ;
100
101		SharedLibrary $(librootDebug)
102			:
103			libroot_init.c
104			:
105			$(librootObjects)
106			$(librootDebugObjects)
107			[ TargetStaticLibsupc++ ]
108			[ TargetLibgcc ]
109			;
110
111		# These are defined in POSIX for c99 support, so fake'em
112		StaticLibrary [ MultiArchDefaultGristFiles libc.a ] : empty.c ;
113		StaticLibrary [ MultiArchDefaultGristFiles libm.a ] : empty.c ;
114		StaticLibrary [ MultiArchDefaultGristFiles libpthread.a ] : empty.c ;
115
116		# Copy libroot.so and update the copy's revision section. We link
117		# everything against the original, but the copy will end up on the disk
118		# image (this way we avoid unnecessary dependencies). The copy will be
119		# located in a subdirectory.
120		if $(TARGET_PLATFORM) = haiku {
121			local targetDir = [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET)
122				revisioned ] ;
123			local revisionedLibroot = [ MultiArchDefaultGristFiles
124				libroot.so : revisioned ] ;
125			local revisionedLibrootDebug
126				= $(librootDebug:G=$(revisionedLibroot:G)) ;
127
128			MakeLocate $(revisionedLibroot) : $(targetDir) ;
129			CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ;
130
131			MakeLocate $(revisionedLibrootDebug) : $(targetDir) ;
132			CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ;
133		}
134	}
135}
136
137SubInclude HAIKU_TOP src system libroot add-ons ;
138SubInclude HAIKU_TOP src system libroot os ;
139SubInclude HAIKU_TOP src system libroot posix ;
140SubInclude HAIKU_TOP src system libroot stubbed ;
141