xref: /haiku/Jamrules (revision 481f986b59e7782458dcc5fe98ad59a57480e5db)
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) objects ] ;
9HAIKU_COMMON_PLATFORM_OBJECT_DIR	= [ FDirName $(HAIKU_OBJECT_DIR) common ] ;
10HAIKU_DOWNLOAD_DIR					= [ FDirName $(HAIKU_OUTPUT_DIR)
11											download ] ;
12HAIKU_OPTIONAL_BUILD_PACKAGES_DIR	= [ FDirName $(HAIKU_OUTPUT_DIR)
13											build_packages ] ;
14
15# Cache files for header scanning and jamfile caching
16HCACHEFILE = header_cache ;
17JCACHEFILE = jamfile_cache ;
18LOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ;
19
20# include BuildConfig
21local buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
22if ! $(buildConfig) {
23	ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
24	EXIT "Run ./configure in the source tree's root directory first!" ;
25}
26LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
27include BuildConfig ;
28
29# The build setup and rules are neatly organized in several files. Include
30# them now. Start with the side-effect-less rules, since they are the most
31# likely to be used in the top level context (i.e. not only in rules).
32# At the end include BuildSetup that sets up global variables etc. The
33# optional user-defined UserBuildConfig is included thereafter.
34include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ;
35include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ;
36include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ;
37include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ;
38include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ;
39include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
40include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
41include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
42include [ FDirName $(HAIKU_BUILD_RULES_DIR) FreetypeRules ] ;
43include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
44include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
45include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
46include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
47include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
48include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
49include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
50include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
51include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
52include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
53
54# Declare no-op user-overridable build rules.
55rule UserBuildConfigRulePostBuildTargets	{ }
56rule UserBuildConfigRulePreImage			{ }
57rule UserBuildConfigRulePostImage			{ }
58
59# Include UserBuildConfig.
60if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
61	local userBuildConfig
62		= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
63	if $(userBuildConfig) {
64		include $(userBuildConfig) ;
65	}
66
67	# allow for a separate UserBuildConfig per output directory
68	local userBuildConfig
69		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
70	if $(userBuildConfig) {
71		include $(userBuildConfig) ;
72	}
73}
74
75include [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ;
76
77# If a build profile was specified on the command line, now is the time to
78# check whether it is unknown or one of the default profiles.
79if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
80	# define the obvious default profiles
81	if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install
82			vmware-image {
83		DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ;
84	} else {
85		Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ;
86	}
87}
88
89# Include embedded board-specific file.
90# UserBuildConfig can override HAIKU_BOOT_BOARD.
91if $(HAIKU_BOOT_BOARD) {
92	include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD)
93		BoardSetup ] ;
94}
95
96PrepareConfigVariables ;
97