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