1SubDir HAIKU_TOP src system boot loader ;
2
3SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ;
4SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ;
5SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems common ;
6SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ;
7SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ;
8UsePrivateKernelHeaders ;
9UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
10UsePrivateHeaders [ FDirName kernel util ] ;
11UsePrivateHeaders shared storage ;
12
13local defines = $(DEFINES) ;
14
15local platform ;
16for platform in [ MultiBootSubDirSetup ] {
17	on $(platform) {
18		{
19			DEFINES = $(defines) ;
20
21			DEFINES +=
22				BOOT_ARCH=\\\"$(TARGET_KERNEL_ARCH_DIR)\\\"
23				KMESSAGE_CONTAINER_ONLY
24
25				BOOT_SUPPORT_PARTITION_INTEL
26
27				BOOT_SUPPORT_FILE_SYSTEM_BFS
28				BOOT_SUPPORT_FILE_SYSTEM_TARFS
29				#BOOT_SUPPORT_FILE_MAP_DISK
30				BOOT_SUPPORT_FILE_SYSTEM_FAT
31			;
32
33			if $(TARGET_BOOT_PLATFORM) = efi {
34				DEFINES +=
35					_BOOT_PLATFORM_EFI
36					BOOT_SUPPORT_PARTITION_EFI
37				;
38			}
39
40			# Add architecture specific partition/file system modules
41
42			switch $(TARGET_KERNEL_ARCH_DIR) {
43				case "ppc" :
44				{
45					DEFINES +=
46						BOOT_SUPPORT_ELF32 #How to deal with PPC970 ?
47						BOOT_SUPPORT_PARTITION_AMIGA
48						BOOT_SUPPORT_PARTITION_APPLE
49
50						BOOT_SUPPORT_FILE_SYSTEM_AMIGA_FFS
51					;
52				}
53				case "x86" :
54				{
55					DEFINES +=
56						ALTERNATE_BOOT_ARCH=\\\"x86_64\\\"
57						BOOT_SUPPORT_PARTITION_EFI
58
59						#BOOT_SUPPORT_FILE_SYSTEM_FAT
60					;
61
62					if $(TARGET_BOOT_PLATFORM) != efi {
63						DEFINES +=
64							_BOOT_PLATFORM_BIOS
65							BOOT_SUPPORT_ELF32
66							BOOT_SUPPORT_ELF64
67						;
68					} else {
69						if $(TARGET_ARCH) = x86_64 {
70							DEFINES += BOOT_SUPPORT_ELF64 ;
71						} else {
72							DEFINES += BOOT_SUPPORT_ELF32 ;
73						}
74					}
75				}
76				case "sparc" :
77				{
78					DEFINES += BOOT_SUPPORT_ELF64 ;
79				}
80				case "riscv64" :
81				{
82					DEFINES += BOOT_SUPPORT_ELF64 ;
83				}
84				case "m68k" :
85				{
86					DEFINES += BOOT_SUPPORT_ELF32 ;
87				}
88				case "arm" :
89				{
90					DEFINES += BOOT_SUPPORT_ELF32 ;
91				}
92				case "arm64" :
93				{
94					DEFINES += BOOT_SUPPORT_ELF64 ;
95				}
96			}
97
98			local kernelC++Header = [ FDirName $(HAIKU_TOP) headers private kernel util
99				kernel_cpp.h ] ;
100
101			SubDirC++Flags -fno-rtti -include $(kernelC++Header) ;
102		}
103
104
105		BootStaticLibrary [ MultiBootGristFiles boot_loader ] :
106			PathBlocklist.cpp
107			elf.cpp
108			heap.cpp
109			kernel_args.cpp
110			load_driver_settings.cpp
111			loader.cpp
112			main.cpp
113			menu.cpp
114			package_support.cpp
115			pager.cpp
116			partitions.cpp
117			RootFileSystem.cpp
118			stdio.cpp
119			system_revision.c
120			vfs.cpp
121			misc.cpp
122
123			# libroot
124			driver_settings.cpp
125
126			# utils
127			kernel_cpp.cpp
128			KMessage.cpp
129			list.cpp
130			ring_buffer.cpp
131			safemode_settings.cpp
132			StringHash.cpp
133
134			DataIO.cpp
135			Referenceable.cpp
136			;
137
138		# The partition support is built in an extra static library
139		# so that only the ones that are used will be included.
140
141		BootStaticLibrary [ MultiBootGristFiles boot_partitions ] :
142			FileMapDisk.cpp
143			amiga_rdb.cpp
144			apple.cpp
145
146			gpt.cpp
147			Header.cpp
148			crc32.cpp
149			utility.cpp
150
151			intel.cpp
152			PartitionMapParser.cpp
153
154			PartitionMap.cpp
155			;
156
157		# Tell Jam where to find the utility sources
158		SEARCH on [ FGristFiles kernel_cpp.cpp list.cpp ring_buffer.cpp StringHash.cpp ]
159			= [ FDirName $(HAIKU_TOP) src system kernel util ] ;
160
161		SEARCH on [ FGristFiles KMessage.cpp ]
162			= [ FDirName $(HAIKU_TOP) src system kernel messaging ] ;
163
164		SEARCH on [ FGristFiles safemode_settings.cpp ]
165			= [ FDirName $(HAIKU_TOP) src system kernel debug ] ;
166
167		SEARCH on [ FGristFiles driver_settings.cpp system_revision.c ]
168			= [ FDirName $(HAIKU_TOP) src system libroot os ] ;
169
170		SEARCH on [ FGristFiles amiga_rdb.cpp ]
171			= [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ] ;
172
173		SEARCH on [ FGristFiles apple.cpp ]
174			= [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ] ;
175
176		SEARCH on [ FGristFiles gpt.cpp Header.cpp crc32.cpp utility.cpp ]
177			= [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ] ;
178
179		SEARCH on [ FGristFiles intel.cpp PartitionMapParser.cpp ]
180			= [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems intel ] ;
181
182		SEARCH on [ FGristFiles PartitionMap.cpp ]
183			= [ FDirName $(HAIKU_TOP) src add-ons kernel partitioning_systems common ] ;
184
185		SEARCH on [ FGristFiles stage2_crt0.S ]
186			= [ FDirName $(HAIKU_TOP) src system boot arch $(TARGET_KERNEL_ARCH_DIR) ] ;
187
188		SEARCH on [ FGristFiles DataIO.cpp Referenceable.cpp ]
189			= [ FDirName $(HAIKU_TOP) src kits support ] ;
190	}
191}
192
193SubInclude HAIKU_TOP src system boot loader file_systems ;
194SubInclude HAIKU_TOP src system boot loader net ;
195