1SubDir HAIKU_TOP src system kernel ; 2 3{ 4 local defines = 5 HAIKU_ARCH=\\\"$(TARGET_ARCH)\\\" 6 ; 7 8 defines = [ FDefines $(defines) ] ; 9 SubDirCcFlags $(defines) ; 10 SubDirC++Flags $(defines) ; 11} 12 13SEARCH_SOURCE += [ FDirName $(SUBDIR) locks ] ; 14SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ; 15 16UsePrivateHeaders libroot ; 17UsePrivateHeaders shared ; 18UsePrivateHeaders runtime_loader ; 19 20AddResources kernel_$(TARGET_ARCH) : kernel.rdef ; 21 22SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ; 23SetVersionScript kernel.so : kernel_versions ; 24 25KernelMergeObject kernel_core.o : 26 boot_item.cpp 27 boot_splash.cpp 28 commpage.cpp 29 condition_variable.cpp 30 convertutf.cpp 31 cpu.cpp 32 DPC.cpp 33 elf.cpp 34 guarded_heap.cpp 35 heap.cpp 36 image.cpp 37 int.cpp 38 kernel_daemon.cpp 39 linkhack.c 40 listeners.cpp 41 low_resource_manager.cpp 42 main.cpp 43 module.cpp 44 Notifications.cpp 45 port.cpp 46 real_time_clock.cpp 47 sem.cpp 48 shutdown.cpp 49 signal.cpp 50 stack_protector.cpp 51 system_info.cpp 52 smp.cpp 53 syscalls.cpp 54 team.cpp 55 thread.cpp 56 timer.cpp 57 UserEvent.cpp 58 usergroup.cpp 59 UserTimer.cpp 60 wait_for_objects.cpp 61 62 # locks 63 lock.cpp 64 user_mutex.cpp 65 66 # scheduler 67 low_latency.cpp 68 power_saving.cpp 69 scheduler.cpp 70 scheduler_cpu.cpp 71 scheduler_profiler.cpp 72 scheduler_thread.cpp 73 scheduler_tracing.cpp 74 scheduling_analysis.cpp 75 76 : $(TARGET_KERNEL_PIC_CCFLAGS) 77; 78 79# Generate the header defining macros for C++ structure sizes. 80local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ; 81TARGET_HDRS_$(TARGET_KERNEL_ARCH) on $(kernelC++StructSizesHeader) 82 = [ on $(kernelC++StructSizesHeader) 83 return $(TARGET_HDRS_$(TARGET_KERNEL_ARCH)) ] 84 $(TARGET_PRIVATE_KERNEL_HEADERS) ; 85CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader) 86 : kernel_c++_structs.cpp : $(TARGET_KERNEL_ARCH) ; 87 88# We need to specify the dependency on the generated syscalls files explicitly. 89Includes [ FGristFiles syscalls.cpp ] 90 : 91 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_dispatcher.h 92 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_table.h 93 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_numbers.h 94; 95 96KernelLd linkhack.so : 97 <$(SOURCE_GRIST)>linkhack.o 98 : 99 : 100 -shared -Bdynamic 101; 102 103KernelLd kernel_$(TARGET_ARCH) : 104 kernel_cache.o 105 kernel_core.o 106 kernel_debug.o 107 kernel_device_manager.o 108 kernel_disk_device_manager.o 109 kernel_fs.o 110 kernel_messaging.o 111 kernel_posix.o 112 kernel_slab.o 113 kernel_util.o 114 kernel_vm.o 115 116 kernel_arch_$(TARGET_KERNEL_ARCH).o 117 kernel_platform_$(TARGET_KERNEL_PLATFORM).o 118 119 linkhack.so 120 121 # kernel parts borrowed from libroot and others 122 kernel_os_main.o 123 kernel_os_arch_$(TARGET_ARCH).o 124 kernel_lib_posix.o 125 kernel_lib_posix_arch_$(TARGET_ARCH).o 126 kernel_misc.o 127 128 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 129 : -Bdynamic -export-dynamic -dynamic-linker /foo/bar 130 $(TARGET_KERNEL_PIC_LINKFLAGS) 131 : 132; 133 134if $(HAIKU_ARCH) in x86_64 arm { 135 # Cannot relink everything as a shared object on x86_64 as shared library 136 # code is required to be position-independent. Instead create a copy of the 137 # executable kernel image and change the ELF header type to DYN. A bit of 138 # a hack, but avoids having to recompile a PIC copy of the kernel code. 139 # kernel.so is only used when linking modules to provide symbol information, 140 # this is sufficient for that purpose. 141 KernelSo kernel.so : kernel_$(TARGET_ARCH) ; 142} else { 143 KernelLd kernel.so : 144 kernel_cache.o 145 kernel_core.o 146 kernel_debug.o 147 kernel_device_manager.o 148 kernel_disk_device_manager.o 149 kernel_fs.o 150 kernel_messaging.o 151 kernel_posix.o 152 kernel_slab.o 153 kernel_util.o 154 kernel_vm.o 155 156 kernel_arch_$(TARGET_KERNEL_ARCH).o 157 kernel_platform_$(TARGET_KERNEL_PLATFORM).o 158 159 linkhack.so 160 161 # kernel libroot parts 162 kernel_os_main.o 163 kernel_os_arch_$(TARGET_ARCH).o 164 kernel_lib_posix.o 165 kernel_lib_posix_arch_$(TARGET_ARCH).o 166 kernel_misc.o 167 168 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld 169 : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar 170 $(TARGET_KERNEL_PIC_LINKFLAGS) 171 ; 172} 173 174NotFile kernel ; 175Depends kernel : kernel_$(TARGET_ARCH) ; 176Depends kernel.so : kernel ; 177 # kernel.so will be rebuilt with the kernel 178 179# propagate the container update variable from kernel to kernel_$(TARGET_ARCH) 180PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ; 181 182# Copy kernel and update the copy's revision section. We link everything 183# against the original, but the copy will end up on the disk image (this way 184# we avoid unnecessary dependencies). The copy will be located in a subdirectory. 185if $(TARGET_PLATFORM) = haiku { 186 MakeLocate <revisioned>kernel_$(TARGET_ARCH) 187 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ; 188 CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH) 189 : kernel_$(TARGET_ARCH) ; 190} 191 192 193SubInclude HAIKU_TOP src system kernel arch ; 194SubInclude HAIKU_TOP src system kernel cache ; 195SubInclude HAIKU_TOP src system kernel device_manager ; 196SubInclude HAIKU_TOP src system kernel debug ; 197SubInclude HAIKU_TOP src system kernel disk_device_manager ; 198SubInclude HAIKU_TOP src system kernel fs ; 199SubInclude HAIKU_TOP src system kernel lib ; 200SubInclude HAIKU_TOP src system kernel messaging ; 201SubInclude HAIKU_TOP src system kernel posix ; 202SubInclude HAIKU_TOP src system kernel slab ; 203SubInclude HAIKU_TOP src system kernel util ; 204SubInclude HAIKU_TOP src system kernel vm ; 205 206if $(TARGET_KERNEL_PLATFORM) { 207 SubInclude HAIKU_TOP src system kernel platform $(TARGET_KERNEL_PLATFORM) ; 208} 209