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