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