2013-08-01 10:51:16 +04:00
|
|
|
rule ArchitectureSetup architecture
|
|
|
|
{
|
|
|
|
# ArchitectureSetup <architecture> ;
|
|
|
|
#
|
|
|
|
# Initializes all global packaging architecture dependent variables for the
|
|
|
|
# given packaging architecture. Also sets HAIKU_ARCH (to the primary
|
|
|
|
# architecture), if this is the first invocation of the rule, and adds
|
|
|
|
# the architecture to HAIKU_ARCHS, if not yet contained.
|
|
|
|
|
|
|
|
# enable GCC -pipe option, if requested
|
2018-08-01 04:25:36 +03:00
|
|
|
local ccBaseFlags ;
|
2013-08-01 10:51:16 +04:00
|
|
|
if $(HAIKU_USE_GCC_PIPE) = 1 {
|
2018-08-01 04:25:36 +03:00
|
|
|
ccBaseFlags = -pipe ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
2019-05-24 21:25:26 +03:00
|
|
|
# disable strict aliasing on anything newer than gcc 2 as it may lead to
|
|
|
|
# unexpected results.
|
|
|
|
# TODO: remove the -fno-strict-aliasing option when all code has been
|
|
|
|
# analyzed/fixed with regard to aliasing.
|
2018-08-01 04:25:36 +03:00
|
|
|
ccBaseFlags += -fno-strict-aliasing ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2019-05-24 21:25:26 +03:00
|
|
|
# Without this flag, GCC deletes many null-pointer checks that are
|
|
|
|
# technically undefined behavior (e.g. passing NULL to strdup, among
|
|
|
|
# others), which breaks both the kernel and various applications. See:
|
|
|
|
# - https://freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
|
|
|
|
# - https://dev.haiku-os.org/ticket/13285#comment:8 (& subsequent comments)
|
|
|
|
# - https://dev.haiku-os.org/ticket/10803#comment:4 (& subsequent comments)
|
|
|
|
# Note that the Linux also does the same:
|
|
|
|
# - https://github.com/torvalds/linux/commit/a3ca86aea507904
|
2018-08-01 04:25:36 +03:00
|
|
|
ccBaseFlags += -fno-delete-null-pointer-checks ;
|
2017-12-01 22:23:57 +03:00
|
|
|
|
2019-05-24 21:25:26 +03:00
|
|
|
# disable some builtins that are incompatible with our definitions
|
2018-08-01 04:25:36 +03:00
|
|
|
ccBaseFlags += -fno-builtin-fork -fno-builtin-vfork ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2018-08-01 17:03:35 +03:00
|
|
|
# default architecture tuning
|
2013-09-27 03:55:45 +04:00
|
|
|
local cpu = $(HAIKU_CPU_$(architecture)) ;
|
2018-08-11 22:18:36 +03:00
|
|
|
local archFlags ;
|
2018-08-01 17:03:35 +03:00
|
|
|
switch $(cpu) {
|
2018-08-11 22:18:36 +03:00
|
|
|
case ppc : archFlags += -mcpu=440fp ;
|
|
|
|
case arm : archFlags += -march=armv7-a -mfloat-abi=hard ;
|
2021-11-09 23:54:20 +03:00
|
|
|
case arm64 : archFlags += -march=armv8.2-a+fp16 ;
|
2018-08-11 22:18:36 +03:00
|
|
|
case x86 : archFlags += -march=pentium ;
|
2021-01-15 17:51:17 +03:00
|
|
|
case riscv64 : archFlags += -march=rv64gc ;
|
2018-08-01 17:03:35 +03:00
|
|
|
}
|
2018-08-17 19:03:53 +03:00
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
|
2018-09-05 07:06:59 +03:00
|
|
|
# TODO: These should be included in Clang's compiler specs.
|
2018-11-22 21:15:16 +03:00
|
|
|
ccBaseFlags += -fPIC ;
|
2018-09-05 07:06:59 +03:00
|
|
|
HAIKU_LINKFLAGS_$(architecture) += -shared ;
|
2022-02-22 02:51:47 +03:00
|
|
|
|
|
|
|
# lld doesn't currently implement R_RISCV_ALIGN relaxation
|
|
|
|
if $(cpu) = riscv64 {
|
|
|
|
ccBaseFlags += -mno-relax ;
|
|
|
|
}
|
2018-08-17 19:03:53 +03:00
|
|
|
}
|
2018-08-11 22:18:36 +03:00
|
|
|
ccBaseFlags += $(archFlags) ;
|
2018-08-01 17:03:35 +03:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
# activating graphite optimizations
|
|
|
|
if $(HAIKU_USE_GCC_GRAPHITE_$(architecture)) = 1 {
|
2020-07-18 16:19:44 +03:00
|
|
|
ccBaseFlags += -floop-nest-optimize -fgraphite-identity ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# initial state for flags etc.
|
|
|
|
HAIKU_C++_$(architecture) ?= $(HAIKU_CC_$(architecture)) ;
|
2019-06-18 02:57:58 +03:00
|
|
|
HAIKU_LINK_$(architecture) ?= $(HAIKU_CC_$(architecture)) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2018-08-01 04:25:36 +03:00
|
|
|
HAIKU_CCFLAGS_$(architecture) += $(ccBaseFlags) -nostdinc ;
|
|
|
|
HAIKU_C++FLAGS_$(architecture) += $(ccBaseFlags) -nostdinc ;
|
2018-08-15 21:19:30 +03:00
|
|
|
HAIKU_LINKFLAGS_$(architecture) += $(ccBaseFlags) ;
|
2018-08-11 22:18:36 +03:00
|
|
|
HAIKU_ASFLAGS_$(architecture) += $(archFlags) -nostdinc ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
# strip is required
|
|
|
|
if ! $(HAIKU_STRIP_$(architecture)) {
|
|
|
|
Exit "HAIKU_STRIP_$(architecture) not set. Please re-run configure." ;
|
|
|
|
}
|
|
|
|
|
|
|
|
HAIKU_ARCH_$(architecture) = $(cpu) ;
|
|
|
|
HAIKU_ARCH ?= $(cpu) ;
|
|
|
|
# Set only, if not set yet. This way HAIKU_ARCH is set to the primary
|
|
|
|
# architecture.
|
|
|
|
if ! $(cpu) in $(HAIKU_ARCHS) {
|
|
|
|
HAIKU_ARCHS += $(cpu) ;
|
|
|
|
}
|
|
|
|
HAIKU_DEFINES_$(architecture) += ARCH_$(cpu) ;
|
|
|
|
|
|
|
|
# directories
|
|
|
|
HAIKU_ARCH_OBJECT_DIR_$(architecture)
|
|
|
|
= [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(architecture) ] ;
|
|
|
|
HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture)
|
|
|
|
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) common ] ;
|
|
|
|
HAIKU_DEBUG_0_OBJECT_DIR_$(architecture)
|
|
|
|
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) release ] ;
|
|
|
|
|
|
|
|
local level ;
|
|
|
|
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
|
|
|
HAIKU_DEBUG_$(level)_OBJECT_DIR_$(architecture)
|
|
|
|
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture))
|
|
|
|
debug_$(level) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# set variables for gcc header options
|
|
|
|
SetIncludePropertiesVariables HAIKU : _$(architecture) ;
|
|
|
|
|
|
|
|
# warning flags
|
2018-11-24 03:14:49 +03:00
|
|
|
HAIKU_WARNING_CCFLAGS_$(architecture) = -Wall
|
2019-01-17 03:31:58 +03:00
|
|
|
-Wno-multichar
|
2019-06-18 02:58:39 +03:00
|
|
|
-Wpointer-arith -Wsign-compare
|
2019-03-04 00:52:11 +03:00
|
|
|
-Wmissing-prototypes ;
|
2018-11-24 03:14:49 +03:00
|
|
|
HAIKU_WARNING_C++FLAGS_$(architecture) = -Wall
|
2019-01-17 03:31:58 +03:00
|
|
|
-Wno-multichar
|
2019-06-18 02:58:39 +03:00
|
|
|
-Wpointer-arith -Wsign-compare
|
2019-03-04 00:52:11 +03:00
|
|
|
-Wno-ctor-dtor-privacy -Woverloaded-virtual ;
|
2018-11-24 03:14:49 +03:00
|
|
|
|
2018-08-11 22:36:04 +03:00
|
|
|
# disable some Clang warnings that are not very useful
|
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
|
2021-12-07 22:24:15 +03:00
|
|
|
HAIKU_WARNING_CCFLAGS_$(architecture) +=
|
|
|
|
-Wno-unused-private-field -Wno-gnu-designator
|
2019-02-21 22:04:05 +03:00
|
|
|
-Wno-builtin-requires-header ;
|
2021-12-07 22:24:15 +03:00
|
|
|
HAIKU_WARNING_C++FLAGS_$(architecture) +=
|
|
|
|
-Wno-unused-private-field -Wno-gnu-designator
|
2019-02-21 22:04:05 +03:00
|
|
|
-Wno-builtin-requires-header ;
|
2018-08-11 22:36:04 +03:00
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
|
Fix kernel -Werror support
The introduction of secondary arch support for kernel files disabled
-Werror for all kernel files, since the -Werror flags were moved from
{CC,C++}FLAGS to TARGET_WARNING_{CC,C++}FLAGS_<arch>, which, however,
was overwritten by the SetupKernel rule. This commit introduces new
global variables {HAIKU,HOST,TARGET}_WERROR_FLAGS[_<arch>], which
contain the additional -Werror flags to be applied for the architecture.
The config variable WARNINGS can be set to "treatAsErrors" to cause
-Werror and {HOST,TARGET}_WERROR_FLAGS[_<arch>] to be appended to the
compilation flags.
Fixes #10280.
2013-12-05 15:37:14 +04:00
|
|
|
HAIKU_WERROR_FLAGS_$(architecture) = ;
|
|
|
|
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
2019-01-17 03:31:58 +03:00
|
|
|
# TODO: Remove all these.
|
|
|
|
HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=unused-but-set-variable
|
|
|
|
-Wno-error=deprecated -Wno-error=deprecated-declarations
|
2021-11-16 23:10:05 +03:00
|
|
|
-Wno-error=cpp -Wno-error=trigraphs -Wno-error=register ;
|
|
|
|
# These currently generate too many "false positives."
|
2021-12-07 22:24:15 +03:00
|
|
|
HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=address-of-packed-member
|
|
|
|
-Wno-error=stringop-overread -Wno-error=array-bounds ;
|
2019-05-24 02:50:51 +03:00
|
|
|
# But these can stay.
|
|
|
|
HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=cast-align
|
|
|
|
-Wno-error=format-truncation ;
|
Fix kernel -Werror support
The introduction of secondary arch support for kernel files disabled
-Werror for all kernel files, since the -Werror flags were moved from
{CC,C++}FLAGS to TARGET_WARNING_{CC,C++}FLAGS_<arch>, which, however,
was overwritten by the SetupKernel rule. This commit introduces new
global variables {HAIKU,HOST,TARGET}_WERROR_FLAGS[_<arch>], which
contain the additional -Werror flags to be applied for the architecture.
The config variable WARNINGS can be set to "treatAsErrors" to cause
-Werror and {HOST,TARGET}_WERROR_FLAGS[_<arch>] to be appended to the
compilation flags.
Fixes #10280.
2013-12-05 15:37:14 +04:00
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
# debug flags
|
|
|
|
local debugFlags = -ggdb ;
|
|
|
|
|
|
|
|
# debug 0: suppress asserts
|
|
|
|
HAIKU_DEBUG_0_CCFLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
HAIKU_DEBUG_0_C++FLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ;
|
|
|
|
|
|
|
|
local level ;
|
|
|
|
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
|
|
|
local flags = $(debugFlags) [ FDefines DEBUG=$(level) ] ;
|
|
|
|
HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture) = $(flags) ;
|
|
|
|
HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture) = $(flags) ;
|
|
|
|
}
|
|
|
|
|
2018-08-14 20:35:51 +03:00
|
|
|
# TODO: Temporary work-around. Should be defined in the compiler specs
|
|
|
|
HAIKU_LINKFLAGS_$(architecture) += -Xlinker --no-undefined ;
|
|
|
|
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) = 1 {
|
2013-08-01 10:51:16 +04:00
|
|
|
HAIKU_DEFINES_$(architecture) += _BEOS_R5_COMPATIBLE_ ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# private shared kernel/libroot headers
|
|
|
|
HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture)
|
|
|
|
= [ PrivateHeaders $(DOT) system system/arch/$(cpu) ] ;
|
|
|
|
|
|
|
|
# library and executable glue code
|
|
|
|
local commonGlueCode =
|
|
|
|
<src!system!glue!$(architecture)>init_term_dyn.o
|
2018-01-31 20:27:00 +03:00
|
|
|
<src!system!glue!arch!$(cpu)!$(architecture)>crti.o
|
|
|
|
<src!system!glue!arch!$(cpu)!$(architecture)>crtn.o
|
2013-08-01 10:51:16 +04:00
|
|
|
;
|
|
|
|
HAIKU_LIBRARY_BEGIN_GLUE_CODE_$(architecture) =
|
2018-01-31 20:27:00 +03:00
|
|
|
<src!system!glue!arch!$(cpu)!$(architecture)>crti.o
|
2014-08-01 00:01:44 +04:00
|
|
|
<$(architecture)>crtbeginS.o
|
2013-08-01 10:51:16 +04:00
|
|
|
<src!system!glue!$(architecture)>init_term_dyn.o
|
|
|
|
;
|
|
|
|
HAIKU_LIBRARY_END_GLUE_CODE_$(architecture) =
|
2014-08-01 00:01:44 +04:00
|
|
|
<$(architecture)>crtendS.o
|
2018-01-31 20:27:00 +03:00
|
|
|
<src!system!glue!arch!$(cpu)!$(architecture)>crtn.o
|
2013-08-01 10:51:16 +04:00
|
|
|
;
|
|
|
|
HAIKU_EXECUTABLE_BEGIN_GLUE_CODE_$(architecture) =
|
2018-01-31 20:27:00 +03:00
|
|
|
<src!system!glue!arch!$(cpu)!$(architecture)>crti.o
|
2014-08-01 00:01:44 +04:00
|
|
|
<$(architecture)>crtbeginS.o
|
2013-08-01 10:51:16 +04:00
|
|
|
<src!system!glue!$(architecture)>start_dyn.o
|
|
|
|
<src!system!glue!$(architecture)>init_term_dyn.o
|
|
|
|
;
|
|
|
|
HAIKU_EXECUTABLE_END_GLUE_CODE_$(architecture)
|
|
|
|
= $(HAIKU_LIBRARY_END_GLUE_CODE_$(architecture)) ;
|
|
|
|
|
2014-08-01 00:01:44 +04:00
|
|
|
SEARCH on <$(architecture)>crtbeginS.o <$(architecture)>crtendS.o
|
|
|
|
= $(HAIKU_GCC_LIB_DIR_$(architecture)) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
# init library name map
|
2013-08-05 20:52:33 +04:00
|
|
|
local libraryGrist = "" ;
|
|
|
|
if $(architecture) != $(HAIKU_PACKAGING_ARCHS[1]) {
|
|
|
|
libraryGrist = $(architecture) ;
|
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
local i ;
|
2019-05-17 21:43:32 +03:00
|
|
|
for i in be bnetapi debug device game locale mail media midi midi2
|
|
|
|
network package root screensaver textencoding tracker
|
2013-08-01 10:51:16 +04:00
|
|
|
translation z {
|
2013-08-05 20:52:33 +04:00
|
|
|
local library = lib$(i).so ;
|
2013-08-05 08:39:10 +04:00
|
|
|
HAIKU_LIBRARY_NAME_MAP_$(architecture)_$(i)
|
2013-08-05 20:52:33 +04:00
|
|
|
= $(library:G=$(libraryGrist)) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
HAIKU_LIBRARY_NAME_MAP_$(architecture)_localestub
|
|
|
|
= <$(architecture)>liblocalestub.a ;
|
2016-01-16 04:55:20 +03:00
|
|
|
HAIKU_LIBRARY_NAME_MAP_$(architecture)_shared
|
|
|
|
= <$(architecture)>libshared.a ;
|
2013-08-05 23:44:12 +04:00
|
|
|
if $(architecture) = $(HAIKU_PACKAGING_ARCHS[1]) {
|
2013-08-05 20:52:33 +04:00
|
|
|
HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server
|
|
|
|
= <nogrist>input_server ;
|
|
|
|
} else {
|
|
|
|
HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server
|
|
|
|
= <$(architecture)>input_server ;
|
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule KernelArchitectureSetup architecture
|
|
|
|
{
|
|
|
|
# KernelArchitectureSetup <architecture> ;
|
|
|
|
#
|
|
|
|
# Initializes the global kernel and boot loader related variables. Those
|
|
|
|
# don't have a packaging architecture suffix, since they are only set for
|
|
|
|
# the primary packaging architecture. <architecture> is the primary
|
|
|
|
# packaging architecture (supplied for convenience).
|
|
|
|
|
|
|
|
HAIKU_KERNEL_ARCH = $(HAIKU_ARCH) ;
|
2021-10-01 23:26:45 +03:00
|
|
|
HAIKU_KERNEL_ARCH_DIR = $(HAIKU_KERNEL_ARCH) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
local cpu = $(HAIKU_CPU_$(architecture)) ;
|
|
|
|
|
|
|
|
switch $(cpu) {
|
|
|
|
case ppc :
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= openfirmware ;
|
|
|
|
HAIKU_BOOT_TARGETS += openfirmware ;
|
2018-10-18 18:07:12 +03:00
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
|
2013-08-01 10:51:16 +04:00
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
2018-07-09 18:38:10 +03:00
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2019-02-17 15:42:25 +03:00
|
|
|
case sparc :
|
|
|
|
HAIKU_KERNEL_PLATFORM ?= openfirmware ;
|
|
|
|
HAIKU_BOOT_TARGETS += openfirmware ;
|
|
|
|
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case arm :
|
2020-06-11 17:20:04 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= efi ;
|
|
|
|
HAIKU_BOOT_TARGETS += efi ;
|
2017-07-10 17:02:56 +03:00
|
|
|
|
|
|
|
# SOC's like allwinner need an offset to skip the hardcoded initial loader
|
2021-01-07 18:24:15 +03:00
|
|
|
HAIKU_BOOT_SDIMAGE_BEGIN = 20475 ; # in KiB
|
2017-07-10 17:02:56 +03:00
|
|
|
|
2017-07-10 06:51:50 +03:00
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
|
2013-08-01 10:51:16 +04:00
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
|
2017-07-10 17:02:56 +03:00
|
|
|
HAIKU_BOOT_LOADER_BASE ?= 0x1000000 ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2018-08-03 17:55:43 +03:00
|
|
|
case arm64 :
|
2019-04-04 16:52:22 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= efi ;
|
2020-06-30 04:11:47 +03:00
|
|
|
HAIKU_BOOT_TARGETS += efi ;
|
2018-08-03 17:55:43 +03:00
|
|
|
|
2021-01-13 00:01:50 +03:00
|
|
|
HAIKU_BOOT_SDIMAGE_BEGIN = 2 ; # in KiB
|
2018-08-03 17:55:43 +03:00
|
|
|
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
|
|
|
|
HAIKU_BOOT_LOADER_BASE ?= 0x1000000 ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case x86 :
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= bios_ia32 ;
|
2021-12-16 20:00:22 +03:00
|
|
|
HAIKU_BOOT_TARGETS += bios_ia32 efi pxe_ia32 ;
|
2018-10-27 23:57:35 +03:00
|
|
|
HAIKU_ANYBOOT_LEGACY = 1 ;
|
2018-10-09 03:28:00 +03:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
2021-10-20 03:59:26 +03:00
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2014-03-29 02:07:04 +04:00
|
|
|
# nasm is required for target arch x86
|
|
|
|
if ! $(HAIKU_NASM) {
|
|
|
|
Exit "HAIKU_NASM not set. Please re-run configure." ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2018-11-04 22:37:09 +03:00
|
|
|
case riscv64 :
|
2020-02-05 23:04:08 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= efi ;
|
2021-04-18 06:05:19 +03:00
|
|
|
HAIKU_BOOT_TARGETS += efi riscv ;
|
2018-11-04 22:37:09 +03:00
|
|
|
|
2021-01-13 00:01:50 +03:00
|
|
|
HAIKU_BOOT_SDIMAGE_BEGIN = 2 ; # KiB
|
2018-11-04 22:37:09 +03:00
|
|
|
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
|
|
|
|
HAIKU_BOOT_LOADER_BASE ?= 0x1000000 ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case x86_64 :
|
2018-10-09 03:28:00 +03:00
|
|
|
# x86_64 completely shares the x86 bootloader for MBR.
|
|
|
|
HAIKU_KERNEL_PLATFORM ?= bios_ia32 ;
|
|
|
|
HAIKU_BOOT_TARGETS += bios_ia32 efi pxe_ia32 ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
2021-10-20 03:59:26 +03:00
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
# x86_64 kernel source is under arch/x86.
|
2021-10-01 23:26:45 +03:00
|
|
|
HAIKU_KERNEL_ARCH_DIR = x86 ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2014-03-29 02:07:04 +04:00
|
|
|
# nasm is required for target arch x86_64
|
|
|
|
if ! $(HAIKU_NASM) {
|
|
|
|
Exit "HAIKU_NASM not set. Please re-run configure." ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
case m68k :
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_KERNEL_PLATFORM ?= atari_m68k ;
|
2019-11-03 05:28:52 +03:00
|
|
|
HAIKU_BOOT_TARGETS += amiga_m68k atari_m68k next_m68k ;
|
2018-10-09 03:28:00 +03:00
|
|
|
switch $(HAIKU_KERNEL_PLATFORM) {
|
2013-08-01 10:51:16 +04:00
|
|
|
case atari_m68k :
|
|
|
|
{
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
|
|
|
|
}
|
|
|
|
case amiga_m68k :
|
|
|
|
{
|
|
|
|
# for now we have trouble reading from double-sided images
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 880 ; # in kB
|
|
|
|
}
|
2019-11-03 05:28:52 +03:00
|
|
|
case next_m68k :
|
|
|
|
{
|
|
|
|
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
|
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
# offset in floppy image (>= sizeof(haiku_loader))
|
|
|
|
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB
|
2013-10-12 19:24:26 +04:00
|
|
|
HAIKU_CONTAINER_STRIP_EXECUTABLES on
|
|
|
|
$(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = 1 ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
case * :
|
|
|
|
Exit "Currently unsupported target CPU:" $(cpu) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# private kernel headers to be used when compiling kernel code
|
|
|
|
HAIKU_PRIVATE_KERNEL_HEADERS =
|
|
|
|
[ PrivateHeaders $(DOT) kernel libroot shared
|
2018-10-09 03:28:00 +03:00
|
|
|
kernel/boot/platform/$(HAIKU_KERNEL_PLATFORM) ]
|
2021-10-01 23:26:45 +03:00
|
|
|
[ ArchHeaders $(HAIKU_KERNEL_ARCH_DIR) ]
|
2013-08-01 10:51:16 +04:00
|
|
|
[ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture)) system
|
|
|
|
kernel ]
|
|
|
|
$(HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture))
|
|
|
|
;
|
|
|
|
|
|
|
|
# C/C++ flags
|
2021-10-01 01:16:13 +03:00
|
|
|
local ccBaseFlags = -finline -fno-builtin -Wno-main ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
2020-10-10 23:26:41 +03:00
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
2020-03-28 21:27:04 +03:00
|
|
|
# Clang does not yet understand this flag.
|
|
|
|
ccBaseFlags += -fno-semantic-interposition ;
|
|
|
|
}
|
|
|
|
|
2018-08-01 04:25:36 +03:00
|
|
|
ccBaseFlags += -ffreestanding ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2018-08-01 04:25:36 +03:00
|
|
|
local c++BaseFlags = $(ccBaseFlags) -fno-exceptions ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1
|
|
|
|
&& $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
2018-08-01 04:25:36 +03:00
|
|
|
c++BaseFlags += -fno-use-cxa-atexit ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2018-08-01 04:25:36 +03:00
|
|
|
HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(ccBaseFlags) ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(c++BaseFlags) ;
|
2020-03-23 03:49:55 +03:00
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = ;
|
2018-10-19 17:02:45 +03:00
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = ;
|
|
|
|
HAIKU_KERNEL_ADDON_LINKFLAGS = ;
|
|
|
|
|
|
|
|
# Common boot-related cflags which apply to all loaders
|
2018-08-01 04:25:36 +03:00
|
|
|
HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(ccBaseFlags) ;
|
|
|
|
HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(c++BaseFlags) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
HAIKU_BOOT_LINKFLAGS = ;
|
2016-04-14 10:15:55 +03:00
|
|
|
HAIKU_BOOT_LDFLAGS = -Bstatic ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2018-11-22 21:15:16 +03:00
|
|
|
# Remove -fPIC and other unwanted options from the BOOT flags (they are sometimes
|
|
|
|
# added to force PIC in general.)
|
|
|
|
local fixedBootCCFlags ;
|
|
|
|
local fixedBootC++Flags ;
|
|
|
|
for flag in $(HAIKU_BOOT_CCFLAGS) {
|
|
|
|
if $(flag) = "-fpic" || $(flag) = "-fPIC" {
|
|
|
|
continue ;
|
|
|
|
}
|
|
|
|
fixedBootCCFlags += $(flag) ;
|
|
|
|
}
|
|
|
|
for flag in $(HAIKU_BOOT_C++FLAGS) {
|
|
|
|
if $(flag) = "-fpic" || $(flag) = "-fPIC" {
|
|
|
|
continue ;
|
|
|
|
}
|
|
|
|
fixedBootC++Flags += $(flag) ;
|
|
|
|
}
|
|
|
|
HAIKU_BOOT_CCFLAGS = $(fixedBootCCFlags) ;
|
|
|
|
HAIKU_BOOT_C++FLAGS = $(fixedBootC++Flags) ;
|
|
|
|
|
2017-07-10 16:19:44 +03:00
|
|
|
# Any special kernel base addresses
|
2017-07-10 21:34:29 +03:00
|
|
|
if $(HAIKU_BOOT_LOADER_BASE) {
|
2017-07-10 16:19:44 +03:00
|
|
|
HAIKU_BOOT_LDFLAGS +=
|
2017-07-10 21:34:29 +03:00
|
|
|
--defsym BOOT_LOADER_BASE=$(HAIKU_BOOT_LOADER_BASE) ;
|
2016-04-14 10:15:55 +03:00
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
switch $(cpu) {
|
2017-07-10 06:51:50 +03:00
|
|
|
case arm :
|
2020-11-30 21:42:29 +03:00
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
|
|
|
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
2021-06-28 11:28:44 +03:00
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fpic ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = -shared ;
|
2017-07-10 06:51:50 +03:00
|
|
|
|
2019-09-02 22:57:16 +03:00
|
|
|
case arm64 :
|
2020-11-30 21:42:29 +03:00
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
|
|
|
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
2021-08-21 11:33:59 +03:00
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fpic ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = -shared ;
|
2019-09-03 19:19:09 +03:00
|
|
|
|
2021-01-01 02:37:39 +03:00
|
|
|
case m68k :
|
|
|
|
# We don't want to have to handle emulating missing FPU opcodes for
|
|
|
|
# 040 and 060 in the kernel.
|
|
|
|
HAIKU_KERNEL_CCFLAGS += -m68020-60 ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS += -m68020-60 ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case ppc :
|
|
|
|
# Build a position independent PPC kernel. We need to be able to
|
|
|
|
# relocate the kernel, since the virtual address space layout at
|
|
|
|
# boot time is not fixed.
|
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
|
|
|
|
|
2019-04-10 04:25:04 +03:00
|
|
|
case riscv64 :
|
|
|
|
# Kernel lives within any single 2 GiB address space.
|
|
|
|
# Default is medlow (-2GiB / +2GiB)
|
2021-04-22 20:15:57 +03:00
|
|
|
HAIKU_KERNEL_CCFLAGS += -mcmodel=medany -fpic ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS += -mcmodel=medany -fpic ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = -shared ;
|
2019-04-10 04:25:04 +03:00
|
|
|
|
2021-01-01 02:37:39 +03:00
|
|
|
case sparc :
|
|
|
|
# The medlow code model is enough (64-bit addresses, programs must
|
|
|
|
# be linked in the low 32 bits of memory. Programs can be
|
|
|
|
# statically or dynamically linked.)
|
|
|
|
HAIKU_KERNEL_CCFLAGS += -mcmodel=medlow ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS += -mcmodel=medlow ;
|
|
|
|
|
|
|
|
# Unfortunately it's not easy to make the kernel be
|
|
|
|
# position-independant, on sparc, that requires relocation support
|
|
|
|
# in the ELF loader to fill in the plt section.
|
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case x86 :
|
2020-03-23 19:24:13 +03:00
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_KERNEL_CCFLAGS += -march=pentium ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS += -march=pentium ;
|
2018-08-08 18:10:37 +03:00
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
case x86_64 :
|
|
|
|
# Kernel lives in the top 2GB of the address space, use kernel code
|
|
|
|
# model.
|
2020-03-23 03:49:55 +03:00
|
|
|
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic -mcmodel=kernel ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
# Disable the red zone, which cannot be used in kernel code due to
|
|
|
|
# interrupts, and always enable the frame pointer so stack traces
|
|
|
|
# are correct.
|
|
|
|
HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ;
|
|
|
|
HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ;
|
|
|
|
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
|
|
|
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
|
|
|
|
2018-02-25 18:18:31 +03:00
|
|
|
if x86 in $(HAIKU_ARCHS[2-]) || x86_gcc2 in $(HAIKU_ARCHS[2-]) {
|
|
|
|
Echo "Enable kernel ia32 compatibility" ;
|
|
|
|
HAIKU_KERNEL_DEFINES += _COMPAT_MODE ;
|
|
|
|
HAIKU_KERNEL_COMPAT_MODE = 1 ;
|
|
|
|
}
|
2016-04-14 10:15:55 +03:00
|
|
|
}
|
|
|
|
|
2018-10-19 17:02:45 +03:00
|
|
|
# bootloader-centric flags
|
2021-10-01 01:16:13 +03:00
|
|
|
HAIKU_BOOT_CCFLAGS
|
|
|
|
+= -DBOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
|
|
|
HAIKU_BOOT_C++FLAGS
|
|
|
|
+= -DBOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
local bootTarget ;
|
|
|
|
for bootTarget in $(HAIKU_BOOT_TARGETS) {
|
|
|
|
switch $(bootTarget) {
|
|
|
|
case efi :
|
|
|
|
# efi bootloader is PIC
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fpic -fno-stack-protector
|
2019-06-26 16:18:15 +03:00
|
|
|
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main ;
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fpic -fno-stack-protector
|
2019-06-26 16:18:15 +03:00
|
|
|
-fPIC -fshort-wchar -Wno-error=unused-variable -Wno-error=main ;
|
|
|
|
switch $(cpu) {
|
|
|
|
case x86 :
|
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -maccumulate-outgoing-args ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -maccumulate-outgoing-args ;
|
|
|
|
}
|
|
|
|
case x86_64 :
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -mno-red-zone ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -mno-red-zone ;
|
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -maccumulate-outgoing-args ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -maccumulate-outgoing-args ;
|
|
|
|
}
|
2021-11-04 19:33:55 +03:00
|
|
|
case arm :
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -mfloat-abi=soft ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -mfloat-abi=soft ;
|
|
|
|
|
|
|
|
# Remove any previous -mfloat-abi=hard setting from compiler flags
|
|
|
|
local fixedBootCCFlags ;
|
|
|
|
local fixedBootC++Flags ;
|
|
|
|
for flag in $(HAIKU_BOOT_CCFLAGS) {
|
|
|
|
if $(flag) = "-mfloat-abi=hard" {
|
|
|
|
continue ;
|
|
|
|
}
|
|
|
|
fixedBootCCFlags += $(flag) ;
|
|
|
|
}
|
|
|
|
for flag in $(HAIKU_BOOT_C++FLAGS) {
|
|
|
|
if $(flag) = "-mfloat-abi=hard" {
|
|
|
|
continue ;
|
|
|
|
}
|
|
|
|
fixedBootC++Flags += $(flag) ;
|
|
|
|
}
|
|
|
|
HAIKU_BOOT_CCFLAGS = $(fixedBootCCFlags) ;
|
|
|
|
HAIKU_BOOT_C++FLAGS = $(fixedBootC++Flags) ;
|
2018-11-22 21:15:16 +03:00
|
|
|
}
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS = -Bstatic -Bsymbolic
|
2018-11-22 06:02:06 +03:00
|
|
|
-nostdlib -znocombreloc -no-undefined ;
|
2018-10-09 03:28:00 +03:00
|
|
|
case bios_ia32 :
|
|
|
|
# bios_ia32 is non-PIC
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -march=pentium ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -march=pentium ;
|
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386 ;
|
|
|
|
} else {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386_haiku ;
|
|
|
|
}
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -Wno-error=main -m32 ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -Wno-error=main -m32 ;
|
|
|
|
}
|
|
|
|
case pxe_ia32 :
|
|
|
|
# pxe_ia32 is non-PIC
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -march=pentium ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -march=pentium ;
|
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386 ;
|
|
|
|
} else {
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_LDFLAGS += -m elf_i386_haiku ;
|
|
|
|
}
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
2018-10-09 03:28:00 +03:00
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -Wno-error=main -m32 ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -Wno-error=main -m32 ;
|
|
|
|
}
|
2020-02-05 18:19:44 +03:00
|
|
|
case *_m68k :
|
|
|
|
# TODO: make sure all m68k bootloaders are non-PIC
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -Wno-error=main ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -Wno-error=main ;
|
|
|
|
switch $(cpu) {
|
|
|
|
case m68k :
|
|
|
|
# use only common instructions by default
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -m68020-60 ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -m68020-60 ;
|
|
|
|
# TODO: coldfire (FireBee)
|
|
|
|
}
|
2021-04-18 06:05:19 +03:00
|
|
|
case riscv :
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -mcmodel=medany -fno-omit-frame-pointer -fno-plt -fno-pic -fno-semantic-interposition ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -mcmodel=medany -fno-omit-frame-pointer -fno-plt -fno-pic -fno-semantic-interposition ;
|
2020-12-30 17:52:32 +03:00
|
|
|
case openfirmware :
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -fno-semantic-interposition -Wno-error=main -Wstack-usage=1023 ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -fno-semantic-interposition -Wno-error=main -Wstack-usage=1023 ;
|
2018-10-09 03:28:00 +03:00
|
|
|
case * :
|
|
|
|
# all other bootloaders are non-PIC
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fno-pic -Wno-error=main ;
|
|
|
|
HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fno-pic -Wno-error=main ;
|
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# warning flags
|
2018-11-25 01:49:20 +03:00
|
|
|
HAIKU_KERNEL_WARNING_CCFLAGS = $(HAIKU_WARNING_CCFLAGS_$(architecture)) ;
|
|
|
|
HAIKU_KERNEL_WARNING_C++FLAGS = $(HAIKU_WARNING_C++FLAGS_$(architecture)) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
# debug flags
|
|
|
|
local level ;
|
|
|
|
for level in $(HAIKU_DEBUG_LEVELS) {
|
|
|
|
local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
|
|
|
|
HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS
|
|
|
|
= $(HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture)) ;
|
|
|
|
HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS
|
|
|
|
= $(HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# defines
|
|
|
|
HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
|
|
|
|
|
|
|
|
# kernel add-on glue code
|
2014-08-01 00:01:44 +04:00
|
|
|
HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = <$(architecture)>crtbeginS.o
|
2013-08-01 10:51:16 +04:00
|
|
|
<src!system!glue!$(architecture)>haiku_version_glue.o ;
|
2014-08-01 01:38:22 +04:00
|
|
|
HAIKU_KERNEL_ADDON_END_GLUE_CODE = <$(architecture)>crtendS.o ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule ArchitectureSetupWarnings architecture
|
|
|
|
{
|
|
|
|
# ArchitectureSetupWarnings <architecture> ;
|
|
|
|
#
|
|
|
|
# Sets up compiler warnings and error flags for various subdirectories for
|
|
|
|
# the given packaging architecture.
|
|
|
|
|
2018-08-11 22:26:54 +03:00
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
|
|
|
|
AppendToConfigVar CCFLAGS :
|
|
|
|
HAIKU_TOP src system libroot posix glibc :
|
|
|
|
-fgnu89-inline -fheinous-gnu-extensions : global ;
|
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
local cpu = $(HAIKU_CPU_$(architecture)) ;
|
|
|
|
switch $(cpu) {
|
|
|
|
case arm :
|
|
|
|
return ;
|
|
|
|
# we use #warning as placeholders for things to write...
|
|
|
|
case m68k :
|
|
|
|
return ;
|
|
|
|
# we use #warning as placeholders for things to write...
|
2015-06-13 00:02:59 +03:00
|
|
|
case ppc :
|
|
|
|
return ;
|
|
|
|
# we use #warning as placeholders for things to write...
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# enable -Werror for certain parts of the source tree
|
|
|
|
HAIKU_WERROR_ARCH = $(architecture) ;
|
|
|
|
|
|
|
|
rule EnableWerror dirTokens : scope {
|
2014-01-11 00:06:25 +04:00
|
|
|
# Clang gives way more warnings than GCC, so that code won't compile
|
2014-07-17 03:25:27 +04:00
|
|
|
# with -Werror when using Clang.
|
2014-04-15 11:15:53 +04:00
|
|
|
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
2014-01-11 00:06:25 +04:00
|
|
|
SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors
|
|
|
|
: $(scope) ;
|
|
|
|
}
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2021-05-01 16:24:28 +03:00
|
|
|
rule EnableStackProtector dirTokens : scope {
|
|
|
|
# enable stack protector, if requested
|
|
|
|
if $(HAIKU_USE_STACK_PROTECTOR) = 1 {
|
|
|
|
AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) :
|
|
|
|
-fstack-protector : $(scope) ;
|
|
|
|
AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) :
|
|
|
|
-fstack-protector : $(scope) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
# Work-around for GCC 2 problem -- despite -Wno-multichar it reports
|
|
|
|
# multichar warnings in headers/private/kernel/debugger_keymaps.h included
|
|
|
|
# by src/system/kernel/arch/x86/arch_debug_console.cpp.
|
2020-10-07 06:46:18 +03:00
|
|
|
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) = 1 {
|
2013-08-01 10:51:16 +04:00
|
|
|
local file = <src!system!kernel!arch!x86>arch_debug_console.o ;
|
2013-12-05 23:41:27 +04:00
|
|
|
WARNINGS on $(file) = $(WARNINGS) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
2014-10-19 16:59:39 +04:00
|
|
|
EnableWerror src add-ons accelerants ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons bluetooth ;
|
|
|
|
EnableWerror src add-ons decorators ;
|
|
|
|
EnableWerror src add-ons disk_systems ;
|
2022-04-22 14:55:47 +03:00
|
|
|
EnableWerror src add-ons input_server ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel bluetooth ;
|
2022-04-22 14:55:47 +03:00
|
|
|
EnableWerror src add-ons kernel bus_managers ;
|
2022-04-22 19:39:05 +03:00
|
|
|
EnableWerror src add-ons kernel busses ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel console ;
|
|
|
|
EnableWerror src add-ons kernel cpu ;
|
2021-10-10 17:45:44 +03:00
|
|
|
EnableWerror src add-ons kernel debugger ;
|
2013-08-01 10:51:16 +04:00
|
|
|
# EnableWerror src add-ons kernel drivers audio ;
|
|
|
|
EnableWerror src add-ons kernel drivers bluetooth ;
|
2021-10-11 09:43:54 +03:00
|
|
|
EnableWerror src add-ons kernel drivers bus ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel drivers common ;
|
2022-04-30 20:58:22 +03:00
|
|
|
EnableWerror src add-ons kernel drivers disk ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel drivers dvb ;
|
|
|
|
# EnableWerror src add-ons kernel drivers graphics ;
|
2016-08-27 10:03:56 +03:00
|
|
|
EnableWerror src add-ons kernel drivers graphics intel_extreme ;
|
2021-10-12 17:39:45 +03:00
|
|
|
EnableWerror src add-ons kernel drivers input ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel drivers joystick ;
|
|
|
|
EnableWerror src add-ons kernel drivers midi ;
|
|
|
|
EnableWerror src add-ons kernel drivers misc ;
|
2022-05-12 17:18:48 +03:00
|
|
|
EnableWerror src add-ons kernel drivers network ether 3com ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether atheros813x ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether atheros81xx ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether attansic_l1 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether attansic_l2 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether broadcom440x ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether broadcom570x ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether dec21xxx ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether etherpci ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether intel22x ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether ipro100 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether ipro1000 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether jmicron2x0 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether marvell_yukon ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether nforce ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether pcnet ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether pegasus ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether rdc ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether rtl8139 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether rtl81xx ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether sis19x ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether sis900 ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether syskonnect ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether usb_asix ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether usb_davicom ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether usb_ecm ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether usb_rndis ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether via_rhine ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether virtio ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network ether vt612x ;
|
|
|
|
EnableWerror src add-ons kernel drivers network ether wb840 ;
|
|
|
|
EnableWerror src add-ons kernel drivers network tun ;
|
|
|
|
# EnableWerror src add-ons kernel drivers network wlan ;
|
|
|
|
EnableWerror src add-ons kernel drivers network wwan ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel drivers ports ;
|
2021-10-11 02:34:21 +03:00
|
|
|
EnableWerror src add-ons kernel drivers power ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel drivers printer ;
|
|
|
|
EnableWerror src add-ons kernel drivers random ;
|
|
|
|
EnableWerror src add-ons kernel drivers tty ;
|
|
|
|
EnableWerror src add-ons kernel drivers video ;
|
|
|
|
EnableWerror src add-ons kernel file_systems bfs ;
|
|
|
|
EnableWerror src add-ons kernel file_systems cdda ;
|
2021-09-12 20:56:22 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems ext2 ;
|
2022-07-08 11:30:26 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems fat ;
|
2021-10-12 21:43:46 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems googlefs ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel file_systems iso9660 ;
|
|
|
|
EnableWerror src add-ons kernel file_systems layers ;
|
2019-05-24 21:25:26 +03:00
|
|
|
# EnableWerror src add-ons kernel file_systems netfs ;
|
2022-07-08 11:41:23 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems nfs ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel file_systems nfs4 ;
|
|
|
|
# EnableWerror src add-ons kernel file_systems ntfs ;
|
|
|
|
EnableWerror src add-ons kernel file_systems packagefs ;
|
2022-07-08 11:52:26 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems ramfs ;
|
2022-07-08 11:36:33 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems reiserfs ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel file_systems udf ;
|
|
|
|
EnableWerror src add-ons kernel file_systems userlandfs ;
|
2022-04-28 20:28:12 +03:00
|
|
|
EnableWerror src add-ons kernel file_systems xfs ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel generic ;
|
2021-10-11 22:31:09 +03:00
|
|
|
EnableWerror src add-ons kernel network ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons kernel partitioning_systems ;
|
2014-01-29 02:18:38 +04:00
|
|
|
EnableWerror src add-ons kernel power ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons locale ;
|
|
|
|
EnableWerror src add-ons mail_daemon ;
|
2022-04-22 14:55:47 +03:00
|
|
|
EnableWerror src add-ons media media-add-ons ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons media plugins ape_reader ;
|
|
|
|
EnableWerror src add-ons media plugins au_reader ;
|
|
|
|
# EnableWerror src add-ons media plugins ffmpeg ;
|
2021-09-26 20:33:21 +03:00
|
|
|
EnableWerror src add-ons media plugins raw_decoder ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons print ;
|
|
|
|
EnableWerror src add-ons screen_savers ;
|
|
|
|
EnableWerror src add-ons tracker ;
|
|
|
|
EnableWerror src add-ons translators bmp ;
|
2017-12-17 17:38:18 +03:00
|
|
|
EnableWerror src add-ons translators exr ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons translators gif ;
|
|
|
|
EnableWerror src add-ons translators hvif ;
|
|
|
|
EnableWerror src add-ons translators ico ;
|
2016-07-10 20:13:22 +03:00
|
|
|
EnableWerror src add-ons translators jpeg ;
|
2017-11-25 14:01:30 +03:00
|
|
|
# EnableWerror src add-ons translators jpeg2000 ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons translators pcx ;
|
2016-07-10 20:13:22 +03:00
|
|
|
EnableWerror src add-ons translators png ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons translators ppm ;
|
|
|
|
EnableWerror src add-ons translators raw ;
|
|
|
|
EnableWerror src add-ons translators rtf ;
|
|
|
|
EnableWerror src add-ons translators sgi ;
|
|
|
|
EnableWerror src add-ons translators shared ;
|
2016-07-10 20:13:22 +03:00
|
|
|
EnableWerror src add-ons translators stxt ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons translators tga ;
|
|
|
|
EnableWerror src add-ons translators tiff ;
|
2016-07-10 20:13:22 +03:00
|
|
|
EnableWerror src add-ons translators wonderbrush ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src add-ons print ;
|
2014-03-27 19:46:57 +04:00
|
|
|
EnableWerror src bin desklink ;
|
2022-04-22 14:55:47 +03:00
|
|
|
EnableWerror src bin listusb ;
|
2013-09-18 18:10:38 +04:00
|
|
|
EnableWerror src bin multiuser ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src bin package ;
|
2013-08-28 02:35:57 +04:00
|
|
|
EnableWerror src bin package_repo ;
|
|
|
|
EnableWerror src bin pkgman ;
|
2022-04-22 14:55:47 +03:00
|
|
|
EnableWerror src bin writembr ;
|
2014-03-23 00:23:30 +04:00
|
|
|
EnableWerror src libs bsd ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src apps ;
|
|
|
|
EnableWerror src kits ;
|
|
|
|
EnableWerror src preferences ;
|
|
|
|
EnableWerror src servers ;
|
2014-01-29 01:52:58 +04:00
|
|
|
EnableWerror src system boot ;
|
2019-01-15 22:11:50 +03:00
|
|
|
EnableWerror src system kernel ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src system libroot add-ons ;
|
2014-01-29 02:07:50 +04:00
|
|
|
EnableWerror src system libroot os ;
|
2013-08-01 10:51:16 +04:00
|
|
|
EnableWerror src system libroot posix locale ;
|
|
|
|
EnableWerror src system libroot posix wchar ;
|
|
|
|
EnableWerror src system runtime_loader ;
|
2021-05-01 16:24:28 +03:00
|
|
|
|
|
|
|
EnableStackProtector src apps ;
|
|
|
|
EnableStackProtector src kits ;
|
|
|
|
EnableStackProtector src preferences ;
|
|
|
|
EnableStackProtector src servers ;
|
|
|
|
EnableStackProtector src system kernel ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-05 08:37:56 +04:00
|
|
|
rule MultiArchIfPrimary ifValue : elseValue : architecture
|
2013-08-01 10:51:16 +04:00
|
|
|
{
|
2013-08-05 08:37:56 +04:00
|
|
|
# MultiArchIfPrimary <ifValue> : <elseValue>
|
|
|
|
# [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
#
|
|
|
|
# Returns one of the two given values depending on whether
|
2013-08-05 08:37:56 +04:00
|
|
|
# <architecture> is the primary packaging architecture.
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2013-08-05 08:37:56 +04:00
|
|
|
architecture ?= $(TARGET_PACKAGING_ARCH) ;
|
|
|
|
|
|
|
|
if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) {
|
2013-08-01 10:51:16 +04:00
|
|
|
return $(ifValue) ;
|
|
|
|
}
|
|
|
|
return $(elseValue) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule MultiArchConditionalGristFiles files : primaryGrist : secondaryGrist
|
2013-08-05 08:37:56 +04:00
|
|
|
: architecture
|
2013-08-01 10:51:16 +04:00
|
|
|
{
|
|
|
|
# MultiArchConditionalGristFiles <files> : <primaryGrist>
|
2013-08-05 08:37:56 +04:00
|
|
|
# : <secondaryGrist> [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
#
|
|
|
|
# Returns <files> with their grist set to either <primaryGrist> or
|
2013-08-05 08:37:56 +04:00
|
|
|
# <secondaryGrist> depending on whether <architecture> is the primary
|
|
|
|
# packaging architecture.
|
|
|
|
|
|
|
|
architecture ?= $(TARGET_PACKAGING_ARCH) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2013-08-05 08:37:56 +04:00
|
|
|
local grist = [ MultiArchIfPrimary $(primaryGrist) : $(secondaryGrist)
|
|
|
|
: $(architecture) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
return $(files:G=$(grist:E=)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-05 08:37:56 +04:00
|
|
|
rule MultiArchDefaultGristFiles files : gristPrefix : architecture
|
2013-08-01 10:51:16 +04:00
|
|
|
{
|
2013-08-05 08:37:56 +04:00
|
|
|
# MultiArchDefaultGristFiles <files> : <gristPrefix>
|
|
|
|
# [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
#
|
|
|
|
# Convenient shorthand for MultiArchConditionalGristFiles for the common
|
|
|
|
# case that for a secondary packaging architecture the packaging
|
|
|
|
# architecture name shall be appended to the grist while it shall be omitted
|
2013-08-05 08:37:56 +04:00
|
|
|
# for the primary packaging architecture. IOW, if architecture is the
|
|
|
|
# primary packaging architecture, <files> are returned with their grist set
|
|
|
|
# to <gristPrefix>, otherwise <files> are returned with their grist set to
|
|
|
|
# <gristPrefix>!<architecture> respectively <architecture> (if <gristPrefix>
|
|
|
|
# is empty).
|
|
|
|
|
|
|
|
architecture ?= $(TARGET_PACKAGING_ARCH) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
2013-08-05 08:37:56 +04:00
|
|
|
local secondaryGrist = $(gristPrefix)!$(architecture) ;
|
|
|
|
secondaryGrist ?= $(architecture) ;
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
return [ MultiArchConditionalGristFiles $(files) : $(gristPrefix) :
|
2013-08-05 08:37:56 +04:00
|
|
|
$(secondaryGrist) : $(architecture) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule MultiArchSubDirSetup architectures
|
|
|
|
{
|
|
|
|
# MultiArchSubDirSetup <architectures> ;
|
|
|
|
#
|
|
|
|
# For each of the given packaging architectures <architectures> that are
|
|
|
|
# in the packaging architectures configured for the build (or all configured
|
|
|
|
# packaging architectures, if <architectures> is empty) an object is
|
|
|
|
# prepared that can be used for an "on ... { ... }" block to set up subdir
|
|
|
|
# variables for the respective packaging architecture. Most notably
|
2014-08-01 16:53:45 +04:00
|
|
|
# TARGET_PACKAGING_ARCH, TARGET_ARCH are set to the values for the
|
|
|
|
# respective packaging architecture. The per-subdir variables SOURCE_GRIST,
|
|
|
|
# LOCATE_TARGET, LOCATE_SOURCE, SEARCH_SOURCE, *_LOCATE_TARGET, are reset.
|
|
|
|
# All SUBDIR* and config variables are set to the values they had when this
|
|
|
|
# rule was invoked.
|
2013-08-01 10:51:16 +04:00
|
|
|
|
|
|
|
local result ;
|
|
|
|
architectures ?= $(TARGET_PACKAGING_ARCHS) ;
|
|
|
|
local architecture ;
|
|
|
|
for architecture in $(architectures) {
|
|
|
|
if ! $(architecture) in $(TARGET_PACKAGING_ARCHS) {
|
|
|
|
continue ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local architectureObject = $(architecture:G=<arch-object>) ;
|
|
|
|
result += $(architectureObject) ;
|
|
|
|
|
|
|
|
# Set the variables that default to the values of the respective
|
|
|
|
# variables for the primary architecture.
|
|
|
|
TARGET_PACKAGING_ARCH on $(architectureObject) = $(architecture) ;
|
|
|
|
|
|
|
|
local var ;
|
2014-08-01 16:53:45 +04:00
|
|
|
for var in TARGET_ARCH {
|
2013-08-01 10:51:16 +04:00
|
|
|
$(var) on $(architectureObject) = $($(var)_$(architecture)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Clone the current config variable values and the variables SubDir
|
|
|
|
# resets.
|
|
|
|
for var in $(AUTO_SET_UP_CONFIG_VARIABLES) SUBDIR$(SUBDIRRESET) {
|
|
|
|
$(var) on $(architectureObject) = $($(var)) ;
|
|
|
|
}
|
|
|
|
|
2015-06-15 20:27:12 +03:00
|
|
|
# adjust SOURCE_GRIST and HDRGRIST
|
2013-08-01 10:51:16 +04:00
|
|
|
SOURCE_GRIST on $(architectureObject)
|
|
|
|
= $(SOURCE_GRIST:E=)!$(architecture) ;
|
|
|
|
|
2015-06-15 20:27:12 +03:00
|
|
|
HDRGRIST on $(architectureObject)
|
|
|
|
= $(HDRGRIST:E=)!$(architecture) ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
# Adjust the subdir's object dirs that are architecture dependent. To
|
|
|
|
# avoid duplicating the code from SetupObjectsDir, we call it. Since it
|
|
|
|
# sets global variables, we set these variables on our object, call
|
|
|
|
# SetupObjectsDir in an "on" block, and grab the new variable values.
|
|
|
|
local hostTarget = HOST TARGET ;
|
|
|
|
local objectDirVars =
|
|
|
|
COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS)
|
|
|
|
;
|
|
|
|
objectDirVars =
|
|
|
|
COMMON_PLATFORM_LOCATE_TARGET
|
|
|
|
$(hostTarget)_$(objectDirVars)_LOCATE_TARGET
|
|
|
|
LOCATE_TARGET
|
|
|
|
LOCATE_SOURCE
|
|
|
|
SEARCH_SOURCE
|
|
|
|
;
|
|
|
|
|
|
|
|
for var in $(objectDirVars) {
|
|
|
|
$(var) on $(architectureObject) = ;
|
|
|
|
}
|
|
|
|
|
|
|
|
on $(architectureObject) {
|
|
|
|
SetupObjectsDir ;
|
|
|
|
|
|
|
|
for var in $(objectDirVars) {
|
|
|
|
$(var) on $(architectureObject) = $($(var)) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(result) ;
|
|
|
|
}
|