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