1338b8dc3SIngo Weinhold# Haiku Jamrules 2979afc6fSAxel Dörfler 3*63cc5547SOliver Tappe# Make sure we have an absolute HAIKU_TOP 4*63cc5547SOliver Tappeif $(HAIKU_TOP) = "." { 5*63cc5547SOliver Tappe HAIKU_TOP = $(PWD) ; 6*63cc5547SOliver Tappe} 7*63cc5547SOliver Tappe 8338b8dc3SIngo Weinhold# Main directories used by the build. 9338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 10e6d5152fSOliver TappeHAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 11e6d5152fSOliver TappeHAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ; 12e6d5152fSOliver TappeHAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 13e6d5152fSOliver TappeHAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 14413a591cSMatt Madia objects ] ; 15e6d5152fSOliver TappeHAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) 160a53d94bSMatt Madia catalogs ] ; 17e6d5152fSOliver TappeHAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 18e6d5152fSOliver TappeHAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 191467a878SAxel Dörfler download ] ; 20e6d5152fSOliver TappeHAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 21ff81d306SIngo Weinhold build_packages ] ; 224ff6d49fSIngo Weinhold 234ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching 244ff6d49fSIngo WeinholdHCACHEFILE = header_cache ; 254ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ; 26338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 279eea4522SIngo Weinhold 28889903f9SIngo Weinhold# include BuildConfig 29889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 30889903f9SIngo Weinholdif ! $(buildConfig) { 31889903f9SIngo Weinhold ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 32889903f9SIngo Weinhold EXIT "Run ./configure in the source tree's root directory first!" ; 33889903f9SIngo Weinhold} 34889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 35889903f9SIngo Weinholdinclude BuildConfig ; 36889903f9SIngo Weinhold 37b0944c78SIngo Weinhold# set HAIKU_PACKAGING_ARCH, the primary packaging architecture 38c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 39c0e8cc1aSIngo Weinhold 40338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include 41338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most 42338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules). 43338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The 44338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter. 45338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 4625b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 47b0944c78SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; 48338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 49d31a50eeSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; 50b891b0acSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 5137aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 52338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 53338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ; 54338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 55338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 56338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 5765ad1ba3SAlex Smithinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 58338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 59e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 60338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 61338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 62338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 63338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 6498c6dfa4SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 65338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 66338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 67b9eec519SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 68b1e5b60cSAxel Dörfler 6998c6dfa4SIngo Weinhold# Include the repositories for this architecture. 7098c6dfa4SIngo Weinholdlocal repositoriesDirectory 7198c6dfa4SIngo Weinhold = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 72e173a1ecSIngo Weinholdlocal repositories = HaikuPorts ; 73a8c098a3SOliver Tappeif $(HAIKU_BUILD_TYPE) = bootstrap { 74e173a1ecSIngo Weinhold repositories = HaikuPortsCross ; 75e173a1ecSIngo Weinhold} 76e173a1ecSIngo Weinhold 7798c6dfa4SIngo Weinholdlocal repository ; 78e173a1ecSIngo Weinholdfor repository in $(repositories) { 7998c6dfa4SIngo Weinhold local repositoryDirectory 8098c6dfa4SIngo Weinhold = [ FDirName $(repositoriesDirectory) $(repository) ] ; 8198c6dfa4SIngo Weinhold local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 8298c6dfa4SIngo Weinhold if $(file) { 83d72ce066SIngo Weinhold HAIKU_REPOSITORY_JAMFILE = $(file) ; 8498c6dfa4SIngo Weinhold include $(file) ; 8598c6dfa4SIngo Weinhold } 8698c6dfa4SIngo Weinhold} 8798c6dfa4SIngo Weinhold 8830ed37c8SIngo Weinhold# Declare no-op user-overridable build rules. 8930ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets { } 9030ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage { } 9130ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage { } 9230ed37c8SIngo Weinhold 93338b8dc3SIngo Weinhold# Include UserBuildConfig. 94a4a52ab2SIngo Weinholdif ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 95338b8dc3SIngo Weinhold local userBuildConfig 96338b8dc3SIngo Weinhold = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 97338b8dc3SIngo Weinhold if $(userBuildConfig) { 98338b8dc3SIngo Weinhold include $(userBuildConfig) ; 998c17a26bSIngo Weinhold } 100d5ec51caSMichael Lotz 101d5ec51caSMichael Lotz # allow for a separate UserBuildConfig per output directory 102d5ec51caSMichael Lotz local userBuildConfig 103d5ec51caSMichael Lotz = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 104d5ec51caSMichael Lotz if $(userBuildConfig) { 105d5ec51caSMichael Lotz include $(userBuildConfig) ; 106d5ec51caSMichael Lotz } 1078c17a26bSIngo Weinhold} 1088c17a26bSIngo Weinhold 109b9eec519SIngo WeinholdDefineDefaultBuildProfiles ; 110a0a9d225SIngo Weinhold 111338b8dc3SIngo WeinholdPrepareConfigVariables ; 112