1 SubDir HAIKU_TOP src system kernel ;
5 HAIKU_ARCH=\\\"$(TARGET_ARCH)\\\"
8 defines = [ FDefines $(defines) ] ;
9 SubDirCcFlags $(defines) ;
10 SubDirC++Flags $(defines) ;
13 SEARCH_SOURCE += [ FDirName $(SUBDIR) locks ] ;
14 SEARCH_SOURCE += [ FDirName $(SUBDIR) scheduler ] ;
16 UsePrivateHeaders libroot ;
17 UsePrivateHeaders shared ;
18 UsePrivateHeaders runtime_loader ;
20 AddResources kernel_$(TARGET_ARCH) : kernel.rdef ;
22 SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ;
23 SetVersionScript kernel.so : kernel_versions ;
25 KernelMergeObject kernel_core.o :
29 condition_variable.cpp
41 low_resource_manager.cpp
70 scheduler_profiler.cpp
73 scheduling_analysis.cpp
75 : $(TARGET_KERNEL_PIC_CCFLAGS)
78 # Generate the header defining macros for C++ structure sizes.
79 local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ;
80 TARGET_HDRS_$(TARGET_PACKAGING_ARCH) on $(kernelC++StructSizesHeader)
81 = [ on $(kernelC++StructSizesHeader)
82 return $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ]
83 $(TARGET_PRIVATE_KERNEL_HEADERS) ;
84 CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader)
85 : kernel_c++_structs.cpp ;
87 # We need to specify the dependency on the generated syscalls files explicitly.
88 Includes [ FGristFiles syscalls.cpp ]
90 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_dispatcher.h
91 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_table.h
92 <syscalls!$(TARGET_PACKAGING_ARCH)>syscall_numbers.h
95 # TODO: fix or update binutils for ppc, in the meantime this should get things going.
96 local linkHackLdFlags ;
97 if $(TARGET_ARCH) = ppc {
98 linkHackLdFlags = -Bdynamic ;
100 linkHackLdFlags = -shared -Bdynamic ;
103 KernelLd linkhack.so :
104 <$(SOURCE_GRIST)>linkhack.o
110 KernelLd kernel_$(TARGET_ARCH) :
114 kernel_device_manager.o
115 kernel_disk_device_manager.o
123 kernel_arch_$(TARGET_KERNEL_ARCH).o
124 kernel_platform_$(TARGET_BOOT_PLATFORM).o
128 # kernel parts borrowed from libroot and others
130 kernel_os_arch_$(TARGET_ARCH).o
132 kernel_lib_posix_arch_$(TARGET_ARCH).o
135 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
136 : -Bdynamic -export-dynamic -dynamic-linker /foo/bar
137 $(TARGET_KERNEL_PIC_LINKFLAGS)
141 if $(HAIKU_ARCH) in x86_64 arm {
142 # Cannot relink everything as a shared object on x86_64 as shared library
143 # code is required to be position-independent. Instead create a copy of the
144 # executable kernel image and change the ELF header type to DYN. A bit of
145 # a hack, but avoids having to recompile a PIC copy of the kernel code.
146 # kernel.so is only used when linking modules to provide symbol information,
147 # this is sufficient for that purpose.
148 KernelSo kernel.so : kernel_$(TARGET_ARCH) ;
154 kernel_device_manager.o
155 kernel_disk_device_manager.o
163 kernel_arch_$(TARGET_KERNEL_ARCH).o
164 kernel_platform_$(TARGET_BOOT_PLATFORM).o
168 # kernel libroot parts
170 kernel_os_arch_$(TARGET_ARCH).o
172 kernel_lib_posix_arch_$(TARGET_ARCH).o
175 : $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
176 : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar
177 $(TARGET_KERNEL_PIC_LINKFLAGS)
182 Depends kernel : kernel_$(TARGET_ARCH) ;
183 Depends kernel.so : kernel ;
184 # kernel.so will be rebuilt with the kernel
186 # propagate the container update variable from kernel to kernel_$(TARGET_ARCH)
187 PropagateContainerUpdateTargetFlags kernel_$(TARGET_ARCH) : kernel ;
189 # Copy kernel and update the copy's revision section. We link everything
190 # against the original, but the copy will end up on the disk image (this way
191 # we avoid unnecessary dependencies). The copy will be located in a subdirectory.
192 if $(TARGET_PLATFORM) = haiku {
193 MakeLocate <revisioned>kernel_$(TARGET_ARCH)
194 : [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ;
195 CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH)
196 : kernel_$(TARGET_ARCH) ;
200 SubInclude HAIKU_TOP src system kernel arch ;
201 SubInclude HAIKU_TOP src system kernel cache ;
202 SubInclude HAIKU_TOP src system kernel device_manager ;
203 SubInclude HAIKU_TOP src system kernel debug ;
204 SubInclude HAIKU_TOP src system kernel disk_device_manager ;
205 SubInclude HAIKU_TOP src system kernel fs ;
206 SubInclude HAIKU_TOP src system kernel lib ;
207 SubInclude HAIKU_TOP src system kernel messaging ;
208 SubInclude HAIKU_TOP src system kernel posix ;
209 SubInclude HAIKU_TOP src system kernel slab ;
210 SubInclude HAIKU_TOP src system kernel util ;
211 SubInclude HAIKU_TOP src system kernel vm ;
213 if $(TARGET_BOOT_PLATFORM) {
214 SubInclude HAIKU_TOP src system kernel platform $(TARGET_BOOT_PLATFORM) ;