2005-10-29 20:27:43 +04:00
|
|
|
# Rules without side effects.
|
|
|
|
|
|
|
|
# Vanilla Jam compatibility
|
|
|
|
if ! $(INVOCATION_SUBDIR_SET) {
|
|
|
|
rule FIsPrefix
|
|
|
|
{
|
|
|
|
# FIsPrefix <a> : <b> ;
|
|
|
|
# Returns true, if list <a> is a prefix (a proper one or equal) of
|
|
|
|
# list <b>, an empty list otherwise.
|
|
|
|
local a = $(1) ;
|
|
|
|
local b = $(2) ;
|
|
|
|
while $(a) && $(a[1]) = $(b[1]) {
|
|
|
|
a = $(a[2-]) ;
|
|
|
|
b = $(b[2-]) ;
|
|
|
|
}
|
2009-05-27 04:26:29 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
if $(a) {
|
|
|
|
return ;
|
|
|
|
} else {
|
|
|
|
return true ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule LocalClean { Clean $(1) : $(2) ; }
|
|
|
|
|
|
|
|
rule LocalDepends { Depends $(1) : $(2) ; }
|
|
|
|
|
|
|
|
} # vanilla Jam compatibility
|
|
|
|
|
|
|
|
rule FFilter
|
|
|
|
{
|
|
|
|
# FFilter <list> : <excludes> ;
|
|
|
|
# Removes all occurrences of <excludes> in <list>.
|
|
|
|
|
|
|
|
local list = $(1) ;
|
|
|
|
local excludes = $(2) ;
|
|
|
|
local newList ;
|
|
|
|
local item ;
|
|
|
|
for item in $(list) {
|
|
|
|
local skip ;
|
|
|
|
local exclude ;
|
|
|
|
for exclude in $(excludes) {
|
|
|
|
if $(item) = $(exclude) {
|
|
|
|
skip = true ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ! $(skip) {
|
|
|
|
newList += $(item) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $(newList) ;
|
|
|
|
}
|
|
|
|
|
2006-06-29 16:05:51 +04:00
|
|
|
rule FGetGrist
|
|
|
|
{
|
|
|
|
# FGetGrist <target> ;
|
|
|
|
#
|
|
|
|
# Returns the grist of a target, not including leading "<" and trailing ">".
|
|
|
|
|
|
|
|
local grist = $(1[1]:G) ;
|
|
|
|
if ! $(grist) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return [ Match <(.*)> : $(grist) ] ;
|
|
|
|
}
|
|
|
|
|
2009-05-27 04:26:29 +04:00
|
|
|
rule FSplitString string : delimiterChar
|
|
|
|
{
|
|
|
|
local result ;
|
|
|
|
|
|
|
|
while $(string) {
|
|
|
|
local split = [ Match $(delimiterChar)*([^$(delimiterChar)]+)(.*)
|
|
|
|
: $(string) ] ;
|
|
|
|
result += $(split[1]) ;
|
|
|
|
string = $(split[2-]) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(result) ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule FSplitPath
|
|
|
|
{
|
|
|
|
# SplitPath <path> ;
|
|
|
|
# Decomposes a path into its components.
|
|
|
|
local path = $(1:G=) ;
|
|
|
|
local components ;
|
|
|
|
# $(path:D) for "/" is "/". Therefore the second condition.
|
|
|
|
while $(path:D) && $(path:D) != $(path)
|
|
|
|
{
|
|
|
|
# Note: $(path:B) returns "." for "..", but $(path:D=) is fine.
|
|
|
|
components = $(path:D=) $(components) ;
|
|
|
|
path = $(path:D) ;
|
|
|
|
}
|
|
|
|
components = $(path) $(components) ;
|
|
|
|
return $(components) ;
|
|
|
|
}
|
|
|
|
|
2012-12-09 06:44:16 +04:00
|
|
|
|
2013-08-05 09:09:45 +04:00
|
|
|
rule FConditionsHold conditions : predicate
|
2012-12-09 06:44:16 +04:00
|
|
|
{
|
2013-08-05 09:09:45 +04:00
|
|
|
# FConditionsHold <conditions> : <predicate> ;
|
|
|
|
# Checks whether the conditions <conditions> are satisfied by the predicate
|
|
|
|
# rule <predicate> and returns a respective result (if so: "1", if not:
|
|
|
|
# empty list). The conditions are satisfied when <conditions> is not empty
|
|
|
|
# and
|
2012-12-09 06:44:16 +04:00
|
|
|
# * none of the negative conditions it contains hold and
|
2013-08-05 09:09:45 +04:00
|
|
|
# * if <conditions> contains any positive conditions, at least one of those
|
|
|
|
# holds.
|
2012-12-09 06:44:16 +04:00
|
|
|
# A positive condition is an element not starting with a "!". It holds when
|
2013-08-05 09:09:45 +04:00
|
|
|
# the predicate rule <predicate> returns true for the element.
|
2012-12-09 06:44:16 +04:00
|
|
|
# A negative condition is an element that starts with a "!". It holds when
|
2013-08-05 09:09:45 +04:00
|
|
|
# the predicate rule <predicate> returns true for the string resulting from
|
|
|
|
# removing the leading "!".
|
2012-12-09 06:44:16 +04:00
|
|
|
#
|
|
|
|
# <conditions> - The list of conditions.
|
2013-08-05 09:09:45 +04:00
|
|
|
# <predicate> - The predicate rule invoked to test the elements.
|
2012-12-09 06:44:16 +04:00
|
|
|
#
|
|
|
|
# Examples:
|
2013-08-05 09:09:45 +04:00
|
|
|
# For a predicate that holds for the elements of the set { a b c } the
|
|
|
|
# following conditions hold:
|
2012-12-09 06:44:16 +04:00
|
|
|
# { a }, { a d }, { !d }, { !d !e }, { a !d }, { b !e !f }
|
|
|
|
# The following conditions don't hold:
|
|
|
|
# { }, { d }, { d e }, { !a }, { !a b }, { !d e } { a b !c !d }
|
|
|
|
|
|
|
|
local hasPositive ;
|
|
|
|
local hasNegative ;
|
|
|
|
local positiveMatch ;
|
|
|
|
local condition ;
|
|
|
|
for condition in $(conditions) {
|
|
|
|
switch $(condition) {
|
|
|
|
case !* :
|
|
|
|
{
|
|
|
|
hasNegative = 1 ;
|
|
|
|
condition = [ Match "!(.*)" : $(condition) ] ;
|
2013-08-05 09:09:45 +04:00
|
|
|
if [ $(predicate) $(condition) ] {
|
2012-12-09 06:44:16 +04:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case * :
|
|
|
|
{
|
|
|
|
hasPositive = 1 ;
|
2013-08-05 09:09:45 +04:00
|
|
|
if [ $(predicate) $(condition) ] {
|
2012-12-09 06:44:16 +04:00
|
|
|
positiveMatch = 1 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(hasPositive) {
|
|
|
|
return $(positiveMatch) ;
|
|
|
|
}
|
|
|
|
return $(hasNegative) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule SetPlatformCompatibilityFlagVariables
|
|
|
|
{
|
|
|
|
# SetPlatformCompatibilityFlagVariables <platform var> : <var prefix>
|
|
|
|
# : <platform kind> [ : other platforms ] ;
|
|
|
|
|
|
|
|
local platformVar = $(1) ;
|
|
|
|
local platform = $($(platformVar)) ;
|
|
|
|
local varPrefix = $(2) ;
|
|
|
|
local platformKind = $(3) ;
|
|
|
|
local otherPlatforms = $(4) ;
|
|
|
|
|
|
|
|
if ! $(platform) {
|
|
|
|
ECHO "Variable $(platformVar) not set. Please run ./configure or" ;
|
|
|
|
EXIT "specify it manually." ;
|
|
|
|
}
|
|
|
|
|
2019-03-30 21:16:46 +03:00
|
|
|
# special case: Haiku libbe.so built for testing under Haiku
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
if $(platform) = libbe_test {
|
2007-08-05 05:13:27 +04:00
|
|
|
platform = $(HOST_PLATFORM) ;
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
}
|
|
|
|
|
2019-03-30 21:16:46 +03:00
|
|
|
# unset variables first
|
2005-10-29 20:27:43 +04:00
|
|
|
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = ;
|
2009-05-27 04:26:29 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
switch $(platform)
|
|
|
|
{
|
2007-08-03 01:13:56 +04:00
|
|
|
case haiku_host :
|
|
|
|
{
|
|
|
|
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
case haiku :
|
|
|
|
{
|
|
|
|
$(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ;
|
|
|
|
}
|
2007-08-03 01:13:56 +04:00
|
|
|
|
2013-09-18 17:26:35 +04:00
|
|
|
case host :
|
|
|
|
# not compatible to anything
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
case * :
|
|
|
|
{
|
|
|
|
if ! ( $(platform) in $(otherPlatforms) ) {
|
|
|
|
Exit Unsupported $(platformKind) platform: $(platform) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# set the machine friendly flags
|
|
|
|
$(varPrefix)_PLATFORM_(haiku)_COMPATIBLE
|
|
|
|
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
2007-08-03 01:13:56 +04:00
|
|
|
$(varPrefix)_PLATFORM_(haiku_host)_COMPATIBLE
|
|
|
|
?= $($(varPrefix)_PLATFORM_HAIKU_COMPATIBLE) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
rule SetIncludePropertiesVariables prefix : suffix
|
2005-11-13 01:58:54 +03:00
|
|
|
{
|
2013-08-01 10:51:16 +04:00
|
|
|
# SetIncludePropertiesVariables <prefix> : <suffix> ;
|
2005-11-13 01:58:54 +03:00
|
|
|
#
|
2013-08-01 10:51:16 +04:00
|
|
|
suffix = $(suffix:E=) ;
|
2020-10-10 23:24:43 +03:00
|
|
|
if $($(prefix)_CC_IS_LEGACY_GCC$(suffix)) = 1 {
|
2013-08-01 10:51:16 +04:00
|
|
|
$(prefix)_INCLUDES_SEPARATOR$(suffix) = -I- ;
|
|
|
|
$(prefix)_LOCAL_INCLUDES_OPTION$(suffix) = -I ;
|
|
|
|
$(prefix)_SYSTEM_INCLUDES_OPTION$(suffix) = -I ;
|
2005-11-13 01:58:54 +03:00
|
|
|
} else {
|
2013-08-01 10:51:16 +04:00
|
|
|
$(prefix)_INCLUDES_SEPARATOR$(suffix) = ;
|
|
|
|
$(prefix)_LOCAL_INCLUDES_OPTION$(suffix) = "-iquote " ;
|
|
|
|
$(prefix)_SYSTEM_INCLUDES_OPTION$(suffix) = "-I " ;
|
2005-11-13 01:58:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
rule SetPlatformForTarget
|
|
|
|
{
|
|
|
|
# SetPlatformForTarget <target> : <platform> ;
|
|
|
|
|
|
|
|
PLATFORM on $(1) = $(2) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SetSubDirPlatform
|
|
|
|
{
|
|
|
|
# SetSubDirPlatform <platform> ;
|
|
|
|
|
|
|
|
PLATFORM = $(1) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SetSupportedPlatformsForTarget
|
|
|
|
{
|
|
|
|
# SetSupportedPlatformsForTarget <target> : <platforms> ;
|
|
|
|
|
|
|
|
SUPPORTED_PLATFORMS on $(1) = $(2) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule SetSubDirSupportedPlatforms
|
|
|
|
{
|
|
|
|
# SetSubDirSupportedPlatforms <platforms> ;
|
|
|
|
|
|
|
|
SUPPORTED_PLATFORMS = $(1) ;
|
|
|
|
}
|
|
|
|
|
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true.
Library names are now mapped for all targets but "host" (not only for
"haiku") -- added one more level of indirection to achieve that.
(TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*).
* Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h
(auto-included when compiling something that uses the Be API for platform
"host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h,
which can be included when compiling something that can be built for both,
Haiku and BeOS compatible platforms.
* Introduced libhaikucompat.a, a library that adds a few functions existing
under Haiku, but not under BeOS.
* New rule AddSubDirSupportedPlatforms.
* Renamed libopenbeos.so to libbe_haiku.so.
* Introduced new target platform "libbe_test", which is basically equivalent
to a BeOS compatible host platform target, with the exception, that instead
of the host platform's libbe.so a special build of Haiku's libbe.so
(libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore
Haiku's public app, interface, storage, and support kit headers are used
when compiling. This replaces the less nice way in which the test app server
and applications for this test environment were built.
When building for platform "libbe_test", the library name "be" is
autotranslated to "libbe_haiku.so". Thus most applications don't need
special fiddling when them building them for the app server test environment;
usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice.
* Reduced the dependencies of <syscalls.h> and fixed problems caused by this
(e.g. source files not including the needed headers directly).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
|
|
|
rule AddSubDirSupportedPlatforms
|
|
|
|
{
|
|
|
|
# AddSubDirSupportedPlatforms <platforms> ;
|
|
|
|
|
|
|
|
SUPPORTED_PLATFORMS += $(1) ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
rule IsPlatformSupportedForTarget
|
|
|
|
{
|
|
|
|
# IsPlatformSupportedForTarget <target> [ : <platform> ]
|
|
|
|
#
|
|
|
|
|
|
|
|
on $(1) {
|
|
|
|
if $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
|
|
|
|
return true ;
|
|
|
|
} else {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule InheritPlatform
|
|
|
|
{
|
|
|
|
# InheritPlatform <children> : <parent> ;
|
|
|
|
# PLATFORM and SUPPORTED_PLATFORMS are set on <children> to their value
|
|
|
|
# on <parent>.
|
|
|
|
#
|
|
|
|
local children = $(1) ;
|
|
|
|
local parent = $(2) ;
|
|
|
|
|
|
|
|
on $(parent) {
|
|
|
|
PLATFORM on $(children) = $(PLATFORM) ;
|
|
|
|
SUPPORTED_PLATFORMS on $(children) = $(SUPPORTED_PLATFORMS) ;
|
|
|
|
}
|
|
|
|
}
|
2006-09-05 19:52:36 +04:00
|
|
|
|
|
|
|
rule SubDirAsFlags
|
|
|
|
{
|
2018-05-07 03:54:32 +03:00
|
|
|
SUBDIRASFLAGS += $(<) ;
|
2006-09-05 19:52:36 +04:00
|
|
|
}
|