xref: /haiku/Jamrules (revision aa29a30426c9ab7511c7c88e7223645264209a4c)
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# The build setup and rules are neatly organized in several files. Include
33# them now. Start with the side-effect-less rules, since they are the most
34# likely to be used in the top level context (i.e. not only in rules).
35# At the end include BuildSetup that sets up global variables etc. The
36# optional user-defined UserBuildConfig is included thereafter.
37include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ;
38include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ;
39include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ;
40include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ;
41include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ;
42include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
43include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
44include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
45include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
46include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
47include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
48include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
49include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
50include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
51include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
52include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
53include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
54include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
55
56# Declare no-op user-overridable build rules.
57rule UserBuildConfigRulePostBuildTargets	{ }
58rule UserBuildConfigRulePreImage			{ }
59rule UserBuildConfigRulePostImage			{ }
60
61# Include UserBuildConfig.
62if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
63	local userBuildConfig
64		= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
65	if $(userBuildConfig) {
66		include $(userBuildConfig) ;
67	}
68
69	# allow for a separate UserBuildConfig per output directory
70	local userBuildConfig
71		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
72	if $(userBuildConfig) {
73		include $(userBuildConfig) ;
74	}
75}
76
77include [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ;
78
79# If a build profile was specified on the command line, now is the time to
80# check whether it is unknown or one of the default profiles.
81if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
82	# define the obvious default profiles
83	if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install
84			vmware-image {
85		DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ;
86	} else {
87		Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ;
88	}
89}
90
91# Include embedded board-specific file.
92# UserBuildConfig can override HAIKU_BOOT_BOARD.
93if $(HAIKU_BOOT_BOARD) {
94	include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD)
95		BoardSetup ] ;
96}
97
98PrepareConfigVariables ;
99