SubDir HAIKU_TOP src system libroot ; UsePrivateHeaders libroot runtime_loader ; rule FilterArchive { # FilterArchive : : # set the tools according to the platform AR on $(1) = $(TARGET_AR_$(TARGET_PACKAGING_ARCH)) d ; # TODO: use $(TARGET_DELARFLAGS_$(TARGET_PACKAGING_ARCH)) RANLIB on $(1) = $(TARGET_RANLIB_$(TARGET_PACKAGING_ARCH)) ; MEMBERS on $(1) = $(3) ; MakeLocateArch $(1) ; Depends $(1) : $(2) ; File $(1) : $(2) ; # delete the unwanted members FilterArchive1 $(1) ; if $(RANLIB) { Ranlib $(1) ; } } actions FilterArchive1 { $(AR) $(<) $(MEMBERS) } local architectureObject ; for architectureObject in [ MultiArchSubDirSetup ] { on $(architectureObject) { local architecture = $(TARGET_PACKAGING_ARCH) ; UsePrivateSystemHeaders ; # Make a copy of libgcc without the objects we don't need FilterArchive <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a : $(HAIKU_GCC_LIBGCC_$(architecture)) : $(HAIKU_GCC_LIBGCC_OBJECTS_EXCLUDES_$(architecture)) ; # One object to link them all... TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH) on <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o = [ on <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o return $(TARGET_LDFLAGS_$(TARGET_PACKAGING_ARCH)) ] --whole-archive ; MergeObject <$(architecture)>libroot_libgcc_$(TARGET_ARCH).o : : <$(architecture)>libroot_libgcc_$(TARGET_ARCH).a ; local librootObjects = libroot_libgcc_$(TARGET_ARCH).o os_main.o os_arch_$(TARGET_ARCH).o posix_arch_$(TARGET_ARCH).o posix_crypt.o posix_locale.o posix_main.o posix_pthread.o posix_signal.o posix_stdio.o posix_gnu_arch_$(TARGET_ARCH).o posix_gnu_ctype.o posix_gnu_ext.o posix_gnu_iconv.o posix_gnu_libio.o posix_gnu_locale.o posix_gnu_misc.o posix_gnu_regex.o posix_gnu_stdio.o posix_gnu_stdlib.o posix_gnu_string.o posix_gnu_wcsmbs.o posix_stdlib.o posix_string.o posix_string_arch_$(TARGET_ARCH).o posix_sys.o posix_time.o posix_unistd.o posix_wchar.o ; librootObjects = $(librootObjects:G=$(architecture)) ; local librootDebugObjects = posix_malloc_debug.o ; librootDebugObjects = $(librootDebugObjects:G=$(architecture)) ; local librootNoDebugObjects = posix_malloc.o ; librootNoDebugObjects = $(librootNoDebugObjects:G=$(architecture)) ; local libroot = [ MultiArchDefaultGristFiles libroot.so ] ; local librootDebug = $(libroot:B=libroot_debug) ; DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ; DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ; SetVersionScript $(libroot) : libroot_versions ; SetVersionScript $(librootDebug) : libroot_versions ; SharedLibrary $(libroot) : libroot_init.c : $(librootObjects) $(librootNoDebugObjects) $(HAIKU_STATIC_LIBSUPC++_$(architecture)) ; # Use the standard libroot.so soname, so when the debug version is # pre-loaded it prevents the standard version to be loaded as well. HAIKU_SONAME on $(librootDebug) = libroot.so ; SharedLibrary $(librootDebug) : libroot_init.c : $(librootObjects) $(librootDebugObjects) $(HAIKU_STATIC_LIBSUPC++_$(architecture)) ; # Copy libroot.so and update the copy's revision section. We link # everything against the original, but the copy will end up on the disk # image (this way we avoid unnecessary dependencies). The copy will be # located in a subdirectory. if $(TARGET_PLATFORM) = haiku { local targetDir = [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; local revisionedLibroot = [ MultiArchDefaultGristFiles libroot.so : revisioned ] ; local revisionedLibrootDebug = $(librootDebug:G=$(revisionedLibroot:G)) ; MakeLocate $(revisionedLibroot) : $(targetDir) ; CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ; MakeLocate $(revisionedLibrootDebug) : $(targetDir) ; CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ; } } } SubInclude HAIKU_TOP src system libroot add-ons ; SubInclude HAIKU_TOP src system libroot os ; SubInclude HAIKU_TOP src system libroot posix ;