build: Define _BOOT_MODE once and for all in ArchitectureRules+BootRules.

Previously it was spread all around the tree, and was not defined
consistently for all boot objects (there were a number of boot modules
which did not define it, but did include headers which checked for it.)

Now, as it is handled in SetupBoot which is invoked for all boot objects,
it will be applied consistently throughout. We can thus drop the manual
additions of it from all Jamfiles.
This commit is contained in:
Augustin Cavalier 2022-11-29 20:18:12 -05:00
parent d48f4fd05f
commit f6166140a1
36 changed files with 27 additions and 86 deletions

View File

@ -594,6 +594,7 @@ rule KernelArchitectureSetup architecture
# defines
HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
HAIKU_BOOT_DEFINES += _BOOT_MODE ;
# kernel add-on glue code
HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = <$(architecture)>crtbeginS.o

View File

@ -95,7 +95,7 @@ rule SetupBoot
# add boot flags for the object
ObjectCcFlags $(object) : $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) $(2) ;
ObjectC++Flags $(object) : $(HAIKU_BOOT_C++FLAGS) $(HAIKU_BOOT_$(platform)_C++FLAGS) $(2) ;
ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) $(TARGET_BOOT_DEFINES) ;
ASFLAGS on $(object) = $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) ;
OPTIM on $(object) = $(HAIKU_BOOT_OPTIM) ;

View File

@ -573,6 +573,7 @@ local buildVars =
DEFINES
KERNEL_DEFINES
BOOT_DEFINES
KERNEL_CCFLAGS KERNEL_C++FLAGS
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS

View File

@ -1,7 +1,5 @@
SubDir HAIKU_TOP src system boot ;
DEFINES += _BOOT_MODE ;
UsePrivateHeaders [ FDirName libroot locale ] ;
rule BuildOpenFirmwareLoader {

View File

@ -26,7 +26,6 @@ local kernelGenericDriverSources =
local platform ;
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
# Kernel Drivers (src/system/kernel)
$(kernelGenericDriverSources)

View File

@ -29,9 +29,6 @@ local librootOsArchSources =
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
$(kernelGenericDriverSources)
$(kernelArchSources)

View File

@ -3,8 +3,6 @@ SubDir HAIKU_TOP src system boot arch m68k ;
local platform ;
for platform in [ MultiBootSubDirSetup amiga_m68k atari_m68k next_m68k ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
local kernelArchSources =
arch_elf.cpp
;

View File

@ -14,8 +14,6 @@ local kernelGenericDriverSources =
local platform ;
for platform in [ MultiBootSubDirSetup openfirmware ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
$(kernelGenericDriverSources)
arch_elf.cpp

View File

@ -1,18 +1,12 @@
SubDir HAIKU_TOP src system boot arch riscv64 ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
}
SubDirC++Flags -fno-rtti ;
# Optimizations create infinite recursion otherwise.
SubDirCcFlags -fno-builtin ;
local librootArchSources =
byteorder.S
byteorder.S
;
local librootGenericSources =
@ -34,7 +28,6 @@ local kernelGenericDriverSources =
local platform ;
for platform in [ MultiBootSubDirSetup efi riscv ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
$(kernelArchDriverSources)
$(kernelGenericDriverSources)

View File

@ -13,8 +13,6 @@ local kernelGenericDriverSources =
local platform ;
for platform in [ MultiBootSubDirSetup openfirmware ] {
on $(platform) {
DEFINES += _BOOT_MODE ;
BootMergeObject [ FGristFiles boot_arch_$(TARGET_KERNEL_ARCH).o ] :
$(kernelGenericDriverSources)
arch_elf.cpp

View File

@ -8,7 +8,6 @@ for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ;
DEFINES = $(defines) ;
DEFINES += _BOOT_MODE ;
if $(TARGET_BOOT_PLATFORM) = efi {
if $(TARGET_ARCH) = x86_64 {

View File

@ -4,8 +4,6 @@ local zlibSourceDirectory = [ BuildFeatureAttribute zlib : sources : path ] ;
UseHeaders $(zlibSourceDirectory) ;
UseHeaders $(zlibSourceDirectory) : true ;
DEFINES += _BOOT_MODE ;
local zlibSources =
adler32.c
crc32.c

View File

@ -19,7 +19,6 @@ for platform in [ MultiBootSubDirSetup ] {
DEFINES = $(defines) ;
DEFINES +=
_BOOT_MODE
BOOT_ARCH=\\\"$(TARGET_KERNEL_ARCH_DIR)\\\"
KMESSAGE_CONTAINER_ONLY

View File

@ -5,10 +5,7 @@ UsePrivateHeaders file_systems shared storage ;
SubDirHdrs $(HAIKU_TOP) src add-ons kernel file_systems bfs ;
local defines = [ FDefines _BOOT_MODE ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags -fno-rtti $(defines) ;
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup ] {

View File

@ -3,10 +3,7 @@ SubDir HAIKU_TOP src system boot loader file_systems fat ;
UsePrivateKernelHeaders ;
UsePrivateHeaders shared storage ;
local defines = [ FDefines _BOOT_MODE ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags -fno-rtti $(defines) ;
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup ] {

View File

@ -4,8 +4,6 @@ UsePrivateHeaders kernel shared storage support ;
UseBuildFeatureHeaders zlib ;
UseBuildFeatureHeaders zstd ;
DEFINES += _BOOT_MODE ;
if [ FIsBuildFeatureEnabled zstd ] {
DEFINES += ZSTD_ENABLED ;
}

View File

@ -5,9 +5,7 @@ UsePrivateHeaders kernel shared storage ;
UseBuildFeatureHeaders zlib ;
local defines = [ FDefines _BOOT_MODE ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags -fno-rtti $(defines) ;
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup ] {

View File

@ -2,7 +2,7 @@ SubDir HAIKU_TOP src system boot loader net ;
UsePrivateHeaders drivers ;
SubDirC++Flags -D_BOOT_MODE -fno-rtti ;
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup ] {

View File

@ -9,13 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
#UsePrivateHeaders [ FDirName graphics vesa ] ;
UsePrivateHeaders [ FDirName storage ] ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
}
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup amiga_m68k ] {

View File

@ -9,13 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
#UsePrivateHeaders [ FDirName graphics vesa ] ;
UsePrivateHeaders [ FDirName storage ] ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
}
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup atari_m68k ] {

View File

@ -8,7 +8,7 @@ UsePrivateHeaders [ FDirName graphics vesa ] ;
UsePrivateHeaders [ FDirName storage ] ;
{
local defines = _BOOT_MODE _BOOT_PLATFORM_BIOS ;
local defines = _BOOT_PLATFORM_BIOS ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;

View File

@ -12,7 +12,7 @@ if $(TARGET_ARCH) != x86_64 && $(TARGET_ARCH) != x86 {
SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ;
{
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
local defines = _BOOT_PLATFORM_EFI ;
if $(TARGET_ARCH) != x86_64 && $(TARGET_ARCH) != x86 {
defines += _BOOT_FDT_SUPPORT ;

View File

@ -14,7 +14,7 @@ local platform ;
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
{
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
local defines = _BOOT_PLATFORM_EFI ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;

View File

@ -12,7 +12,7 @@ local platform ;
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
{
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
local defines = _BOOT_PLATFORM_EFI ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;

View File

@ -10,7 +10,7 @@ local platform ;
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
{
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
local defines = _BOOT_PLATFORM_EFI ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;

View File

@ -9,7 +9,7 @@ local platform ;
for platform in [ MultiBootSubDirSetup efi ] {
on $(platform) {
{
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
local defines = _BOOT_PLATFORM_EFI ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;

View File

@ -3,7 +3,7 @@ SubDir HAIKU_TOP src system boot platform generic ;
UseBuildFeatureHeaders zlib ;
UsePrivateKernelHeaders ;
SubDirC++Flags -D_BOOT_MODE -fno-rtti ;
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup ] {

View File

@ -9,13 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
#UsePrivateHeaders [ FDirName graphics vesa ] ;
UsePrivateHeaders [ FDirName storage ] ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ; # -save-temps
SubDirC++Flags $(defines) -fno-rtti ;
}
SubDirC++Flags -fno-rtti ;
local platform ;
for platform in [ MultiBootSubDirSetup next_m68k ] {

View File

@ -1,11 +1,9 @@
SubDir HAIKU_TOP src system boot platform openfirmware ;
SubDirC++Flags -D_BOOT_MODE -fno-rtti ;
UsePrivateHeaders [ FDirName graphics common ] ;
{
local defines = _BOOT_MODE _BOOT_PLATFORM_OPENFIRMWARE ;
local defines = _BOOT_PLATFORM_OPENFIRMWARE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;

View File

@ -10,7 +10,7 @@ UsePrivateHeaders [ FDirName graphics vesa ] ;
UsePrivateHeaders [ FDirName storage ] ;
{
local defines = _BOOT_MODE _PXE_ENV _BOOT_PLATFORM_BIOS ;
local defines = _PXE_ENV _BOOT_PLATFORM_BIOS ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;

View File

@ -11,11 +11,7 @@ UsePrivateHeaders [ FDirName virtio ] ;
UseLibraryHeaders [ FDirName libfdt ] ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) -fno-rtti ;
SubDirC++Flags -fno-rtti ;
SubDirAsFlags -I $(SUBDIR) ;
}

View File

@ -16,11 +16,8 @@ UsePrivateHeaders [ FDirName storage ] ;
UsePrivateHeaders [ FDirName kernel arch generic ] ;
{
local defines = _BOOT_MODE ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) -g3 -O0 ;
SubDirC++Flags $(defines) -fno-rtti -g3 -O0 ;
SubDirCcFlags -g3 -O0 ;
SubDirC++Flags -fno-rtti -g3 -O0 ;
}
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;

View File

@ -51,7 +51,6 @@ ObjectDefines
{
local defines =
_BOOT_MODE
BOOT_ARCH=\\\"$(TARGET_ARCH)\\\"
# the boot loader test application will try to load the BeOS kernel
# from a supported partition/file system

View File

@ -13,7 +13,7 @@ ObjectDefines
Directory.cpp
File.cpp
:
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close _BOOT_MODE
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
;
KernelStaticLibrary boottest_amiga_ffs :

View File

@ -17,7 +17,7 @@ ObjectDefines
BPlusTree.cpp
:
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
_BOOT_MODE #BFS_BIG_ENDIAN_ONLY
#BFS_BIG_ENDIAN_ONLY
;
KernelStaticLibrary boottest_bfs.a :

View File

@ -11,7 +11,7 @@ SubDirHdrs $(HAIKU_TOP) src system boot loader file_systems tarfs ;
ObjectDefines
tarfs.cpp
:
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close _BOOT_MODE
read_pos=boot_read_pos fstat=boot_fstat open=boot_open close=boot_close
;
#SubDirCcFlags -DGUNZIP=1 ;