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