1338b8dc3SIngo Weinhold# Haiku Jamrules 2979afc6fSAxel Dörfler 3*3facc270SAugustin Cavalier# Make sure HAIKU_TOP is relative and either the current or parent directory. 4*3facc270SAugustin Cavalier# 5*3facc270SAugustin Cavalier# This is done so that invocations to the compiler and other tools, which 6*3facc270SAugustin Cavalier# under some circumstances inject the source's path into the generated file, 7*3facc270SAugustin Cavalier# are passed relative paths, making builds more reproducible. 8*3facc270SAugustin Cavalierif $(HAIKU_TOP) != "." && $(HAIKU_TOP) != ".." { 9*3facc270SAugustin Cavalier Exit "You must be in the project root or a \"generated\" directory" 10*3facc270SAugustin Cavalier "in order to build Haiku (if you are and are still seeing this" 11*3facc270SAugustin Cavalier "message, run \"../configure --update\" to solve the issue.)" ; 1263cc5547SOliver Tappe} 1363cc5547SOliver Tappe 14338b8dc3SIngo Weinhold# Main directories used by the build. 15338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 16e6d5152fSOliver TappeHAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 17e6d5152fSOliver TappeHAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ; 18e6d5152fSOliver TappeHAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 19e6d5152fSOliver TappeHAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 20413a591cSMatt Madia objects ] ; 21e6d5152fSOliver TappeHAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) 220a53d94bSMatt Madia catalogs ] ; 23e6d5152fSOliver TappeHAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 24e6d5152fSOliver TappeHAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 251467a878SAxel Dörfler download ] ; 26e6d5152fSOliver TappeHAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 27ff81d306SIngo Weinhold build_packages ] ; 284ff6d49fSIngo Weinhold 294ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching 304ff6d49fSIngo WeinholdHCACHEFILE = header_cache ; 314ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ; 32338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 339eea4522SIngo Weinhold 34889903f9SIngo Weinhold# include BuildConfig 35889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 36889903f9SIngo Weinholdif ! $(buildConfig) { 37889903f9SIngo Weinhold ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 38889903f9SIngo Weinhold EXIT "Run ./configure in the source tree's root directory first!" ; 39889903f9SIngo Weinhold} 40889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 41889903f9SIngo Weinholdinclude BuildConfig ; 42889903f9SIngo Weinhold 43b0944c78SIngo Weinhold# set HAIKU_PACKAGING_ARCH, the primary packaging architecture 44c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 45c0e8cc1aSIngo Weinhold 46338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include 47338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most 48338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules). 49338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The 50338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter. 51338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 5225b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 53b0944c78SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; 54338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 55d31a50eeSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; 56b891b0acSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 5737aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 58338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 59338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 60338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 61338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 6265ad1ba3SAlex Smithinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 63338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 64e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 65338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 66338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 67338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 68338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 6998c6dfa4SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 70ed25955aSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) SystemLibraryRules ] ; 71338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 72338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 73b9eec519SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 74b1e5b60cSAxel Dörfler 7598c6dfa4SIngo Weinhold# Include the repositories for this architecture. 7698c6dfa4SIngo Weinholdlocal repositoriesDirectory 7798c6dfa4SIngo Weinhold = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 78e173a1ecSIngo Weinholdlocal repositories = HaikuPorts ; 79a8c098a3SOliver Tappeif $(HAIKU_BUILD_TYPE) = bootstrap { 80e173a1ecSIngo Weinhold repositories = HaikuPortsCross ; 81e173a1ecSIngo Weinhold} 82e173a1ecSIngo Weinhold 8398c6dfa4SIngo Weinholdlocal repository ; 84e173a1ecSIngo Weinholdfor repository in $(repositories) { 8598c6dfa4SIngo Weinhold local repositoryDirectory 8698c6dfa4SIngo Weinhold = [ FDirName $(repositoriesDirectory) $(repository) ] ; 8798c6dfa4SIngo Weinhold local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 8898c6dfa4SIngo Weinhold if $(file) { 89d72ce066SIngo Weinhold HAIKU_REPOSITORY_JAMFILE = $(file) ; 9098c6dfa4SIngo Weinhold include $(file) ; 9198c6dfa4SIngo Weinhold } 9298c6dfa4SIngo Weinhold} 9398c6dfa4SIngo Weinhold 9430ed37c8SIngo Weinhold# Declare no-op user-overridable build rules. 9530ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets { } 9630ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage { } 9730ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage { } 9830ed37c8SIngo Weinhold 99338b8dc3SIngo Weinhold# Include UserBuildConfig. 100a4a52ab2SIngo Weinholdif ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 101338b8dc3SIngo Weinhold local userBuildConfig 102338b8dc3SIngo Weinhold = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 103338b8dc3SIngo Weinhold if $(userBuildConfig) { 104338b8dc3SIngo Weinhold include $(userBuildConfig) ; 1058c17a26bSIngo Weinhold } 106d5ec51caSMichael Lotz 107d5ec51caSMichael Lotz # allow for a separate UserBuildConfig per output directory 108d5ec51caSMichael Lotz local userBuildConfig 109d5ec51caSMichael Lotz = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 110d5ec51caSMichael Lotz if $(userBuildConfig) { 111d5ec51caSMichael Lotz include $(userBuildConfig) ; 112d5ec51caSMichael Lotz } 1138c17a26bSIngo Weinhold} 1148c17a26bSIngo Weinhold 115b9eec519SIngo WeinholdDefineDefaultBuildProfiles ; 116a0a9d225SIngo Weinhold 117338b8dc3SIngo WeinholdPrepareConfigVariables ; 118