xref: /haiku/src/system/libroot/Jamfile (revision 6d2f2ec177bf615a117a7428d71be4330545b320)
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_math.o
45			posix_gnu_misc.o
46			posix_gnu_regex.o
47			posix_gnu_stdio.o
48			posix_gnu_stdlib.o
49			posix_gnu_string.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 librootGuardedObjects =
67			posix_malloc_guarded.o
68			;
69		librootGuardedObjects = $(librootGuardedObjects:G=$(architecture)) ;
70
71		local librootNoDebugObjects =
72			posix_malloc.o
73			;
74		librootNoDebugObjects = $(librootNoDebugObjects:G=$(architecture)) ;
75
76		local libroot = [ MultiArchDefaultGristFiles libroot.so ] ;
77		local librootDebug = $(libroot:B=libroot_debug) ;
78		local librootGuarded = $(libroot:B=libroot_guarded) ;
79
80		DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ;
81		DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ;
82		DONT_LINK_AGAINST_LIBROOT on $(librootGuarded) = true ;
83
84		SetVersionScript $(libroot) : libroot_versions ;
85		SetVersionScript $(librootDebug) : libroot_versions ;
86		SetVersionScript $(librootGuarded) : libroot_versions ;
87
88		SharedLibrary $(libroot)
89			:
90			libroot_init.c
91			:
92			$(librootObjects)
93			$(librootNoDebugObjects)
94			[ TargetStaticLibsupc++ ]
95			[ TargetLibgcc ]
96			;
97
98		# Use the standard libroot.so soname, so when the debug version is
99		# pre-loaded it prevents the standard version to be loaded as well.
100		HAIKU_SONAME on $(librootDebug) = libroot.so ;
101
102		SharedLibrary $(librootDebug)
103			:
104			libroot_init.c
105			:
106			$(librootObjects)
107			$(librootDebugObjects)
108			[ TargetStaticLibsupc++ ]
109			[ TargetLibgcc ]
110			;
111
112		HAIKU_SONAME on $(librootGuarded) = libroot.so ;
113
114		SharedLibrary $(librootGuarded)
115			:
116			libroot_init.c
117			:
118			$(librootObjects)
119			$(librootGuardedObjects)
120			[ TargetStaticLibsupc++ ]
121			[ TargetLibgcc ]
122			;
123
124		# Copy libroot.so and update the copy's revision section. We link
125		# everything against the original, but the copy will end up on the disk
126		# image (this way we avoid unnecessary dependencies). The copy will be
127		# located in a subdirectory.
128		if $(TARGET_PLATFORM) = haiku {
129			local targetDir = [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET)
130				revisioned ] ;
131			local revisionedLibroot = [ MultiArchDefaultGristFiles
132				libroot.so : revisioned ] ;
133			local revisionedLibrootDebug
134				= $(librootDebug:G=$(revisionedLibroot:G)) ;
135			local revisionedLibrootGuarded
136				= $(librootGuarded:G=$(revisionedLibroot:G)) ;
137
138			MakeLocate $(revisionedLibroot) : $(targetDir) ;
139			CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ;
140
141			MakeLocate $(revisionedLibrootDebug) : $(targetDir) ;
142			CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ;
143
144			MakeLocate $(revisionedLibrootGuarded) : $(targetDir) ;
145			CopySetHaikuRevision $(revisionedLibrootGuarded)
146				: $(librootGuarded) ;
147		}
148	}
149}
150
151SubInclude HAIKU_TOP src system libroot add-ons ;
152SubInclude HAIKU_TOP src system libroot os ;
153SubInclude HAIKU_TOP src system libroot posix ;
154SubInclude HAIKU_TOP src system libroot stubbed ;
155