1# Haiku Jamrules 2 3# Main directories used by the build. 4HAIKU_OUTPUT_DIR ?= [ FDirName $(HAIKU_TOP) generated ] ; 5HAIKU_BUILD_OUTPUT_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) build ] ; 6HAIKU_BUILD_DIR = [ FDirName $(HAIKU_TOP) build ] ; 7HAIKU_BUILD_RULES_DIR = [ FDirName $(HAIKU_BUILD_DIR) jam ] ; 8HAIKU_OBJECT_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) 9 objects ] ; 10HAIKU_CATALOGS_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_DIR) 11 catalogs ] ; 12HAIKU_COMMON_PLATFORM_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_DIR) common ] ; 13HAIKU_DOWNLOAD_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) 14 download ] ; 15HAIKU_OPTIONAL_BUILD_PACKAGES_DIR = [ FDirName $(HAIKU_OUTPUT_DIR) 16 build_packages ] ; 17 18# Cache files for header scanning and jamfile caching 19HCACHEFILE = header_cache ; 20JCACHEFILE = jamfile_cache ; 21LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ; 22 23# include BuildConfig 24local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ; 25if ! $(buildConfig) { 26 ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ; 27 EXIT "Run ./configure in the source tree's root directory first!" ; 28} 29LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; 30include BuildConfig ; 31 32# Set simplified variables for primary architecture. 33HAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; 34local variable ; 35for variable in 36 HAIKU_GCC_RAW_VERSION 37 HAIKU_GCC_MACHINE 38 HAIKU_GCC_LIB_DIR 39 HAIKU_GCC_HEADERS_DIR 40 HAIKU_GCC_LIBGCC 41 HAIKU_GCC_LIBGCC_OBJECTS 42 HAIKU_CPU 43 HAIKU_STATIC_LIBSTDC++ 44 HAIKU_SHARED_LIBSTDC++ 45 HAIKU_STATIC_LIBSUPC++ 46 HAIKU_SHARED_LIBSUPC++ 47 HAIKU_C++_HEADERS_DIR 48 HAIKU_KERNEL_LIBGCC 49 HAIKU_KERNEL_LIBSUPC++ 50 HAIKU_BOOT_LIBGCC 51 HAIKU_BOOT_LIBSUPC++ 52 HAIKU_AR 53 HAIKU_CC 54 HAIKU_LD 55 HAIKU_OBJCOPY 56 HAIKU_RANLIB 57 HAIKU_ELFEDIT 58 HAIKU_STRIP 59 HAIKU_CPPFLAGS 60 HAIKU_CCFLAGS 61 HAIKU_C++FLAGS 62 HAIKU_LDFLAGS 63 HAIKU_ARFLAGS 64 HAIKU_UNARFLAGS 65 HAIKU_USE_GCC_GRAPHITE { 66 $(variable) = $($(variable)_$(HAIKU_PACKAGING_ARCH)) ; 67} 68 69# The build setup and rules are neatly organized in several files. Include 70# them now. Start with the side-effect-less rules, since they are the most 71# likely to be used in the top level context (i.e. not only in rules). 72# At the end include BuildSetup that sets up global variables etc. The 73# optional user-defined UserBuildConfig is included thereafter. 74include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; 75include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; 76include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; 77include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; 78include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; 79include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; 80include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ; 81include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; 82include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ; 83include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ; 84include [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ; 85include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ; 86include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ; 87include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; 88include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; 89include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; 90include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; 91include [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; 92include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; 93include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; 94include [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; 95 96# Include the repositories for this architecture. 97local repositoriesDirectory 98 = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; 99local repositories = HaikuPorts ; 100if $(HAIKU_BOOTSTRAP_BUILD) { 101 repositories = HaikuPortsCross ; 102} 103 104local repository ; 105for repository in $(repositories) { 106 local repositoryDirectory 107 = [ FDirName $(repositoriesDirectory) $(repository) ] ; 108 local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; 109 if $(file) { 110 HAIKU_REPOSITORY_JAMFILE = $(file) ; 111 include $(file) ; 112 } 113} 114 115# Declare no-op user-overridable build rules. 116rule UserBuildConfigRulePostBuildTargets { } 117rule UserBuildConfigRulePreImage { } 118rule UserBuildConfigRulePostImage { } 119 120# Include UserBuildConfig. 121if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { 122 local userBuildConfig 123 = [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ; 124 if $(userBuildConfig) { 125 include $(userBuildConfig) ; 126 } 127 128 # allow for a separate UserBuildConfig per output directory 129 local userBuildConfig 130 = [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ; 131 if $(userBuildConfig) { 132 include $(userBuildConfig) ; 133 } 134} 135 136DefineDefaultBuildProfiles ; 137 138PrepareConfigVariables ; 139