SubDir HAIKU_TOP src system kernel ; { local defines = HAIKU_ARCH=\\\"$(TARGET_ARCH)\\\" ; defines = [ FDefines $(defines) ] ; SubDirCcFlags $(defines) ; SubDirC++Flags $(defines) ; } SEARCH_SOURCE += [ FDirName $(SUBDIR) locks ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ; UsePrivateHeaders libroot ; UsePrivateHeaders shared ; UsePrivateHeaders runtime_loader ; AddResources kernel_$(TARGET_ARCH) : kernel.rdef ; SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ; SetVersionScript kernel.so : kernel_versions ; KernelMergeObject kernel_core.o : boot_item.cpp boot_splash.cpp commpage.cpp condition_variable.cpp convertutf.cpp cpu.cpp DPC.cpp elf.cpp guarded_heap.cpp heap.cpp image.cpp int.cpp kernel_daemon.cpp linkhack.c listeners.cpp low_resource_manager.cpp main.cpp module.cpp Notifications.cpp port.cpp real_time_clock.cpp sem.cpp shutdown.cpp signal.cpp stack_protector.cpp system_info.cpp smp.cpp syscalls.cpp team.cpp thread.cpp timer.cpp UserEvent.cpp usergroup.cpp UserTimer.cpp wait_for_objects.cpp # locks lock.cpp user_mutex.cpp # scheduler low_latency.cpp power_saving.cpp scheduler.cpp scheduler_cpu.cpp scheduler_profiler.cpp scheduler_thread.cpp scheduler_tracing.cpp scheduling_analysis.cpp : $(TARGET_KERNEL_PIC_CCFLAGS) ; # Generate the header defining macros for C++ structure sizes. local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ; TARGET_HDRS_$(TARGET_KERNEL_ARCH) on $(kernelC++StructSizesHeader) = [ on $(kernelC++StructSizesHeader) return $(TARGET_HDRS_$(TARGET_KERNEL_ARCH)) ] $(TARGET_PRIVATE_KERNEL_HEADERS) ; CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader) : kernel_c++_structs.cpp : $(TARGET_KERNEL_ARCH) ; # We need to specify the dependency on the generated syscalls files explicitly. Includes [ FGristFiles syscalls.cpp ] : syscall_dispatcher.h syscall_table.h syscall_numbers.h ; KernelLd linkhack.so : <$(SOURCE_GRIST)>linkhack.o : : -shared -Bdynamic ; KernelLd kernel_$(TARGET_ARCH) : kernel_cache.o kernel_core.o kernel_debug.o kernel_device_manager.o kernel_disk_device_manager.o kernel_fs.o kernel_messaging.o kernel_posix.o kernel_slab.o kernel_util.o kernel_vm.o kernel_arch_$(TARGET_KERNEL_ARCH).o kernel_platform_$(TARGET_KERNEL_PLATFORM).o linkhack.so # kernel parts borrowed from libroot and others kernel_os_main.o kernel_os_arch_$(TARGET_ARCH).o kernel_lib_posix.o kernel_lib_posix_arch_$(TARGET_ARCH).o kernel_misc.o : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld : -Bdynamic -export-dynamic -dynamic-linker /foo/bar $(TARGET_KERNEL_PIC_LINKFLAGS) --no-undefined : ; if $(HAIKU_ARCH) in x86_64 arm { # Cannot relink everything as a shared object on x86_64 as shared library # code is required to be position-independent. Instead create a copy of the # executable kernel image and change the ELF header type to DYN. A bit of # a hack, but avoids having to recompile a PIC copy of the kernel code. # kernel.so is only used when linking modules to provide symbol information, # this is sufficient for that purpose. KernelSo kernel.so : kernel_$(TARGET_ARCH) ; } else { KernelLd kernel.so : kernel_cache.o kernel_core.o kernel_debug.o kernel_device_manager.o kernel_disk_device_manager.o kernel_fs.o kernel_messaging.o kernel_posix.o kernel_slab.o kernel_util.o kernel_vm.o kernel_arch_$(TARGET_KERNEL_ARCH).o kernel_platform_$(TARGET_KERNEL_PLATFORM).o linkhack.so # kernel libroot parts kernel_os_main.o kernel_os_arch_$(TARGET_ARCH).o kernel_lib_posix.o kernel_lib_posix_arch_$(TARGET_ARCH).o kernel_misc.o : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar $(TARGET_KERNEL_PIC_LINKFLAGS) ; } NotFile kernel ; Depends kernel : kernel_$(TARGET_ARCH) ; Depends kernel.so : kernel ; # kernel.so will be rebuilt with the kernel # propagate the container update variable from kernel to kernel_$(TARGET_ARCH) PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ; # Copy kernel 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 { MakeLocate kernel_$(TARGET_ARCH) : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; CopySetHaikuRevision kernel_$(TARGET_ARCH) : kernel_$(TARGET_ARCH) ; } SubInclude HAIKU_TOP src system kernel arch ; SubInclude HAIKU_TOP src system kernel cache ; 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 posix ; SubInclude HAIKU_TOP src system kernel slab ; SubInclude HAIKU_TOP src system kernel util ; SubInclude HAIKU_TOP src system kernel vm ; if $(TARGET_KERNEL_PLATFORM) { SubInclude HAIKU_TOP src system kernel platform $(TARGET_KERNEL_PLATFORM) ; }