1# Haiku Jamrules 2 3# Make sure HAIKU_TOP is a relative path (and prefer it to be the current or 4# parent directory.) 5# 6# This is done so that invocations to the compiler and other tools, which 7# under some circumstances inject the source's path into the generated file, 8# are passed relative paths, making builds more reproducible. 9if $(HAIKU_TOP) != "." && $(HAIKU_TOP) != ".." 10 && ! [ Match "\\.\\./(.*)" : $(HAIKU_TOP) ] { 11 Exit "The present path to the project root is '$(HAIKU_TOP)', but you" 12 "must be in the project root or a \"generated\" directory in order to" 13 "build Haiku." 14 15 "(If you are, and are still seeing this message, run " 16 "\"../configure --update\" to solve the issue.)" ; 17} 18 19# Main directories used by the build. 20HAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 21HAIKU_BUILD_OUTPUT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 22HAIKU_BUILD_DIR ?= [ FDirName $(HAIKU_TOP) build ] ; 23HAIKU_BUILD_RULES_DIR ?= [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 24HAIKU_OBJECT_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 25 objects ] ; 26HAIKU_CATALOGS_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) 27 catalogs ] ; 28HAIKU_COMMON_PLATFORM_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 29HAIKU_DOWNLOAD_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 30 download ] ; 31HAIKU_OPTIONAL_BUILD_PACKAGES_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) 32 build_packages ] ; 33 34# Cache files for header scanning and jamfile caching 35HCACHEFILE = header_cache ; 36JCACHEFILE = jamfile_cache ; 37LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 38 39# include BuildConfig 40local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 41if ! $(buildConfig) { 42 ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 43 EXIT "Run ./configure in the source tree's root directory first!" ; 44} 45LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 46include BuildConfig ; 47 48# set HAIKU_PACKAGING_ARCH, the primary packaging architecture 49HAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 50 51# The build setup and rules are neatly organized in several files. Include 52# them now. Start with the side-effect-less rules, since they are the most 53# likely to be used in the top level context (i.e. not only in rules). 54# At the end include BuildSetup that sets up global variables etc. The 55# optional user-defined UserBuildConfig is included thereafter. 56include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 57include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 58include [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; 59include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 60include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; 61include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 62include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 63include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 64include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 65include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 66include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 67include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 68include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 69include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 70include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 71include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 72include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 73include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 74include [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 75include [ FDirName $(HAIKU_BUILD_RULES_DIR) SystemLibraryRules ] ; 76include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 77include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 78include [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 79 80# Include the repositories for this architecture. 81local repositoriesDirectory 82 = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 83local repositories = HaikuPorts ; 84if $(HAIKU_BUILD_TYPE) = bootstrap { 85 repositories = HaikuPortsCross ; 86} 87 88local repository ; 89for repository in $(repositories) { 90 local repositoryDirectory 91 = [ FDirName $(repositoriesDirectory) $(repository) ] ; 92 local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 93 if $(file) { 94 HAIKU_REPOSITORY_JAMFILE = $(file) ; 95 include $(file) ; 96 } 97} 98 99# Declare no-op user-overridable build rules. 100rule UserBuildConfigRulePostBuildTargets { } 101rule UserBuildConfigRulePreImage { } 102rule UserBuildConfigRulePostImage { } 103 104# Include UserBuildConfig. 105if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 106 local userBuildConfig 107 = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 108 if $(userBuildConfig) { 109 include $(userBuildConfig) ; 110 } 111 112 # allow for a separate UserBuildConfig per output directory 113 local userBuildConfig 114 = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 115 if $(userBuildConfig) { 116 include $(userBuildConfig) ; 117 } 118} 119 120DefineDefaultBuildProfiles ; 121 122PrepareConfigVariables ; 123