xref: /haiku/Jamrules (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
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) CommandLineArguments ] ;
38include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
39include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
40include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
41include [ FDirName $(HAIKU_BUILD_RULES_DIR) FreetypeRules ] ;
42include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
43include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
44include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
45include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
46include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
47include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
48include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
49include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
50include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
51include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
52
53# Declare no-op user-overridable build rules.
54rule UserBuildConfigRulePostBuildTargets	{ }
55rule UserBuildConfigRulePreImage			{ }
56rule UserBuildConfigRulePostImage			{ }
57
58# Include UserBuildConfig.
59if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
60	local userBuildConfig
61		= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
62	if $(userBuildConfig) {
63		include $(userBuildConfig) ;
64	}
65
66	# allow for a separate UserBuildConfig per output directory
67	local userBuildConfig
68		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
69	if $(userBuildConfig) {
70		include $(userBuildConfig) ;
71	}
72}
73
74include [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ;
75
76# If a build profile was specified on the command line, now is the time to
77# check whether it is unknown or one of the default profiles.
78if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
79	# define the obvious default profiles
80	if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install
81			vmware-image {
82		DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ;
83	} else {
84		Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ;
85	}
86}
87
88# Include embedded board-specific file.
89# UserBuildConfig can override HAIKU_BOOT_BOARD.
90if $(HAIKU_BOOT_BOARD) {
91	include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD)
92		BoardSetup ] ;
93}
94
95PrepareConfigVariables ;
96