1338b8dc3SIngo Weinhold# Haiku Jamrules 2979afc6fSAxel Dörfler 33facc270SAugustin Cavalier# Make sure HAIKU_TOP is relative and either the current or parent directory. 43facc270SAugustin Cavalier# 53facc270SAugustin Cavalier# This is done so that invocations to the compiler and other tools, which 63facc270SAugustin Cavalier# under some circumstances inject the source's path into the generated file, 73facc270SAugustin Cavalier# are passed relative paths, making builds more reproducible. 83facc270SAugustin Cavalierif $(HAIKU_TOP) != "." && $(HAIKU_TOP) != ".." { 9*f7b5d8a1SAugustin Cavalier Exit "The present path to the project root is '$(HAIKU_TOP)', but you" 10*f7b5d8a1SAugustin Cavalier "must be in the project root or a \"generated\" directory in order to" 11*f7b5d8a1SAugustin Cavalier "build Haiku." 12*f7b5d8a1SAugustin Cavalier 13*f7b5d8a1SAugustin Cavalier "(If you are, and are still seeing this message, run " 14*f7b5d8a1SAugustin Cavalier "\"../configure --update\" to solve the issue.)" ; 1563cc5547SOliver Tappe} 1663cc5547SOliver Tappe 17338b8dc3SIngo Weinhold# Main directories used by the build. 18338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 19e6d5152fSOliver TappeHAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 20e6d5152fSOliver TappeHAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ; 21e6d5152fSOliver TappeHAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 22e6d5152fSOliver TappeHAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 23413a591cSMatt Madia objects ] ; 24e6d5152fSOliver TappeHAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) 250a53d94bSMatt Madia catalogs ] ; 26e6d5152fSOliver TappeHAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 27e6d5152fSOliver TappeHAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 281467a878SAxel Dörfler download ] ; 29e6d5152fSOliver TappeHAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 30ff81d306SIngo Weinhold build_packages ] ; 314ff6d49fSIngo Weinhold 324ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching 334ff6d49fSIngo WeinholdHCACHEFILE = header_cache ; 344ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ; 35338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 369eea4522SIngo Weinhold 37889903f9SIngo Weinhold# include BuildConfig 38889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 39889903f9SIngo Weinholdif ! $(buildConfig) { 40889903f9SIngo Weinhold ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 41889903f9SIngo Weinhold EXIT "Run ./configure in the source tree's root directory first!" ; 42889903f9SIngo Weinhold} 43889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 44889903f9SIngo Weinholdinclude BuildConfig ; 45889903f9SIngo Weinhold 46b0944c78SIngo Weinhold# set HAIKU_PACKAGING_ARCH, the primary packaging architecture 47c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 48c0e8cc1aSIngo Weinhold 49338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include 50338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most 51338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules). 52338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The 53338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter. 54338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 5525b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 56b0944c78SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; 57338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 58d31a50eeSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; 59b891b0acSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 6037aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 61338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 62338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 63338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 64338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 6565ad1ba3SAlex Smithinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 66338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 67e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 68338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 69338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 70338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 71338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 7298c6dfa4SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 73ed25955aSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) SystemLibraryRules ] ; 74338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 75338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 76b9eec519SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 77b1e5b60cSAxel Dörfler 7898c6dfa4SIngo Weinhold# Include the repositories for this architecture. 7998c6dfa4SIngo Weinholdlocal repositoriesDirectory 8098c6dfa4SIngo Weinhold = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 81e173a1ecSIngo Weinholdlocal repositories = HaikuPorts ; 82a8c098a3SOliver Tappeif $(HAIKU_BUILD_TYPE) = bootstrap { 83e173a1ecSIngo Weinhold repositories = HaikuPortsCross ; 84e173a1ecSIngo Weinhold} 85e173a1ecSIngo Weinhold 8698c6dfa4SIngo Weinholdlocal repository ; 87e173a1ecSIngo Weinholdfor repository in $(repositories) { 8898c6dfa4SIngo Weinhold local repositoryDirectory 8998c6dfa4SIngo Weinhold = [ FDirName $(repositoriesDirectory) $(repository) ] ; 9098c6dfa4SIngo Weinhold local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 9198c6dfa4SIngo Weinhold if $(file) { 92d72ce066SIngo Weinhold HAIKU_REPOSITORY_JAMFILE = $(file) ; 9398c6dfa4SIngo Weinhold include $(file) ; 9498c6dfa4SIngo Weinhold } 9598c6dfa4SIngo Weinhold} 9698c6dfa4SIngo Weinhold 9730ed37c8SIngo Weinhold# Declare no-op user-overridable build rules. 9830ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets { } 9930ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage { } 10030ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage { } 10130ed37c8SIngo Weinhold 102338b8dc3SIngo Weinhold# Include UserBuildConfig. 103a4a52ab2SIngo Weinholdif ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 104338b8dc3SIngo Weinhold local userBuildConfig 105338b8dc3SIngo Weinhold = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 106338b8dc3SIngo Weinhold if $(userBuildConfig) { 107338b8dc3SIngo Weinhold include $(userBuildConfig) ; 1088c17a26bSIngo Weinhold } 109d5ec51caSMichael Lotz 110d5ec51caSMichael Lotz # allow for a separate UserBuildConfig per output directory 111d5ec51caSMichael Lotz local userBuildConfig 112d5ec51caSMichael Lotz = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 113d5ec51caSMichael Lotz if $(userBuildConfig) { 114d5ec51caSMichael Lotz include $(userBuildConfig) ; 115d5ec51caSMichael Lotz } 1168c17a26bSIngo Weinhold} 1178c17a26bSIngo Weinhold 118b9eec519SIngo WeinholdDefineDefaultBuildProfiles ; 119a0a9d225SIngo Weinhold 120338b8dc3SIngo WeinholdPrepareConfigVariables ; 121