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