2018-10-09 03:28:00 +03:00
|
|
|
rule MultiBootSubDirSetup bootTargets
|
|
|
|
{
|
|
|
|
local result ;
|
|
|
|
local bootTarget ;
|
|
|
|
bootTargets ?= $(HAIKU_BOOT_TARGETS) ;
|
|
|
|
for bootTarget in $(bootTargets) {
|
|
|
|
local bootTargetObject = $(bootTarget:G=<boot-target-object>) ;
|
|
|
|
result += $(bootTargetObject) ;
|
|
|
|
|
|
|
|
TARGET_BOOT_PLATFORM on $(bootTargetObject) = $(bootTarget) ;
|
|
|
|
|
|
|
|
SOURCE_GRIST on $(bootTargetObject)
|
|
|
|
= $(SOURCE_GRIST:E=)!$(bootTarget) ;
|
|
|
|
|
|
|
|
HDRGRIST on $(bootTargetObject)
|
|
|
|
= $(HDRGRIST:E=)!$(bootTarget) ;
|
|
|
|
|
|
|
|
local var ;
|
|
|
|
for var in TARGET_ARCH {
|
|
|
|
$(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)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 $(bootTargetObject) = ;
|
|
|
|
}
|
|
|
|
|
|
|
|
on $(bootTargetObject) {
|
|
|
|
SetupObjectsDir ;
|
|
|
|
SetupFeatureObjectsDir $(bootTarget) ;
|
|
|
|
|
|
|
|
for var in $(objectDirVars) {
|
|
|
|
$(var) on $(bootTargetObject) = $($(var)) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(result) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule MultiBootGristFiles files
|
|
|
|
{
|
|
|
|
return $(files:G=$(TARGET_BOOT_PLATFORM)) ;
|
|
|
|
}
|
|
|
|
|
2012-05-27 00:47:27 +04:00
|
|
|
rule SetupBoot
|
|
|
|
{
|
|
|
|
# Usage SetupBoot <sources_or_objects> : <extra_cc_flags> : <include_private_headers> ;
|
|
|
|
#
|
|
|
|
# <sources_or_objects> - Ideally sources, otherwise HDRSEARCH can not be
|
2018-10-09 03:28:00 +03:00
|
|
|
# set for the sources and the sources some header
|
|
|
|
# dependencies might be missing.
|
2012-05-27 00:47:27 +04:00
|
|
|
|
|
|
|
local sources = [ FGristFiles $(1) ] ;
|
|
|
|
local objects = $(sources:S=$(SUFOBJ)) ;
|
|
|
|
|
|
|
|
# add private kernel headers
|
|
|
|
if $(3) != false {
|
|
|
|
SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
|
|
|
|
}
|
|
|
|
|
2021-10-01 01:16:13 +03:00
|
|
|
if $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_KERNEL_ARCH)) {
|
2014-01-16 01:41:27 +04:00
|
|
|
SourceSysHdrs $(sources) :
|
2021-10-01 01:16:13 +03:00
|
|
|
$(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_KERNEL_ARCH)) ;
|
2014-01-16 01:41:27 +04:00
|
|
|
}
|
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
# MultiBootSubDirSetup sets the target boot platform on the target object,
|
|
|
|
# so this will be correct here in SetupBoot.
|
|
|
|
# This does mean, however, that MultiBootSubDirSetup needs to be used in
|
|
|
|
# all Jamfiles for things to work correctly.
|
|
|
|
# Also means ArchitectureRules need to use platform specific variables,
|
|
|
|
# rather than the previously generic TARGET_BOOT_CCFLAGS and friends.
|
|
|
|
local platform = $(TARGET_BOOT_PLATFORM:U) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
local object ;
|
|
|
|
for object in $(objects) {
|
2021-10-01 01:16:13 +03:00
|
|
|
TARGET_PACKAGING_ARCH on $(object) = $(TARGET_KERNEL_ARCH) ;
|
|
|
|
|
2012-05-27 00:47:27 +04:00
|
|
|
# add boot flags for the object
|
2018-10-09 03:28:00 +03:00
|
|
|
ObjectCcFlags $(object) : $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) $(2) ;
|
|
|
|
ObjectC++Flags $(object) : $(HAIKU_BOOT_C++FLAGS) $(HAIKU_BOOT_$(platform)_C++FLAGS) $(2) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
|
2018-10-19 17:02:45 +03:00
|
|
|
ASFLAGS on $(object) = $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
|
2018-11-22 21:16:32 +03:00
|
|
|
# override regular CCFLAGS/C++FLAGS, as we don't want them
|
2021-10-01 01:16:13 +03:00
|
|
|
TARGET_CCFLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
|
|
|
TARGET_C++FLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
2018-11-22 21:16:32 +03:00
|
|
|
|
2012-05-27 00:47:27 +04:00
|
|
|
# override warning flags
|
2021-10-01 01:16:13 +03:00
|
|
|
TARGET_WARNING_CCFLAGS_$(TARGET_KERNEL_ARCH) on $(object)
|
2013-08-01 10:51:16 +04:00
|
|
|
= $(TARGET_KERNEL_WARNING_CCFLAGS) ;
|
2021-10-01 01:16:13 +03:00
|
|
|
TARGET_WARNING_C++FLAGS_$(TARGET_KERNEL_ARCH) on $(object)
|
2012-05-27 00:47:27 +04:00
|
|
|
= $(TARGET_KERNEL_WARNING_C++FLAGS) ;
|
2018-10-09 03:28:00 +03:00
|
|
|
}
|
2012-05-27 00:47:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule BootObjects
|
|
|
|
{
|
|
|
|
SetupBoot $(1) : $(2) ;
|
|
|
|
Objects $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BootLd
|
|
|
|
{
|
|
|
|
# BootLd <name> : <objs> : <linkerscript> : <args> ;
|
|
|
|
|
2021-10-01 01:16:13 +03:00
|
|
|
LINK on $(1) = $(TARGET_LD_$(TARGET_KERNEL_ARCH)) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
LINKFLAGS on $(1) = $(HAIKU_BOOT_$(TARGET_BOOT_PLATFORM:U)_LDFLAGS) $(4) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
|
|
|
|
|
|
|
# Remove any preset LINKLIBS, but link against libgcc.a. Linking against
|
|
|
|
# libsupc++ is opt-out.
|
2020-02-26 19:12:54 +03:00
|
|
|
local libs ;
|
|
|
|
if ! [ on $(1) return $(HAIKU_NO_LIBSUPC++) ] {
|
|
|
|
libs += [ TargetBootLibsupc++ true ] ;
|
|
|
|
Depends $(1) : [ TargetBootLibsupc++ ] ;
|
2012-05-27 00:47:27 +04:00
|
|
|
}
|
2021-10-01 01:16:13 +03:00
|
|
|
LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc $(TARGET_KERNEL_ARCH) : true ] ;
|
|
|
|
Depends $(1) : [ TargetBootLibgcc $(TARGET_KERNEL_ARCH) ] ;
|
2012-05-27 00:47:27 +04:00
|
|
|
|
|
|
|
# TODO: Do we really want to invoke SetupBoot here? The objects should
|
|
|
|
# have been compiled with BootObjects anyway, so we're doing that twice.
|
|
|
|
SetupBoot $(2) ;
|
|
|
|
|
|
|
|
# Show that we depend on the libraries we need
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
LocalDepends all : $(1) ;
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
|
|
|
|
MakeLocateDebug $(1) ;
|
|
|
|
|
|
|
|
on $(1) XRes $(1) : $(RESFILES) ;
|
|
|
|
if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] {
|
|
|
|
SetType $(1) ;
|
|
|
|
MimeSet $(1) ;
|
|
|
|
SetVersion $(1) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BootLd bind VERSION_SCRIPT
|
|
|
|
{
|
|
|
|
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" $(LINKLIBS) \
|
|
|
|
--version-script=$(VERSION_SCRIPT)
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BootMergeObject
|
|
|
|
{
|
|
|
|
# BootMergeObject <name> : <sources> : <extra CFLAGS> : <other objects> ;
|
|
|
|
# Compiles source files and merges the object files to an object file.
|
|
|
|
# <name>: Name of the object file to create. No grist will be added.
|
|
|
|
# <sources>: Sources to be compiled. Grist will be added.
|
|
|
|
# <extra CFLAGS>: Additional flags for compilation.
|
|
|
|
# <other objects>: Object files or static libraries to be merged. No grist
|
2018-10-09 03:28:00 +03:00
|
|
|
# will be added.
|
2012-05-27 00:47:27 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
SetupBoot $(2) : $(3) ;
|
|
|
|
Objects $(2) ;
|
|
|
|
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
2018-10-09 03:28:00 +03:00
|
|
|
LINKFLAGS on $(1) += $(HAIKU_BOOT_$(TARGET_BOOT_PLATFORM:U)_LDFLAGS) ;
|
2012-05-27 00:47:27 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule BootStaticLibrary
|
|
|
|
{
|
2018-05-07 03:54:32 +03:00
|
|
|
# Usage BootStaticLibrary <name> : <sources> : <extra cc flags> ;
|
2012-05-27 00:47:27 +04:00
|
|
|
# This is designed to take a set of sources and libraries and create
|
|
|
|
# a file called lib<name>.a
|
|
|
|
|
|
|
|
SetupBoot $(2) : $(3) : false ;
|
|
|
|
Library $(1) : $(2) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BootStaticLibraryObjects
|
|
|
|
{
|
|
|
|
# Usage BootStaticLibrary <name> : <sources> ;
|
|
|
|
# This is designed to take a set of sources and libraries and create
|
|
|
|
# a file called <name>
|
|
|
|
|
|
|
|
# Show that we depend on the libraries we need
|
|
|
|
SetupBoot $(2) ;
|
|
|
|
LocalClean clean : $(1) ;
|
|
|
|
LocalDepends all : $(1) ;
|
|
|
|
Depends $(1) : $(2) ;
|
|
|
|
|
|
|
|
MakeLocateDebug $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BootStaticLibraryObjects
|
|
|
|
{
|
|
|
|
# Force recreation of the archive to avoid build errors caused by
|
|
|
|
# stale dependencies after renaming or deleting object files.
|
|
|
|
$(RM) "$(1)"
|
2021-10-01 01:16:13 +03:00
|
|
|
$(HAIKU_AR_$(TARGET_KERNEL_ARCH)) -r "$(1)" "$(2)" ;
|
2012-05-27 00:47:27 +04:00
|
|
|
}
|
2015-06-01 14:11:47 +03:00
|
|
|
|
|
|
|
rule BuildMBR binary : source
|
|
|
|
{
|
|
|
|
SEARCH on $(source) = $(SUBDIR) ;
|
|
|
|
MakeLocateDebug $(binary) ;
|
|
|
|
Depends $(binary) : $(source) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildMBR
|
|
|
|
{
|
|
|
|
$(RM) $(1)
|
2018-11-03 04:41:53 +03:00
|
|
|
$(HAIKU_CC_$(HAIKU_PACKAGING_ARCH)) $(HAIKU_LINKFLAGS_$(HAIKU_PACKAGING_ARCH)) \
|
2018-11-23 08:03:51 +03:00
|
|
|
$(2) -o $(1) $(MBRFLAGS) -nostdlib -m32 -Wl,--oformat,binary -Wl,-z,notext \
|
2018-11-03 04:41:53 +03:00
|
|
|
-Xlinker -S -Xlinker -N -Xlinker --entry=start -Xlinker -Ttext=0x600
|
2015-06-01 14:11:47 +03:00
|
|
|
}
|