xref: /haiku/src/system/libroot/Jamfile (revision 4d5508263edb4256349d1d8424e38ada90a9c10b)
1338b8dc3SIngo WeinholdSubDir HAIKU_TOP src system libroot ;
25af32e75SAxel Dörfler
319d40f9eSIngo WeinholdUsePrivateHeaders libroot runtime_loader ;
4b0944c78SIngo Weinhold
5*4d550826SFrançois Revolrule FilterArchive {
6*4d550826SFrançois Revol	# FilterArchive <target> : <source> : <members to remove>
7*4d550826SFrançois Revol
8*4d550826SFrançois Revol	# set the tools according to the platform
9*4d550826SFrançois Revol	AR on $(1) = $(TARGET_AR_$(TARGET_PACKAGING_ARCH)) d ;
10*4d550826SFrançois Revol	# TODO: use $(TARGET_DELARFLAGS_$(TARGET_PACKAGING_ARCH))
11*4d550826SFrançois Revol	RANLIB on $(1) = $(TARGET_RANLIB_$(TARGET_PACKAGING_ARCH)) ;
12*4d550826SFrançois Revol
13*4d550826SFrançois Revol	MakeLocateArch $(1) ;
14*4d550826SFrançois Revol	Depends $(1) : $(2) ;
15*4d550826SFrançois Revol	File $(1) : $(2) ;
16*4d550826SFrançois Revol	# we don't want the path
17*4d550826SFrançois Revol	# XXX: is it done this way?
18*4d550826SFrançois Revol	NotFile $(3) ;
19*4d550826SFrançois Revol
20*4d550826SFrançois Revol	# delete the unwanted members
21*4d550826SFrançois Revol	FilterArchive1 $(1) : $(3) ;
22*4d550826SFrançois Revol
23*4d550826SFrançois Revol	if $(RANLIB) { Ranlib $(1) ; }
24*4d550826SFrançois Revol}
25*4d550826SFrançois Revol
26*4d550826SFrançois Revolactions FilterArchive1 {
27*4d550826SFrançois Revol	$(AR) $(<) $(>)
28*4d550826SFrançois Revol}
29*4d550826SFrançois Revol
30b0944c78SIngo Weinholdlocal architectureObject ;
31b0944c78SIngo Weinholdfor architectureObject in [ MultiArchSubDirSetup ] {
32b0944c78SIngo Weinhold	on $(architectureObject) {
33b0944c78SIngo Weinhold		local architecture = $(TARGET_PACKAGING_ARCH) ;
34b0944c78SIngo Weinhold
356b202f4eSIngo Weinhold		UsePrivateSystemHeaders ;
365af32e75SAxel Dörfler
37*4d550826SFrançois Revol		# Make a copy of libgcc without the objects we don't need
38*4d550826SFrançois Revol		FilterArchive <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a
39*4d550826SFrançois Revol			: $(HAIKU_GCC_LIBGCC_$(architecture))
40*4d550826SFrançois Revol			: $(HAIKU_GCC_LIBGCC_OBJECTS_EXCLUDES_$(architecture)) ;
4138f62644SIngo Weinhold
42*4d550826SFrançois Revol		# One object to link them all...
43*4d550826SFrançois Revol		TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH) on
44*4d550826SFrançois Revol			<$(architecture)>libroot_libgcc_$(TARGET_ARCH).o =
45*4d550826SFrançois Revol			[ on <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o
46*4d550826SFrançois Revol				return $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH)) ]
47*4d550826SFrançois Revol			--whole-archive ;
485e0e2739SFrançois Revol
49*4d550826SFrançois Revol		MergeObject <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o
505e0e2739SFrançois Revol			:
51*4d550826SFrançois Revol			: <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a ;
525e0e2739SFrançois Revol
5338f62644SIngo Weinhold		local librootObjects =
54*4d550826SFrançois Revol			libroot_libgcc_$(TARGET_ARCH).o
55*4d550826SFrançois Revol
5638f62644SIngo Weinhold			os_main.o
5738f62644SIngo Weinhold			os_arch_$(TARGET_ARCH).o
5838f62644SIngo Weinhold
5938f62644SIngo Weinhold			posix_arch_$(TARGET_ARCH).o
6038f62644SIngo Weinhold			posix_crypt.o
6138f62644SIngo Weinhold			posix_locale.o
6238f62644SIngo Weinhold			posix_main.o
6338f62644SIngo Weinhold			posix_pthread.o
6438f62644SIngo Weinhold			posix_signal.o
6538f62644SIngo Weinhold			posix_stdio.o
6638f62644SIngo Weinhold			posix_gnu_arch_$(TARGET_ARCH).o
6738f62644SIngo Weinhold			posix_gnu_ctype.o
6838f62644SIngo Weinhold			posix_gnu_ext.o
6987e239b9SJérôme Duval			posix_gnu_iconv.o
7038f62644SIngo Weinhold			posix_gnu_libio.o
7138f62644SIngo Weinhold			posix_gnu_locale.o
7287e239b9SJérôme Duval			posix_gnu_misc.o
7338f62644SIngo Weinhold			posix_gnu_regex.o
7438f62644SIngo Weinhold			posix_gnu_stdio.o
7538f62644SIngo Weinhold			posix_gnu_stdlib.o
76cc87b419SJérôme Duval			posix_gnu_string.o
7738f62644SIngo Weinhold			posix_gnu_wcsmbs.o
7838f62644SIngo Weinhold			posix_stdlib.o
7938f62644SIngo Weinhold			posix_string.o
80831486a2STravis Geiselbrecht			posix_string_arch_$(TARGET_ARCH).o
8138f62644SIngo Weinhold			posix_sys.o
8238f62644SIngo Weinhold			posix_time.o
8338f62644SIngo Weinhold			posix_unistd.o
8472cf60a5SOliver Tappe			posix_wchar.o
855af32e75SAxel Dörfler			;
86b0944c78SIngo Weinhold		librootObjects = $(librootObjects:G=$(architecture)) ;
875af32e75SAxel Dörfler
88448671a3SIngo Weinhold		local librootDebugObjects =
89448671a3SIngo Weinhold			posix_malloc_debug.o
90448671a3SIngo Weinhold			;
91b0944c78SIngo Weinhold		librootDebugObjects = $(librootDebugObjects:G=$(architecture)) ;
92448671a3SIngo Weinhold
93448671a3SIngo Weinhold		local librootNoDebugObjects =
94448671a3SIngo Weinhold			posix_malloc.o
95448671a3SIngo Weinhold			;
96b0944c78SIngo Weinhold		librootNoDebugObjects = $(librootNoDebugObjects:G=$(architecture)) ;
97448671a3SIngo Weinhold
98b0944c78SIngo Weinhold		local libroot = [ MultiArchDefaultGristFiles libroot.so ] ;
99b0944c78SIngo Weinhold		local librootDebug = $(libroot:B=libroot_debug) ;
100353d20c0SIngo Weinhold
101b0944c78SIngo Weinhold		DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ;
102b0944c78SIngo Weinhold		DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ;
103ef3966e8SIngo Weinhold
104b0944c78SIngo Weinhold		SetVersionScript $(libroot) : libroot_versions ;
105b0944c78SIngo Weinhold		SetVersionScript $(librootDebug) : libroot_versions ;
106b0944c78SIngo Weinhold
107b0944c78SIngo Weinhold		SharedLibrary $(libroot)
10838f62644SIngo Weinhold			:
10938f62644SIngo Weinhold			libroot_init.c
11038f62644SIngo Weinhold			:
111b0944c78SIngo Weinhold			$(librootObjects)
112b0944c78SIngo Weinhold			$(librootNoDebugObjects)
113b0944c78SIngo Weinhold			$(HAIKU_STATIC_LIBSUPC++_$(architecture))
114448671a3SIngo Weinhold			;
115448671a3SIngo Weinhold
116b0944c78SIngo Weinhold		# Use the standard libroot.so soname, so when the debug version is
117b0944c78SIngo Weinhold		# pre-loaded it prevents the standard version to be loaded as well.
118b0944c78SIngo Weinhold		HAIKU_SONAME on $(librootDebug) = libroot.so ;
119448671a3SIngo Weinhold
120b0944c78SIngo Weinhold		SharedLibrary $(librootDebug)
121448671a3SIngo Weinhold			:
122448671a3SIngo Weinhold			libroot_init.c
123448671a3SIngo Weinhold			:
124b0944c78SIngo Weinhold			$(librootObjects)
125b0944c78SIngo Weinhold			$(librootDebugObjects)
126b0944c78SIngo Weinhold			$(HAIKU_STATIC_LIBSUPC++_$(architecture))
1275af32e75SAxel Dörfler			;
1285af32e75SAxel Dörfler
129a4e0c1d4SIngo Weinhold
130b0944c78SIngo Weinhold		# Copy libroot.so and update the copy's revision section. We link
131b0944c78SIngo Weinhold		# everything against the original, but the copy will end up on the disk
132b0944c78SIngo Weinhold		# image (this way we avoid unnecessary dependencies). The copy will be
133b0944c78SIngo Weinhold		# located in a subdirectory.
134a4e0c1d4SIngo Weinhold		if $(TARGET_PLATFORM) = haiku {
135b0944c78SIngo Weinhold			local targetDir = [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET)
136b0944c78SIngo Weinhold				revisioned ] ;
137b0944c78SIngo Weinhold			local revisionedLibroot = [ MultiArchDefaultGristFiles
138b0944c78SIngo Weinhold				libroot.so : revisioned ] ;
139b0944c78SIngo Weinhold			local revisionedLibrootDebug
140b0944c78SIngo Weinhold				= $(librootDebug:G=$(revisionedLibroot:G)) ;
141448671a3SIngo Weinhold
142b0944c78SIngo Weinhold			MakeLocate $(revisionedLibroot) : $(targetDir) ;
143b0944c78SIngo Weinhold			CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ;
144b0944c78SIngo Weinhold
145b0944c78SIngo Weinhold			MakeLocate $(revisionedLibrootDebug) : $(targetDir) ;
146b0944c78SIngo Weinhold			CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ;
147a4e0c1d4SIngo Weinhold		}
148b0944c78SIngo Weinhold	}
149b0944c78SIngo Weinhold}
150a4e0c1d4SIngo Weinhold
151a3f66598SOliver TappeSubInclude HAIKU_TOP src system libroot add-ons ;
152338b8dc3SIngo WeinholdSubInclude HAIKU_TOP src system libroot os ;
153338b8dc3SIngo WeinholdSubInclude HAIKU_TOP src system libroot posix ;
154