diff --git a/src/system/Jamfile b/src/system/Jamfile index 22ba2ded38..ac215689e0 100644 --- a/src/system/Jamfile +++ b/src/system/Jamfile @@ -1,173 +1,5 @@ SubDir HAIKU_TOP src system ; -KernelLd boot_loader : - boot_platform_$(TARGET_BOOT_PLATFORM).o - boot_loader.a - boot_partitions.a - - # file systems - boot_bfs.a - boot_amiga_ffs.a - boot_tarfs.a - - libz.a - - # libroot functions needed by the stage2 boot loader - <$(SOURCE_GRIST)!libroot!os!arch!$(TARGET_ARCH)>byteorder.o - <$(SOURCE_GRIST)!libroot>ctype.o - <$(SOURCE_GRIST)!libroot>kernel_vsprintf.o - <$(SOURCE_GRIST)!libroot!posix!string>memset.o - <$(SOURCE_GRIST)!libroot!posix!string>memcmp.o - <$(SOURCE_GRIST)!libroot!posix!string>memcpy.o - <$(SOURCE_GRIST)!libroot!posix!string>memmove.o - <$(SOURCE_GRIST)!libroot!posix!string>strdup.o - <$(SOURCE_GRIST)!libroot!posix!string>strlen.o - <$(SOURCE_GRIST)!libroot!posix!string>strnlen.o - <$(SOURCE_GRIST)!libroot!posix!string>strcmp.o - <$(SOURCE_GRIST)!libroot!posix!string>strcasecmp.o - <$(SOURCE_GRIST)!libroot!posix!string>strncmp.o - <$(SOURCE_GRIST)!libroot!posix!string>strcat.o - <$(SOURCE_GRIST)!libroot!posix!string>strcpy.o - <$(SOURCE_GRIST)!libroot!posix!string>strlcat.o - <$(SOURCE_GRIST)!libroot!posix!string>strlcpy.o - <$(SOURCE_GRIST)!libroot!posix!string>strchr.o - <$(SOURCE_GRIST)!libroot!posix!string>strrchr.o - <$(SOURCE_GRIST)!libroot!posix!stdlib>strtol.o - <$(SOURCE_GRIST)!libroot>qsort.o - <$(SOURCE_GRIST)!kernel!arch!$(TARGET_ARCH)>cpuid.o - : $(SUBDIR)/ldscripts/$(TARGET_ARCH)/boot_loader.ld - : -Bstatic - ; - -rule BuildZbeos { - local zbeos = $(1) ; - local bootLoader = $(2) ; - - Depends $(zbeos) : $(bootLoader) ; - MakeLocateDebug $(zbeos) ; -} - -actions BuildZbeos { - rm -f $(1) - $(TARGET_OBJCOPY) -O binary $(2) $(1) -} - -BuildZbeos zbeos : boot_loader ; - -KernelLd stage2 : - boot_arch_stage2.o - - # posix functions needed by the stage2 boot loader - <$(SOURCE_GRIST)!libroot>ctype.o - <$(SOURCE_GRIST)!libroot>kernel_vsprintf.o - <$(SOURCE_GRIST)!libroot!posix!string>memset.o - <$(SOURCE_GRIST)!libroot!posix!string>memcpy.o - <$(SOURCE_GRIST)!libroot!posix!string>strnlen.o - : $(SUBDIR)/ldscripts/$(TARGET_ARCH)/stage2.ld - : -dN - : - ; - -KernelLd kernel_$(TARGET_ARCH) : - kernel_core.o - kernel_fs.o - kernel_vm.o - kernel_cache.o - kernel_device_manager.o - kernel_disk_device_manager.o - kernel_util.o - kernel_messaging.o - kernel_debug.o - - lib$(TARGET_ARCH).a - - linkhack.so - - # kernel libroot parts - kernel_os_main.o - kernel_os_arch_$(TARGET_ARCH).o - kernel_posix.o - - $(HAIKU_STATIC_LIBSUPC++) - - : $(SUBDIR)/ldscripts/$(TARGET_ARCH)/kernel.ld - : -Bdynamic -export-dynamic -dynamic-linker /foo/bar - : - ; - -KernelLd kernel.so : - kernel_core.o - kernel_fs.o - kernel_vm.o - kernel_cache.o - kernel_device_manager.o - kernel_disk_device_manager.o - kernel_util.o - kernel_messaging.o - kernel_debug.o - - lib$(TARGET_ARCH).a - - linkhack.so - - # kernel libroot parts - kernel_os_main.o - kernel_os_arch_$(TARGET_ARCH).o - kernel_posix.o - - $(HAIKU_STATIC_LIBSUPC++) - - : $(SUBDIR)/ldscripts/$(TARGET_ARCH)/kernel.ld - : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar - ; - -UnarchiveObjects $(TARGET_GCC_LIBGCC_OBJECTS) : $(TARGET_GCC_LIBGCC) ; - # we need to link against libgcc.a objects and make - # it available to other applications as in BeOS - -local librootObjects = - os_main.o - os_arch_$(TARGET_ARCH).o - - posix_arch_$(TARGET_ARCH).o - posix_crypt.o - posix_locale.o - posix_main.o - posix_malloc.o - posix_math.o - posix_math_arch_$(TARGET_ARCH).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_libio.o - posix_gnu_locale.o - posix_gnu_regex.o - posix_gnu_stdio.o - posix_gnu_stdlib.o - posix_gnu_wcsmbs.o - posix_gnu_wctype.o - posix_stdlib.o - posix_string.o - posix_sys.o - posix_time.o - posix_unistd.o -; - -SharedLibraryFromObjects libroot.so : : - $(TARGET_GCC_LIBGCC_OBJECTS) - <$(SOURCE_GRIST)!libroot>libroot_init.o - - $(librootObjects:G=nogrist) -; - -NotFile kernel ; -Depends kernel : kernel_$(TARGET_ARCH) ; -Depends kernel.so : kernel ; - # kernel.so will be rebuilt with the kernel - SubInclude HAIKU_TOP src system boot ; SubInclude HAIKU_TOP src system kernel ; SubInclude HAIKU_TOP src system glue ; diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 74c94b2d3a..1669c934c3 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -1,4 +1,72 @@ SubDir HAIKU_TOP src system boot ; +KernelObjects byteorder.S ; + +SEARCH on [ FGristFiles byteorder.S ] + = [ FDirName $(HAIKU_TOP) src system libroot os arch $(TARGET_ARCH) ] ; + +local librootFunctions = + ctype.o + qsort.o + kernel_vsprintf.o + memset.o + memcmp.o + memcpy.o + memmove.o + strdup.o + strlen.o + strnlen.o + strcmp.o + strcasecmp.o + strncmp.o + strcat.o + strcpy.o + strlcat.o + strlcpy.o + strchr.o + strrchr.o + strtol.o +; + +KernelLd boot_loader : + boot_platform_$(TARGET_BOOT_PLATFORM).o + boot_loader.a + boot_partitions.a + + # file systems + boot_bfs.a + boot_amiga_ffs.a + boot_tarfs.a + + libz.a + + # libroot functions needed by the stage2 boot loader (compiled for the + # kernel) + $(librootFunctions:G=src!system!kernel!lib) + + [ FGristFiles byteorder.o ] + + # other kernel objects + cpuid.o + + : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader.ld + : -Bstatic + ; + +rule BuildZbeos { + local zbeos = $(1) ; + local bootLoader = $(2) ; + + Depends $(zbeos) : $(bootLoader) ; + MakeLocateDebug $(zbeos) ; +} + +actions BuildZbeos { + rm -f $(1) + $(TARGET_OBJCOPY) -O binary $(2) $(1) +} + +BuildZbeos zbeos : boot_loader ; + SubInclude HAIKU_TOP src system boot platform ; SubInclude HAIKU_TOP src system boot loader ; diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index 45d29409e1..be1a9d86a6 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -38,7 +38,7 @@ KernelMergeObject kernel_core.o : timer.c : -fno-pic - ; +; # We need to specify the dependency on the generated syscalls files explicitly. Includes [ FGristFiles syscalls.c ] @@ -49,7 +49,66 @@ KernelLd linkhack.so : : : -shared -Bdynamic - ; +; + +KernelLd kernel_$(TARGET_ARCH) : + kernel_core.o + kernel_fs.o + kernel_vm.o + kernel_cache.o + kernel_device_manager.o + kernel_disk_device_manager.o + kernel_util.o + kernel_messaging.o + kernel_debug.o + + lib$(TARGET_ARCH).a + + linkhack.so + + # kernel libroot parts + kernel_os_main.o + kernel_os_arch_$(TARGET_ARCH).o + kernel_posix.o + + $(HAIKU_STATIC_LIBSUPC++) + + : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld + : -Bdynamic -export-dynamic -dynamic-linker /foo/bar + : +; + +KernelLd kernel.so : + kernel_core.o + kernel_fs.o + kernel_vm.o + kernel_cache.o + kernel_device_manager.o + kernel_disk_device_manager.o + kernel_util.o + kernel_messaging.o + kernel_debug.o + + lib$(TARGET_ARCH).a + + linkhack.so + + # kernel libroot parts + kernel_os_main.o + kernel_os_arch_$(TARGET_ARCH).o + kernel_posix.o + + $(HAIKU_STATIC_LIBSUPC++) + + : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld + : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar +; + +NotFile kernel ; +Depends kernel : kernel_$(TARGET_ARCH) ; +Depends kernel.so : kernel ; + # kernel.so will be rebuilt with the kernel + SubInclude HAIKU_TOP src system kernel arch ; SubInclude HAIKU_TOP src system kernel cache ; @@ -57,6 +116,7 @@ SubInclude HAIKU_TOP src system kernel device_manager ; SubInclude HAIKU_TOP src system kernel debug ; SubInclude HAIKU_TOP src system kernel disk_device_manager ; SubInclude HAIKU_TOP src system kernel fs ; +SubInclude HAIKU_TOP src system kernel lib ; SubInclude HAIKU_TOP src system kernel messaging ; SubInclude HAIKU_TOP src system kernel util ; SubInclude HAIKU_TOP src system kernel vm ; diff --git a/src/system/kernel/lib/Jamfile b/src/system/kernel/lib/Jamfile new file mode 100644 index 0000000000..67ca4d4d19 --- /dev/null +++ b/src/system/kernel/lib/Jamfile @@ -0,0 +1,112 @@ +SubDir HAIKU_TOP src system kernel lib ; + +#UsePrivateHeaders libroot ; + +# kernel libroot os files + +# until the build system is fixed (and no longer uses kernel build rules +# for libroot.so), the KERNEL_OS_MAIN is needed to differentiate between +# kernel and userland builds here + +KernelMergeObject kernel_os_main.o : + driver_settings.c + fs_info.c + : -fno-pic -DKERNEL_OS_MAIN +; + +SEARCH on [ FGristFiles driver_settings.c fs_info.c ] + = [ FDirName $(HAIKU_TOP) src system libroot os ] ; + +# kernel libroot posix files + +local posixSources = [ FDirName $(HAIKU_TOP) src system libroot posix ] ; + +SEARCH_SOURCE += [ FDirName $(posixSources) ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) locale ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) stdio ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) stdlib ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) string ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) sys ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) time ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) unistd ] ; + +KernelMergeObject kernel_posix.o : + # main + kerrno.c + dirent.c + poll.c + utime.c + # locale + ctype.c + # stdio (this subdir) + kernel_vsprintf.c + # stdlib + abs.c + atoi.c + bsearch.c + merge.c + qsort.c + rand.c + random.c + strtol.c + strtoll.c + strtoul.c + strtoull.c + # sys + chmod.c + stat.c + mkdir.c + select.c + gettimeofday.c + uio.c + # time + time.c + # unistd + access.c + chown.c + close.c + conf.c + directory.c + dup.c + fcntl.c + hostname.c + ioctl.c + link.c + lseek.c + mount.c + open.c + read.c + sync.c + truncate.c + usergroup.c + write.c + # string + memchr.c + memcmp.c + memcpy.c + memmove.c + memset.c + strcasecmp.c + strcasestr.c + strcat.c + strchr.c + strcmp.c + strcpy.c + strcspn.c + strdup.c + strerror.c + strlcat.c + strlcpy.c + strlen.c + strncat.c + strncmp.c + strncpy.c + strnlen.c + strpbrk.c + strrchr.c + strspn.c + strstr.c + strtok.c + + : -fno-pic +; diff --git a/src/system/libroot/posix/stdio/kernel_vsprintf.c b/src/system/kernel/lib/kernel_vsprintf.c similarity index 100% rename from src/system/libroot/posix/stdio/kernel_vsprintf.c rename to src/system/kernel/lib/kernel_vsprintf.c diff --git a/src/system/libroot/Jamfile b/src/system/libroot/Jamfile index 5c401fe855..8ded7d9cc5 100644 --- a/src/system/libroot/Jamfile +++ b/src/system/libroot/Jamfile @@ -1,119 +1,51 @@ SubDir HAIKU_TOP src system libroot ; UsePrivateHeaders libroot ; +UsePrivateHeaders kernel ; -KernelObjects - <$(SOURCE_GRIST)>libroot_init.c - : -fPIC -DPIC - ; +UnarchiveObjects $(TARGET_GCC_LIBGCC_OBJECTS) : $(TARGET_GCC_LIBGCC) ; + # we need to link against libgcc.a objects and make + # it available to other applications as in BeOS -# kernel libroot os files +local librootObjects = + os_main.o + os_arch_$(TARGET_ARCH).o -# until the build system is fixed (and no longer uses kernel build rules -# for libroot.so), the KERNEL_OS_MAIN is needed to differentiate between -# kernel and userland builds here + posix_arch_$(TARGET_ARCH).o + posix_crypt.o + posix_locale.o + posix_main.o + posix_malloc.o + posix_math.o + posix_math_arch_$(TARGET_ARCH).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_libio.o + posix_gnu_locale.o + posix_gnu_regex.o + posix_gnu_stdio.o + posix_gnu_stdlib.o + posix_gnu_wcsmbs.o + posix_gnu_wctype.o + posix_stdlib.o + posix_string.o + posix_sys.o + posix_time.o + posix_unistd.o +; -KernelMergeObject kernel_os_main.o : - driver_settings.c - fs_info.c - : -fno-pic -DKERNEL_OS_MAIN - ; +SharedLibrary libroot.so + : + libroot_init.c + : + $(TARGET_GCC_LIBGCC_OBJECTS) -SEARCH on [ FGristFiles - driver_settings.c fs_info.c - ] = [ FDirName $(HAIKU_TOP) src system libroot os ] ; - -# kernel libroot posix files - -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix locale ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix stdio ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix stdlib ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix string ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix sys ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix time ] ; -SEARCH_SOURCE += [ FDirName $(SUBDIR) posix unistd ] ; - -KernelMergeObject kernel_posix.o : - # main - kerrno.c - dirent.c - poll.c - utime.c - # locale - ctype.c - # stdio - kernel_vsprintf.c - # stdlib - abs.c - atoi.c - bsearch.c - merge.c - qsort.c - rand.c - random.c - strtol.c - strtoll.c - strtoul.c - strtoull.c - # sys - chmod.c - stat.c - mkdir.c - select.c - gettimeofday.c - uio.c - # time - time.c - # unistd - access.c - chown.c - close.c - conf.c - directory.c - dup.c - fcntl.c - hostname.c - ioctl.c - link.c - lseek.c - mount.c - open.c - read.c - sync.c - truncate.c - usergroup.c - write.c - # string - memchr.c - memcmp.c - memcpy.c - memmove.c - memset.c - strcasecmp.c - strcasestr.c - strcat.c - strchr.c - strcmp.c - strcpy.c - strcspn.c - strdup.c - strerror.c - strlcat.c - strlcpy.c - strlen.c - strncat.c - strncmp.c - strncpy.c - strnlen.c - strpbrk.c - strrchr.c - strspn.c - strstr.c - strtok.c - - : -fno-pic - ; + $(librootObjects:G=nogrist) +; SubInclude HAIKU_TOP src system libroot os ; SubInclude HAIKU_TOP src system libroot posix ; diff --git a/src/system/runtime_loader/Jamfile b/src/system/runtime_loader/Jamfile index 07f946f7ca..cd09e391ee 100644 --- a/src/system/runtime_loader/Jamfile +++ b/src/system/runtime_loader/Jamfile @@ -9,7 +9,14 @@ KernelObjects rldelf.c rldheap.c rldaux.c - : -fpic ; + + kernel_vsprintf.c + + : -fpic +; + +SEARCH on [ FGristFiles kernel_vsprintf.c ] + = [ FDirName $(HAIKU_TOP) src system kernel lib ] ; KernelStaticLibraryObjects librld.a : # needed for rld.so only @@ -23,7 +30,6 @@ KernelStaticLibraryObjects librld.a : ctype-info.o C-ctype.o C_name.o - kernel_vsprintf.o open.o memchr.o @@ -48,16 +54,13 @@ KernelStaticLibraryObjects librld.a : strrchr.o strspn.o strstr.o - ; +; KernelLd rld.so : - <$(SOURCE_GRIST)>rld.o - <$(SOURCE_GRIST)>rldelf.o - <$(SOURCE_GRIST)>rldexport.o - <$(SOURCE_GRIST)>rldheap.o - <$(SOURCE_GRIST)>rldaux.o + [ FGristFiles rld.o rldelf.o rldexport.o rldheap.o rldaux.o + kernel_vsprintf.o ] librld.a : $(SUBDIR)/arch/$(TARGET_ARCH)/rld.ld : : - ; +;