2005-10-29 18:27:43 +02:00
|
|
|
# Haiku Jamrules
|
2005-03-05 15:11:02 +01:00
|
|
|
|
2018-11-22 01:09:04 +01:00
|
|
|
# Make sure we are on a sane version of Jam.
|
|
|
|
if ! [ Match "(.*)-haiku-(.*)" : $(JAMVERSION) ] {
|
|
|
|
Exit "You can only build Haiku with Haiku's Jam, not Perforce Jam or"
|
|
|
|
"some other variant (you are using $(JAMVERSION))." ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make sure we are on a recent Jambase.
|
|
|
|
if $(JAMBASEDATE) < 2018 {
|
|
|
|
Exit "Your Jambase is too old ($(JAMBASEDATE)); please update it (likely"
|
|
|
|
"by updating Jam itself.)" ;
|
|
|
|
}
|
|
|
|
|
2018-11-02 02:37:04 +01:00
|
|
|
# Make sure HAIKU_TOP is a relative path (and prefer it to be the current or
|
|
|
|
# parent directory.)
|
Jamrules: Force HAIKU_TOP to be relative.
Prior to hrev47631 (2014), HAIKU_TOP was relative when jam was invoked
from the repository root, and not relative when jam was invoked from
any other location, including "generated." In hrev47631, Jamrules
was changed to be as it was before this commit, in order to fix #11101
(Haiku repository creation failed due to the use of relative paths.)
GCC, however, injects the full path passed to the compiler into some
symbols under certain circumstanes (anonymous namespaces, for one),
and so a relative path for more reproducible builds is preferred.
It seems the aforementioned bug is no longer with us, as a full image
build that I did with this change worked just fine.
Note that you will have to run "configure --update" after this
in the case that you usually invoke "jam" from the generated directory,
as the Jamfile configure generated included absolute paths. (The reminder
to do that this diff includes can be removed after some reasonable amount
of time.)
2018-11-02 01:56:04 +01:00
|
|
|
#
|
|
|
|
# This is done so that invocations to the compiler and other tools, which
|
|
|
|
# under some circumstances inject the source's path into the generated file,
|
|
|
|
# are passed relative paths, making builds more reproducible.
|
2018-11-02 02:37:04 +01:00
|
|
|
if $(HAIKU_TOP) != "." && $(HAIKU_TOP) != ".."
|
|
|
|
&& ! [ Match "\\.\\./(.*)" : $(HAIKU_TOP) ] {
|
2018-11-02 02:24:43 +01:00
|
|
|
Exit "The present path to the project root is '$(HAIKU_TOP)', but you"
|
|
|
|
"must be in the project root or a \"generated\" directory in order to"
|
|
|
|
"build Haiku."
|
|
|
|
|
|
|
|
"(If you are, and are still seeing this message, run "
|
|
|
|
"\"../configure --update\" to solve the issue.)" ;
|
2014-08-06 23:48:37 +02:00
|
|
|
}
|
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
# Main directories used by the build.
|
|
|
|
HAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ;
|
2014-06-16 21:01:07 +02:00
|
|
|
HAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ;
|
|
|
|
HAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ;
|
|
|
|
HAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ;
|
|
|
|
HAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR)
|
2010-09-26 18:21:14 +02:00
|
|
|
objects ] ;
|
2014-06-16 21:01:07 +02:00
|
|
|
HAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR)
|
2010-09-26 18:55:06 +02:00
|
|
|
catalogs ] ;
|
2014-06-16 21:01:07 +02:00
|
|
|
HAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ;
|
|
|
|
HAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR)
|
2009-11-26 12:11:17 +01:00
|
|
|
download ] ;
|
2014-06-16 21:01:07 +02:00
|
|
|
HAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR)
|
2009-04-08 12:07:17 +02:00
|
|
|
build_packages ] ;
|
2002-11-20 01:46:04 +01:00
|
|
|
|
2018-11-03 02:46:22 +01:00
|
|
|
# Absolutely rooted versions of some of the main directories
|
|
|
|
HAIKU_ABSOLUTE_TOP ?= [ FDirName $(PWD) $(HAIKU_TOP) ] ;
|
2018-11-03 03:46:19 +01:00
|
|
|
HAIKU_ABSOLUTE_OUTPUT_DIR ?= [ FDirName $(PWD) $(HAIKU_OUTPUT_DIR) ] ;
|
2018-11-03 02:46:22 +01:00
|
|
|
|
2002-11-20 01:46:04 +01:00
|
|
|
# Cache files for header scanning and jamfile caching
|
|
|
|
HCACHEFILE = header_cache ;
|
|
|
|
JCACHEFILE = jamfile_cache ;
|
2005-10-29 18:27:43 +02:00
|
|
|
LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
|
|
|
|
2008-10-23 23:45:24 +02:00
|
|
|
# include BuildConfig
|
|
|
|
local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
|
|
|
|
if ! $(buildConfig) {
|
|
|
|
ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
|
|
|
|
EXIT "Run ./configure in the source tree's root directory first!" ;
|
|
|
|
}
|
|
|
|
LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
|
|
|
|
include BuildConfig ;
|
|
|
|
|
2013-08-01 08:51:16 +02:00
|
|
|
# set HAIKU_PACKAGING_ARCH, the primary packaging architecture
|
2013-07-25 23:52:11 +02:00
|
|
|
HAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ;
|
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
# The build setup and rules are neatly organized in several files. Include
|
|
|
|
# them now. Start with the side-effect-less rules, since they are the most
|
|
|
|
# likely to be used in the top level context (i.e. not only in rules).
|
|
|
|
# At the end include BuildSetup that sets up global variables etc. The
|
|
|
|
# optional user-defined UserBuildConfig is included thereafter.
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ;
|
2007-04-06 04:37:12 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ;
|
2013-08-01 08:51:16 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ;
|
2013-08-05 00:17:46 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ;
|
2010-07-23 21:56:24 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ;
|
2009-02-23 23:33:09 +01:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
|
2012-05-26 22:47:27 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
|
2009-02-15 03:34:32 +01:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
|
2013-07-05 10:51:42 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ;
|
2014-07-26 13:08:30 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) SystemLibraryRules ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
|
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
|
2013-07-21 03:20:26 +02:00
|
|
|
include [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ;
|
2005-10-29 18:27:43 +02:00
|
|
|
|
2019-09-15 17:33:36 +02:00
|
|
|
# Include the repositories for this architecture.
|
|
|
|
local repositoriesDirectory
|
|
|
|
= [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ;
|
|
|
|
local repositories = HaikuPorts ;
|
|
|
|
if $(HAIKU_BUILD_TYPE) = bootstrap {
|
|
|
|
repositories = HaikuPortsCross ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local repository ;
|
|
|
|
for repository in $(repositories) {
|
|
|
|
local repositoryDirectory
|
|
|
|
= [ FDirName $(repositoriesDirectory) $(repository) ] ;
|
|
|
|
local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ;
|
|
|
|
if $(file) {
|
|
|
|
HAIKU_REPOSITORY_JAMFILE = $(file) ;
|
|
|
|
include $(file) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-03 03:02:28 +01:00
|
|
|
# Declare no-op user-overridable build rules.
|
|
|
|
rule UserBuildConfigRulePostBuildTargets { }
|
|
|
|
rule UserBuildConfigRulePreImage { }
|
|
|
|
rule UserBuildConfigRulePostImage { }
|
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
# Include UserBuildConfig.
|
2009-05-27 02:45:44 +02:00
|
|
|
if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
|
2005-10-29 18:27:43 +02:00
|
|
|
local userBuildConfig
|
|
|
|
= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
|
|
|
|
if $(userBuildConfig) {
|
|
|
|
include $(userBuildConfig) ;
|
|
|
|
}
|
2009-02-08 14:20:19 +01:00
|
|
|
|
|
|
|
# allow for a separate UserBuildConfig per output directory
|
|
|
|
local userBuildConfig
|
|
|
|
= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
|
|
|
|
if $(userBuildConfig) {
|
|
|
|
include $(userBuildConfig) ;
|
|
|
|
}
|
2005-10-29 18:27:43 +02:00
|
|
|
}
|
|
|
|
|
2013-07-21 03:20:26 +02:00
|
|
|
DefineDefaultBuildProfiles ;
|
2008-04-02 22:29:43 +02:00
|
|
|
|
2005-10-29 18:27:43 +02:00
|
|
|
PrepareConfigVariables ;
|