1338b8dc3SIngo Weinhold# Haiku Jamrules 2979afc6fSAxel Dörfler 3*c52d856eSAugustin Cavalier# Make sure HAIKU_TOP is a relative path (and prefer it to be the current or 4*c52d856eSAugustin Cavalier# parent directory.) 53facc270SAugustin Cavalier# 63facc270SAugustin Cavalier# This is done so that invocations to the compiler and other tools, which 73facc270SAugustin Cavalier# under some circumstances inject the source's path into the generated file, 83facc270SAugustin Cavalier# are passed relative paths, making builds more reproducible. 9*c52d856eSAugustin Cavalierif $(HAIKU_TOP) != "." && $(HAIKU_TOP) != ".." 10*c52d856eSAugustin Cavalier && ! [ Match "\\.\\./(.*)" : $(HAIKU_TOP) ] { 11f7b5d8a1SAugustin Cavalier Exit "The present path to the project root is '$(HAIKU_TOP)', but you" 12f7b5d8a1SAugustin Cavalier "must be in the project root or a \"generated\" directory in order to" 13f7b5d8a1SAugustin Cavalier "build Haiku." 14f7b5d8a1SAugustin Cavalier 15f7b5d8a1SAugustin Cavalier "(If you are, and are still seeing this message, run " 16f7b5d8a1SAugustin Cavalier "\"../configure --update\" to solve the issue.)" ; 1763cc5547SOliver Tappe} 1863cc5547SOliver Tappe 19338b8dc3SIngo Weinhold# Main directories used by the build. 20338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 21e6d5152fSOliver TappeHAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 22e6d5152fSOliver TappeHAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ; 23e6d5152fSOliver TappeHAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 24e6d5152fSOliver TappeHAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 25413a591cSMatt Madia objects ] ; 26e6d5152fSOliver TappeHAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) 270a53d94bSMatt Madia catalogs ] ; 28e6d5152fSOliver TappeHAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 29e6d5152fSOliver TappeHAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 301467a878SAxel Dörfler download ] ; 31e6d5152fSOliver TappeHAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 32ff81d306SIngo Weinhold build_packages ] ; 334ff6d49fSIngo Weinhold 344ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching 354ff6d49fSIngo WeinholdHCACHEFILE = header_cache ; 364ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ; 37338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 389eea4522SIngo Weinhold 39889903f9SIngo Weinhold# include BuildConfig 40889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 41889903f9SIngo Weinholdif ! $(buildConfig) { 42889903f9SIngo Weinhold ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 43889903f9SIngo Weinhold EXIT "Run ./configure in the source tree's root directory first!" ; 44889903f9SIngo Weinhold} 45889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 46889903f9SIngo Weinholdinclude BuildConfig ; 47889903f9SIngo Weinhold 48b0944c78SIngo Weinhold# set HAIKU_PACKAGING_ARCH, the primary packaging architecture 49c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 50c0e8cc1aSIngo Weinhold 51338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include 52338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most 53338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules). 54338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The 55338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter. 56338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 5725b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 58b0944c78SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; 59338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 60d31a50eeSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; 61b891b0acSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 6237aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 63338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 64338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 65338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 66338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 6765ad1ba3SAlex Smithinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 68338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 69e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 70338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 71338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 72338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 73338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 7498c6dfa4SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 75ed25955aSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) SystemLibraryRules ] ; 76338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 77338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 78b9eec519SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 79b1e5b60cSAxel Dörfler 8098c6dfa4SIngo Weinhold# Include the repositories for this architecture. 8198c6dfa4SIngo Weinholdlocal repositoriesDirectory 8298c6dfa4SIngo Weinhold = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 83e173a1ecSIngo Weinholdlocal repositories = HaikuPorts ; 84a8c098a3SOliver Tappeif $(HAIKU_BUILD_TYPE) = bootstrap { 85e173a1ecSIngo Weinhold repositories = HaikuPortsCross ; 86e173a1ecSIngo Weinhold} 87e173a1ecSIngo Weinhold 8898c6dfa4SIngo Weinholdlocal repository ; 89e173a1ecSIngo Weinholdfor repository in $(repositories) { 9098c6dfa4SIngo Weinhold local repositoryDirectory 9198c6dfa4SIngo Weinhold = [ FDirName $(repositoriesDirectory) $(repository) ] ; 9298c6dfa4SIngo Weinhold local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 9398c6dfa4SIngo Weinhold if $(file) { 94d72ce066SIngo Weinhold HAIKU_REPOSITORY_JAMFILE = $(file) ; 9598c6dfa4SIngo Weinhold include $(file) ; 9698c6dfa4SIngo Weinhold } 9798c6dfa4SIngo Weinhold} 9898c6dfa4SIngo Weinhold 9930ed37c8SIngo Weinhold# Declare no-op user-overridable build rules. 10030ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets { } 10130ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage { } 10230ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage { } 10330ed37c8SIngo Weinhold 104338b8dc3SIngo Weinhold# Include UserBuildConfig. 105a4a52ab2SIngo Weinholdif ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 106338b8dc3SIngo Weinhold local userBuildConfig 107338b8dc3SIngo Weinhold = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 108338b8dc3SIngo Weinhold if $(userBuildConfig) { 109338b8dc3SIngo Weinhold include $(userBuildConfig) ; 1108c17a26bSIngo Weinhold } 111d5ec51caSMichael Lotz 112d5ec51caSMichael Lotz # allow for a separate UserBuildConfig per output directory 113d5ec51caSMichael Lotz local userBuildConfig 114d5ec51caSMichael Lotz = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 115d5ec51caSMichael Lotz if $(userBuildConfig) { 116d5ec51caSMichael Lotz include $(userBuildConfig) ; 117d5ec51caSMichael Lotz } 1188c17a26bSIngo Weinhold} 1198c17a26bSIngo Weinhold 120b9eec519SIngo WeinholdDefineDefaultBuildProfiles ; 121a0a9d225SIngo Weinhold 122338b8dc3SIngo WeinholdPrepareConfigVariables ; 123