xref: /haiku/Jamrules (revision 37aefc9c6f6dc3456d74dbccc3a606e30192baf4)
1338b8dc3SIngo Weinhold# Haiku Jamrules
2979afc6fSAxel Dörfler
3338b8dc3SIngo Weinhold# Main directories used by the build.
4338b8dc3SIngo WeinholdHAIKU_OUTPUT_DIR					?= [ FDirName $(HAIKU_TOP) generated ] ;
5338b8dc3SIngo WeinholdHAIKU_BUILD_OUTPUT_DIR				= [ FDirName $(HAIKU_OUTPUT_DIR) build ] ;
6338b8dc3SIngo WeinholdHAIKU_BUILD_DIR						= [ FDirName $(HAIKU_TOP) build ] ;
7338b8dc3SIngo WeinholdHAIKU_BUILD_RULES_DIR				= [ FDirName $(HAIKU_BUILD_DIR) jam ] ;
8338b8dc3SIngo WeinholdHAIKU_OBJECT_DIR					= [ FDirName $(HAIKU_OUTPUT_DIR) objects ] ;
9338b8dc3SIngo WeinholdHAIKU_COMMON_PLATFORM_OBJECT_DIR	= [ FDirName $(HAIKU_OBJECT_DIR) common ] ;
1096b421b8SIngo WeinholdHAIKU_DOWNLOAD_DIR					= [ FDirName $(HAIKU_OUTPUT_DIR) download ] ;
114ff6d49fSIngo Weinhold
124ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching
134ff6d49fSIngo WeinholdHCACHEFILE = header_cache ;
144ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ;
15338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ;
169eea4522SIngo Weinhold
17889903f9SIngo Weinhold# include BuildConfig
18889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
19889903f9SIngo Weinholdif ! $(buildConfig) {
20889903f9SIngo Weinhold	ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
21889903f9SIngo Weinhold	EXIT "Run ./configure in the source tree's root directory first!" ;
22889903f9SIngo Weinhold}
23889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
24889903f9SIngo Weinholdinclude BuildConfig ;
25889903f9SIngo Weinhold
26338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include
27338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most
28338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules).
29338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The
30338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter.
31338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ;
3225b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ;
33338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ;
34*37aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ;
35338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
36338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
37338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
38338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FreetypeRules ] ;
39338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
40338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
41338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
42e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
43338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
44338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
45338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
46338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
47338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
48338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
49b1e5b60cSAxel Dörfler
5030ed37c8SIngo Weinhold# Declare no-op user-overridable build rules.
5130ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets	{ }
5230ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage			{ }
5330ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage			{ }
5430ed37c8SIngo Weinhold
55338b8dc3SIngo Weinhold# Include UserBuildConfig.
568c17a26bSIngo Weinhold{
57338b8dc3SIngo Weinhold	local userBuildConfig
58338b8dc3SIngo Weinhold		= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
59338b8dc3SIngo Weinhold	if $(userBuildConfig) {
60338b8dc3SIngo Weinhold		include $(userBuildConfig) ;
618c17a26bSIngo Weinhold	}
62d5ec51caSMichael Lotz
63d5ec51caSMichael Lotz	# allow for a separate UserBuildConfig per output directory
64d5ec51caSMichael Lotz	local userBuildConfig
65d5ec51caSMichael Lotz		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
66d5ec51caSMichael Lotz	if $(userBuildConfig) {
67d5ec51caSMichael Lotz		include $(userBuildConfig) ;
68d5ec51caSMichael Lotz	}
698c17a26bSIngo Weinhold}
708c17a26bSIngo Weinhold
71a679600dSAxel Dörflerinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ;
72a679600dSAxel Dörfler
73a0a9d225SIngo Weinhold# If a build profile was specified on the command line, now is the time to
74a0a9d225SIngo Weinhold# check whether it is unknown or one of the default profiles.
75a0a9d225SIngo Weinholdif $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
76a0a9d225SIngo Weinhold	# define the obvious default profiles
77a0a9d225SIngo Weinhold	if $(HAIKU_BUILD_PROFILE) in image vmware-image install {
78a0a9d225SIngo Weinhold		DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ;
79a0a9d225SIngo Weinhold	} else {
80a0a9d225SIngo Weinhold		Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ;
81a0a9d225SIngo Weinhold	}
82a0a9d225SIngo Weinhold}
83a0a9d225SIngo Weinhold
84338b8dc3SIngo WeinholdPrepareConfigVariables ;
85