xref: /haiku/Jamrules (revision c0e8cc1a1368c6cc99ddf1c76f8826cd5a598fd2)
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 ] ;
8413a591cSMatt MadiaHAIKU_OBJECT_DIR					= [ FDirName $(HAIKU_OUTPUT_DIR)
9413a591cSMatt Madia											objects ] ;
100a53d94bSMatt MadiaHAIKU_CATALOGS_OBJECT_DIR			= [ FDirName $(HAIKU_OBJECT_DIR)
110a53d94bSMatt Madia											catalogs ] ;
12338b8dc3SIngo WeinholdHAIKU_COMMON_PLATFORM_OBJECT_DIR	= [ FDirName $(HAIKU_OBJECT_DIR) common ] ;
131467a878SAxel DörflerHAIKU_DOWNLOAD_DIR					= [ FDirName $(HAIKU_OUTPUT_DIR)
141467a878SAxel Dörfler											download ] ;
15ff81d306SIngo WeinholdHAIKU_OPTIONAL_BUILD_PACKAGES_DIR	= [ FDirName $(HAIKU_OUTPUT_DIR)
16ff81d306SIngo Weinhold											build_packages ] ;
174ff6d49fSIngo Weinhold
184ff6d49fSIngo Weinhold# Cache files for header scanning and jamfile caching
194ff6d49fSIngo WeinholdHCACHEFILE = header_cache ;
204ff6d49fSIngo WeinholdJCACHEFILE = jamfile_cache ;
21338b8dc3SIngo WeinholdLOCATE on $(HCACHEFILE) $(JCACHEFILE) = $(HAIKU_BUILD_OUTPUT_DIR) ;
229eea4522SIngo Weinhold
23889903f9SIngo Weinhold# include BuildConfig
24889903f9SIngo Weinholdlocal buildConfig = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : BuildConfig ] ;
25889903f9SIngo Weinholdif ! $(buildConfig) {
26889903f9SIngo Weinhold	ECHO "No `BuildConfig' found in $(HAIKU_BUILD_OUTPUT_DIR)!" ;
27889903f9SIngo Weinhold	EXIT "Run ./configure in the source tree's root directory first!" ;
28889903f9SIngo Weinhold}
29889903f9SIngo WeinholdLOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ;
30889903f9SIngo Weinholdinclude BuildConfig ;
31889903f9SIngo Weinhold
32*c0e8cc1aSIngo Weinhold# Set simplified variables for primary architecture.
33*c0e8cc1aSIngo WeinholdHAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ;
34*c0e8cc1aSIngo Weinholdlocal variable ;
35*c0e8cc1aSIngo Weinholdfor variable in
36*c0e8cc1aSIngo Weinhold	HAIKU_GCC_RAW_VERSION
37*c0e8cc1aSIngo Weinhold	HAIKU_GCC_MACHINE
38*c0e8cc1aSIngo Weinhold	HAIKU_GCC_LIB_DIR
39*c0e8cc1aSIngo Weinhold	HAIKU_GCC_HEADERS_DIR
40*c0e8cc1aSIngo Weinhold	HAIKU_GCC_LIBGCC
41*c0e8cc1aSIngo Weinhold	HAIKU_GCC_LIBGCC_OBJECTS
42*c0e8cc1aSIngo Weinhold	HAIKU_CPU
43*c0e8cc1aSIngo Weinhold	HAIKU_STATIC_LIBSTDC++
44*c0e8cc1aSIngo Weinhold	HAIKU_SHARED_LIBSTDC++
45*c0e8cc1aSIngo Weinhold	HAIKU_STATIC_LIBSUPC++
46*c0e8cc1aSIngo Weinhold	HAIKU_SHARED_LIBSUPC++
47*c0e8cc1aSIngo Weinhold	HAIKU_C++_HEADERS_DIR
48*c0e8cc1aSIngo Weinhold	HAIKU_KERNEL_LIBGCC
49*c0e8cc1aSIngo Weinhold	HAIKU_KERNEL_LIBSUPC++
50*c0e8cc1aSIngo Weinhold	HAIKU_BOOT_LIBGCC
51*c0e8cc1aSIngo Weinhold	HAIKU_BOOT_LIBSUPC++
52*c0e8cc1aSIngo Weinhold	HAIKU_AR
53*c0e8cc1aSIngo Weinhold	HAIKU_CC
54*c0e8cc1aSIngo Weinhold	HAIKU_LD
55*c0e8cc1aSIngo Weinhold	HAIKU_OBJCOPY
56*c0e8cc1aSIngo Weinhold	HAIKU_RANLIB
57*c0e8cc1aSIngo Weinhold	HAIKU_ELFEDIT
58*c0e8cc1aSIngo Weinhold	HAIKU_STRIP
59*c0e8cc1aSIngo Weinhold	HAIKU_CPPFLAGS
60*c0e8cc1aSIngo Weinhold	HAIKU_CCFLAGS
61*c0e8cc1aSIngo Weinhold	HAIKU_C++FLAGS
62*c0e8cc1aSIngo Weinhold	HAIKU_LDFLAGS
63*c0e8cc1aSIngo Weinhold	HAIKU_ARFLAGS
64*c0e8cc1aSIngo Weinhold	HAIKU_UNARFLAGS
65*c0e8cc1aSIngo Weinhold	HAIKU_USE_GCC_GRAPHITE {
66*c0e8cc1aSIngo Weinhold	$(variable) = $($(variable)_$(HAIKU_PACKAGING_ARCH)) ;
67*c0e8cc1aSIngo Weinhold}
68*c0e8cc1aSIngo Weinhold
69338b8dc3SIngo Weinhold# The build setup and rules are neatly organized in several files. Include
70338b8dc3SIngo Weinhold# them now. Start with the side-effect-less rules, since they are the most
71338b8dc3SIngo Weinhold# likely to be used in the top level context (i.e. not only in rules).
72338b8dc3SIngo Weinhold# At the end include BuildSetup that sets up global variables etc. The
73338b8dc3SIngo Weinhold# optional user-defined UserBuildConfig is included thereafter.
74338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ;
7525b12e83SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ;
76338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ;
77b891b0acSOliver Tappeinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ;
7837aefc9cSIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ;
79338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ;
80338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ;
81338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ;
82338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
83338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
8465ad1ba3SAlex Smithinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BootRules ] ;
85338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
86e2c3dec9SMichael Lotzinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
87338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
88338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
89338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
90338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
9198c6dfa4SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ;
92338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
93338b8dc3SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
94b9eec519SIngo Weinholdinclude [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ;
95b1e5b60cSAxel Dörfler
9698c6dfa4SIngo Weinhold# Include the repositories for this architecture.
9798c6dfa4SIngo Weinholdlocal repositoriesDirectory
9898c6dfa4SIngo Weinhold	= [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ;
99e173a1ecSIngo Weinholdlocal repositories = HaikuPorts ;
100e173a1ecSIngo Weinholdif $(HAIKU_BOOTSTRAP_BUILD) {
101e173a1ecSIngo Weinhold	repositories = HaikuPortsCross ;
102e173a1ecSIngo Weinhold}
103e173a1ecSIngo Weinhold
10498c6dfa4SIngo Weinholdlocal repository ;
105e173a1ecSIngo Weinholdfor repository in $(repositories) {
10698c6dfa4SIngo Weinhold	local repositoryDirectory
10798c6dfa4SIngo Weinhold		= [ FDirName $(repositoriesDirectory) $(repository) ] ;
10898c6dfa4SIngo Weinhold	local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ;
10998c6dfa4SIngo Weinhold	if $(file) {
110d72ce066SIngo Weinhold		HAIKU_REPOSITORY_JAMFILE = $(file) ;
11198c6dfa4SIngo Weinhold		include $(file) ;
11298c6dfa4SIngo Weinhold	}
11398c6dfa4SIngo Weinhold}
11498c6dfa4SIngo Weinhold
11530ed37c8SIngo Weinhold# Declare no-op user-overridable build rules.
11630ed37c8SIngo Weinholdrule UserBuildConfigRulePostBuildTargets	{ }
11730ed37c8SIngo Weinholdrule UserBuildConfigRulePreImage			{ }
11830ed37c8SIngo Weinholdrule UserBuildConfigRulePostImage			{ }
11930ed37c8SIngo Weinhold
120338b8dc3SIngo Weinhold# Include UserBuildConfig.
121a4a52ab2SIngo Weinholdif ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
122338b8dc3SIngo Weinhold	local userBuildConfig
123338b8dc3SIngo Weinhold		= [ GLOB $(HAIKU_BUILD_RULES_DIR) : UserBuildConfig ] ;
124338b8dc3SIngo Weinhold	if $(userBuildConfig) {
125338b8dc3SIngo Weinhold		include $(userBuildConfig) ;
1268c17a26bSIngo Weinhold	}
127d5ec51caSMichael Lotz
128d5ec51caSMichael Lotz	# allow for a separate UserBuildConfig per output directory
129d5ec51caSMichael Lotz	local userBuildConfig
130d5ec51caSMichael Lotz		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
131d5ec51caSMichael Lotz	if $(userBuildConfig) {
132d5ec51caSMichael Lotz		include $(userBuildConfig) ;
133d5ec51caSMichael Lotz	}
1348c17a26bSIngo Weinhold}
1358c17a26bSIngo Weinhold
136b9eec519SIngo WeinholdDefineDefaultBuildProfiles ;
137a0a9d225SIngo Weinhold
138338b8dc3SIngo WeinholdPrepareConfigVariables ;
139