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