xref: /haiku/src/system/kernel/Jamfile (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
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) scheduler ] ;
14
15UsePrivateHeaders libroot ;
16UsePrivateHeaders shared ;
17UsePrivateHeaders runtime_loader ;
18
19AddResources kernel_$(TARGET_ARCH) : kernel.rdef ;
20
21SetVersionScript kernel_$(TARGET_ARCH) : kernel_versions ;
22SetVersionScript kernel.so : kernel_versions ;
23
24KernelMergeObject kernel_core.o :
25	boot_item.cpp
26	boot_splash.cpp
27	commpage.cpp
28	condition_variable.cpp
29	cpu.cpp
30	elf.cpp
31	heap.cpp
32	image.cpp
33	int.cpp
34	kernel_daemon.cpp
35	linkhack.c
36	listeners.cpp
37	lock.cpp
38	low_resource_manager.cpp
39	main.cpp
40	module.cpp
41	Notifications.cpp
42	port.cpp
43	real_time_clock.cpp
44	sem.cpp
45	shutdown.cpp
46	signal.cpp
47	system_info.cpp
48	smp.cpp
49	syscalls.cpp
50	team.cpp
51	thread.cpp
52	timer.cpp
53	usergroup.cpp
54	wait_for_objects.cpp
55
56	# scheduler
57	scheduler.cpp
58	scheduler_affine.cpp
59	scheduler_simple.cpp
60	scheduler_simple_smp.cpp
61	scheduler_tracing.cpp
62	scheduling_analysis.cpp
63
64	: $(TARGET_KERNEL_PIC_CCFLAGS)
65;
66
67# Generate the header defining macros for C++ structure sizes.
68local kernelC++StructSizesHeader = [ FGristFiles kernel_c++_struct_sizes.h ] ;
69TARGET_HDRS on $(kernelC++StructSizesHeader)
70    = [ on $(kernelC++StructSizesHeader) return $(TARGET_HDRS) ]
71        $(TARGET_PRIVATE_KERNEL_HEADERS) ;
72CreateAsmStructOffsetsHeader $(kernelC++StructSizesHeader)
73	: kernel_c++_structs.cpp ;
74
75# We need to specify the dependency on the generated syscalls files explicitly.
76Includes [ FGristFiles syscalls.cpp ]
77	: <syscalls>syscall_dispatcher.h <syscalls>syscall_table.h
78	  <syscalls>syscall_numbers.h
79;
80
81# TODO: fix or update binutils for ppc, in the meantime this should get things going.
82local linkHackLdFlags ;
83if $(TARGET_ARCH) = ppc {
84	linkHackLdFlags = -Bdynamic ;
85} else {
86	linkHackLdFlags = -shared -Bdynamic ;
87}
88
89KernelLd linkhack.so :
90	<$(SOURCE_GRIST)>linkhack.o
91	:
92	:
93	$(linkHackLdFlags)
94;
95
96KernelLd kernel_$(TARGET_ARCH) :
97	kernel_cache.o
98	kernel_core.o
99	kernel_debug.o
100	kernel_device_manager.o
101	kernel_disk_device_manager.o
102	kernel_fs.o
103	kernel_messaging.o
104	kernel_posix.o
105	kernel_slab.o
106	kernel_util.o
107	kernel_vm.o
108
109	kernel_arch_$(TARGET_ARCH).o
110	kernel_platform_$(TARGET_BOOT_PLATFORM).o
111
112	linkhack.so
113
114	# kernel parts borrowed from libroot and others
115	kernel_os_main.o
116	kernel_os_arch_$(TARGET_ARCH).o
117	kernel_lib_posix.o
118	kernel_lib_posix_arch_$(TARGET_ARCH).o
119	kernel_misc.o
120
121	$(HAIKU_STATIC_LIBSUPC++)
122
123	: $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
124	: -Bdynamic -export-dynamic -dynamic-linker /foo/bar
125	  $(TARGET_KERNEL_PIC_LINKFLAGS)
126	:
127;
128
129KernelLd kernel.so :
130	kernel_cache.o
131	kernel_core.o
132	kernel_debug.o
133	kernel_device_manager.o
134	kernel_disk_device_manager.o
135	kernel_fs.o
136	kernel_messaging.o
137	kernel_posix.o
138	kernel_slab.o
139	kernel_util.o
140	kernel_vm.o
141
142	kernel_arch_$(TARGET_ARCH).o
143	kernel_platform_$(TARGET_BOOT_PLATFORM).o
144
145	linkhack.so
146
147	# kernel libroot parts
148	kernel_os_main.o
149	kernel_os_arch_$(TARGET_ARCH).o
150	kernel_lib_posix.o
151	kernel_lib_posix_arch_$(TARGET_ARCH).o
152	kernel_misc.o
153
154	$(HAIKU_STATIC_LIBSUPC++)
155
156	: $(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/kernel.ld
157	: -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar
158	  $(TARGET_KERNEL_PIC_LINKFLAGS)
159;
160
161NotFile kernel ;
162Depends kernel : kernel_$(TARGET_ARCH) ;
163Depends kernel.so : kernel ;
164	# kernel.so will be rebuilt with the kernel
165
166# propagate HAIKU_INCLUDE_IN_IMAGE variable from kernel to kernel_$(TARGET_ARCH)
167HAIKU_INCLUDE_IN_IMAGE on kernel_$(TARGET_ARCH)
168		= [ on kernel return $(HAIKU_INCLUDE_IN_IMAGE) ] ;
169
170# Copy kernel and update the copy's revision section. We link everything
171# against the original, but the copy will end up on the disk image (this way
172# we avoid unnecessary dependencies). The copy will be located in a subdirectory.
173if $(TARGET_PLATFORM) = haiku {
174	MakeLocate <revisioned>kernel_$(TARGET_ARCH)
175		: [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) revisioned ] ;
176	CopySetHaikuRevision <revisioned>kernel_$(TARGET_ARCH)
177		: kernel_$(TARGET_ARCH) ;
178}
179
180
181SubInclude HAIKU_TOP src system kernel arch ;
182SubInclude HAIKU_TOP src system kernel cache ;
183SubInclude HAIKU_TOP src system kernel device_manager ;
184SubInclude HAIKU_TOP src system kernel debug ;
185SubInclude HAIKU_TOP src system kernel disk_device_manager ;
186SubInclude HAIKU_TOP src system kernel fs ;
187SubInclude HAIKU_TOP src system kernel lib ;
188SubInclude HAIKU_TOP src system kernel messaging ;
189SubInclude HAIKU_TOP src system kernel posix ;
190SubInclude HAIKU_TOP src system kernel slab ;
191SubInclude HAIKU_TOP src system kernel util ;
192SubInclude HAIKU_TOP src system kernel vm ;
193
194if $(TARGET_BOOT_PLATFORM) {
195	SubInclude HAIKU_TOP src system kernel platform $(TARGET_BOOT_PLATFORM) ;
196}
197