xref: /haiku/build/jam/BuildSetup (revision 56430ad8002b8fd1ac69b590e9cc130de6d9e852)
1# Variable naming conventions:
2# TARGET_*:	A build system variable specifying a property for building for
3#			the target platform (usually Haiku). E.g. TARGET_CC specifies the
4#			compiler when building a target for the target platform.
5# HOST_*:	A build system variable specifying a property of the platform
6#			hosting the build. E.g. HOST_CC specifies the compiler when
7#			building a target for the host platform (a build tool for
8#			instance).
9# HAIKU_*:	A build system variable specifying a build system property. Usually
10#			directory paths and the like.
11
12
13# The Haiku (base) version. For development builds the revision will be
14# attached.
15HAIKU_VERSION = r1~alpha4_pm ;
16
17
18#pragma mark - container settings
19
20# Haiku image
21HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ;
22HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ;
23HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
24	= HAIKU_INCLUDE_IN_IMAGE ;
25HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
26	= HAIKU_IMAGE_INSTALL_TARGETS ;
27HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_IMAGE_CONTAINER_NAME)
28	= system non-packaged ;
29
30# network boot archive
31HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ;
32HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
33	= NetBootArchive ;
34# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
35HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
36	= HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ;
37HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
38	= system ;
39
40# boot floppy
41HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ;
42HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
43	= FloppyBootImage ;
44# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
45HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
46	= HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ;
47HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
48	= system ;
49
50# boot CD image
51HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ;
52HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ;
53# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
54HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
55	= HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ;
56HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
57	= system ;
58
59# boot CD for PPC image
60HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME = haiku-boot-cd-ppc-container ;
61HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME)
62	= CDBootPPCImage ;
63# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
64HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME)
65	= HAIKU_CD_BOOT_PPC_IMAGE_INSTALL_TARGETS ;
66HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME)
67	= system ;
68
69# Haiku image/install defaults
70HAIKU_DEFAULT_IMAGE_NAME = haiku.image ;
71HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ;
72HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ;
73HAIKU_DEFAULT_INSTALL_DIR = /Haiku ;
74HAIKU_DEFAULT_IMAGE_SIZE ?= 300 ; # 300 MB
75HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ;
76
77# Haiku CD defaults
78HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ;
79HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ;
80HAIKU_DEFAULT_CD_LABEL = Haiku ;
81
82# Haiku Anyboot defaults
83HAIKU_DEFAULT_ANYBOOT_NAME = haiku-anyboot.image ;
84HAIKU_DEFAULT_ANYBOOT_DIR = $(HAIKU_OUTPUT_DIR) ;
85HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ;
86
87# Haiku MMC defaults
88HAIKU_DEFAULT_MMC_IMAGE_NAME = haiku-mmc.image ;
89HAIKU_DEFAULT_MMC_DIR = $(HAIKU_OUTPUT_DIR) ;
90HAIKU_DEFAULT_MMC_LABEL ?= Haiku ;
91
92# analyze and optionally replace jam's target parameters
93ProcessCommandLineArguments ;
94
95
96# supported debug levels
97HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
98
99# BeOS, BONE, Dan0 compatible platforms
100HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ;
101HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ;
102HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ;
103HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ;
104
105# configuration header directories
106HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ]
107	[ FDirName $(HAIKU_TOP) build config_headers ] ;
108
109
110# object directories common to all architectures
111HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
112HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
113
114
115#pragma mark - haiku target platform settings
116
117
118local architecture ;
119for architecture in $(HAIKU_PACKAGING_ARCHS) {
120	ArchitectureSetup $(architecture) ;
121}
122
123# TODO: Might not be needed anymore.
124if $(HAIKU_HOST_BUILD_ONLY) = 1 {
125	HAIKU_GCC_VERSION = 0 0 0 ;
126}
127
128if $(HAIKU_PACKAGING_ARCH) {
129	KernelArchitectureSetup $(HAIKU_PACKAGING_ARCH) ;
130}
131
132# define primary packaging architecture macro
133HAIKU_DEFINES = __HAIKU_PRIMARY_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
134
135
136# distro compatibility level defines
137HAIKU_DISTRO_COMPATIBILITY ?= "default" ;
138switch $(HAIKU_DISTRO_COMPATIBILITY) {
139	case official :
140		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ;
141		HAIKU_INCLUDE_TRADEMARKS = "" ;
142	case compatible :
143		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ;
144		HAIKU_INCLUDE_TRADEMARKS = "" ;
145	case "default" :
146		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ;
147		HAIKU_INCLUDE_TRADEMARKS = ;
148	case * :
149		Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:"
150			$(HAIKU_DISTRO_COMPATIBILITY) ;
151}
152
153# If the environment variable HAIKU_INCLUDE_PATENTED_CODE is defined, we define
154# an equally named macro to the variable value. Some components use the macro
155# to allow compilation of code known to implemented patented ideas and/or
156# techniques, for example the Freetype bytecode hinter or sub-pixel rendering as
157# well as some problematic media codecs.
158if $(HAIKU_INCLUDE_PATENTED_CODE) {
159	HAIKU_DEFINES
160		+= HAIKU_INCLUDE_PATENTED_CODE=$(HAIKU_INCLUDE_PATENTED_CODE) ;
161}
162
163HAIKU_ATA_STACK ?= 1 ;
164
165# network libraries
166HAIKU_NETWORK_LIBS = network ;
167HAIKU_NETAPI_LIB = bnetapi ;
168HAIKU_SELECT_UNAME_ETC_LIB = ;	# libroot, against which we link anyway
169
170
171HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
172
173# TODO: The version stuff should probably go into a separate file and be made
174# available as macro, too.
175# Set our version number if not already set and mark it as a developer build
176if ! $(HAIKU_BUILD_VERSION) {
177	HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ;
178	HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ;
179}
180
181# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as
182# an unknown build.
183HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
184
185
186#pragma mark - host platform settings
187
188
189# determine the endianness of the host
190switch $(HOST_GCC_MACHINE) {
191	case amd64-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
192	case i?86-*		: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
193	case powerpc-*	: HAIKU_HOST_IS_BIG_ENDIAN = 1 ;
194	case x86_64-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
195
196	# the following are rather unlikely as hosts ...
197	case arm-*		: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
198	case armv7l-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
199	case armv7hl-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
200	case armv7b-*	: HAIKU_HOST_IS_BIG_ENDIAN = 1 ;
201	case m68k-*		: HAIKU_HOST_IS_BIG_ENDIAN = 1 ;
202	case *			: Exit "Unsupported gcc host machine:" $(HOST_GCC_MACHINE) ;
203}
204
205# analyze the host gcc machine spec to find out about 64-bitness
206HOST_PLATFORM_IS_64_BIT = ;
207switch $(HOST_GCC_MACHINE) {
208	case amd64-* :				HOST_PLATFORM_IS_64_BIT = 1 ;
209	case i686-apple-darwin10 :	HOST_PLATFORM_IS_64_BIT = 1 ;
210	case i686-apple-darwin11 :	HOST_PLATFORM_IS_64_BIT = 1 ;
211	case x86_64-* :				HOST_PLATFORM_IS_64_BIT = 1 ;
212}
213
214# If HAIKU_HOST_USE_32BIT is set, add the required gcc base flag (the LD flag
215# is set later), or, if the architecture isn't actually 64 bit, clear
216# HAIKU_HOST_USE_32BIT.
217# Afterwards HOST_PLATFORM_IS_64_BIT will indicate whether the architecture is
218# effectively (i.e. when using the compiler/linker flags) 64 bit and
219# HAIKU_HOST_USE_32BIT will be set, iff the architecture is really 64 bit and
220# 32 bit mode was requested.
221if $(HAIKU_HOST_USE_32BIT) = 1 {
222	if $(HOST_PLATFORM_IS_64_BIT) {
223		# enable GCC -m32 option
224		HOST_GCC_BASE_FLAGS = -m32 ;
225		HOST_PLATFORM_IS_64_BIT = ;
226	} else {
227		HAIKU_HOST_USE_32BIT = 0 ;
228	}
229}
230
231
232# save jam's variables for the build platform
233HOST_AR				?= $(AR) ;
234HOST_CC				?= $(CC) ;
235HOST_C++			?= $(C++) ;
236HOST_LINK			?= $(LINK) ;
237HOST_RANLIB			?= $(RANLIB) ;
238HOST_CPPFLAGS		?= $(CPPFLAGS) ;
239HOST_CCFLAGS		?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ;
240HOST_C++FLAGS		?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ;
241HOST_LDFLAGS		?= $(LDFLAGS) ;
242HOST_LINKFLAGS		?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ;
243HOST_DEFINES		?= $(DEFINES) ;
244HOST_HDRS			?= $(HDRS) ;
245
246
247# split up HOST_AR into the command name and flags
248HOST_AR				= [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ]
249					  $(HOST_AR[2-]) ;
250HOST_ARFLAGS		= $(HOST_AR[2-]) ;
251HOST_AR				= $(HOST_AR[1]) ;
252HOST_UNARFLAGS		?= x ;
253
254# check the host platform compatibility
255SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
256	: linux openbsd freebsd darwin sunos cygwin ;
257HOST_PLATFORM_(host)_COMPATIBLE = 1 ;
258
259if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
260	|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin
261	|| $(HOST_PLATFORM) = sunos || $(HOST_PLATFORM) = openbsd {
262	# don't use lex: otherwise rc will not work correctly
263	if $(LEX) = lex {
264		LEX = flex ;
265	}
266}
267
268if $(HOST_PLATFORM) = cygwin {
269	HOST_LINKFLAGS += -Xlinker --allow-multiple-definition -Xlinker
270		--enable-auto-import ;
271}
272
273HOST_CPU ?= $(OSPLAT:L) ;
274
275# Jam doesn't know x86_64, so override HOST_CPU, if 64 bit.
276if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) {
277	HOST_CPU = x86_64 ;
278}
279
280HOST_ARCH ?= $(HOST_CPU) ;
281HOST_ARCHS = $(HOST_ARCH) ;
282HOST_KERNEL_ARCH = host ;
283
284# analyze GCC version
285HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ;
286
287# set packaging architecture
288HOST_PACKAGING_ARCH		?= $(HOST_CPU) ;
289if $(HOST_PACKAGING_ARCH) = x86 && $(HOST_GCC_VERSION[1]) = 2 {
290	HOST_PACKAGING_ARCH = x86_gcc2 ;
291}
292HOST_PACKAGING_ARCHS = $(HOST_PACKAGING_ARCH) ;
293
294# directories
295HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ;
296HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ;
297HOST_ARCH_OBJECT_DIR
298	= [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_PACKAGING_ARCH) ] ;
299HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ;
300HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ;
301
302local level ;
303for level in $(HAIKU_DEBUG_LEVELS[2-]) {
304	HOST_DEBUG_$(level)_OBJECT_DIR
305		= [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ;
306}
307
308# set variables for gcc header options
309SetIncludePropertiesVariables HOST ;
310
311# assembler flags
312HOST_ASFLAGS = ;
313
314# C/C++ flags
315HOST_CCFLAGS += -Wno-multichar ;
316HOST_C++FLAGS += -Wno-multichar ;
317
318if $(HOST_PLATFORM) != cygwin {
319	HOST_PIC_CCFLAGS += -fPIC ;
320	HOST_PIC_C++FLAGS += -fPIC ;
321}
322
323if $(HOST_GCC_VERSION[1]) >= 3 {
324	HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ;
325}
326
327HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
328	-D_KERNEL_MODE ;
329HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
330	-fno-exceptions -D_KERNEL_MODE ;
331HOST_KERNEL_DEFINES += _KERNEL_MODE ;
332
333HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
334HOST_KERNEL_PIC_LINKFLAGS = ;
335if $(HOST_ARCH) = ppc {
336	# Build a position independent PPC kernel. We need to be able to relocate
337	# the kernel, since the virtual address space layout at boot time is not
338	# fixed.
339	HOST_KERNEL_PIC_CCFLAGS = -fPIE ;
340	HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
341}
342if $(HOST_ARCH) = m68k {
343	# Build a position independent M68K kernel. We need to be able to relocate
344	# the kernel, since the virtual address space layout at boot time is not
345	# fixed.
346	HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ;
347	HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ;
348}
349
350if $(HOST_PLATFORM) != darwin {
351	# fix for new changes to DSO linking policies
352	HOST_LINKFLAGS += -Xlinker --no-as-needed ;
353}
354
355
356# warning flags
357HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith
358	-Wcast-align -Wsign-compare ;
359HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
360	-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
361
362HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ;
363HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ;
364
365HOST_WERROR_FLAGS = ;
366
367# debug flags
368local hostDebugFlags ;
369switch $(HOST_PLATFORM) {
370	case haiku		: hostDebugFlags ?= -ggdb ;
371	case haiku_host	: hostDebugFlags ?= -ggdb ;
372	case linux		: hostDebugFlags ?= -ggdb ;
373	case freebsd	: hostDebugFlags ?= -ggdb ;
374	case darwin		: hostDebugFlags ?= -ggdb ;
375	case *			: hostDebugFlags ?= -g ;
376}
377
378# debug 0: suppress asserts
379HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
380HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
381
382HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
383HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
384
385local level ;
386for level in $(HAIKU_DEBUG_LEVELS[2-]) {
387	local flags = $(hostDebugFlags) [ FDefines DEBUG=$(level) ] ;
388	HOST_DEBUG_$(level)_CCFLAGS			= $(flags) ;
389	HOST_DEBUG_$(level)_C++FLAGS		= $(flags) ;
390	HOST_KERNEL_DEBUG_$(level)_CCFLAGS	= $(flags) ;
391	HOST_KERNEL_DEBUG_$(level)_C++FLAGS	= $(flags) ;
392}
393
394# ld flags
395if $(HAIKU_HOST_USE_32BIT) = 1 {
396	HOST_LDFLAGS += -melf_i386 ;
397}
398
399# private kernel headers do be used when compiling kernel code
400HOST_PRIVATE_KERNEL_HEADERS = ;
401
402# private shared kernel/libroot headers
403HOST_PRIVATE_SYSTEM_HEADERS = ;
404
405# under BeOS use copyattr instead of cp
406if $(HOST_PLATFORM_BEOS_COMPATIBLE)
407{
408	CP = copyattr --data ;
409}
410
411HOST_DEFINES += ARCH_$(HOST_CPU) ;
412HOST_DEFINES += _NO_INLINE_ASM ;
413
414# for builds of tools in the current environment
415HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
416
417# For the generic attributes emulation: Target rm_attrs -- rm replacement that
418# also removes the attributes.
419HOST_RM_ATTRS_TARGET = ;
420
421if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
422	# the C++ standard and support libraries
423	if $(HOST_GCC_VERSION[1]) < 3 {
424		HOST_LIBSTDC++ = stdc++.r4 ;
425		HOST_LIBSUPC++ = ;
426	} else {
427		HOST_LIBSTDC++ = stdc++ ;
428		HOST_LIBSUPC++ = supc++ ;
429	}
430
431	HOST_LIBROOT = root ;
432	HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ;
433	HOST_LIBBE = libbe_build.so ;
434	HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
435		= "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
436	HOST_PTHREAD_LINKFLAGS = ;
437	HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ;
438	HOST_DEFINES += __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ;
439
440	local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
441		HaikuBuildCompatibility.h ] ;
442	HOST_CCFLAGS += $(compatibilityHeader) ;
443	HOST_C++FLAGS += $(compatibilityHeader) ;
444
445	# compatibility library
446	HOST_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
447} else {
448	HOST_LINKFLAGS += -lm ;
449	HOST_LIBSTDC++ = stdc++ ;
450	HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ;
451	HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ;
452	HOST_LIBBE = libbe_build.so ;
453	if $(HOST_PLATFORM) = cygwin {
454		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
455			= "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
456	} else if $(HOST_PLATFORM) = darwin {
457		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
458			= "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
459	} else {
460		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
461			= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
462	}
463
464	if $(HOST_PLATFORM) = cygwin {
465		# not needed
466		HOST_PTHREAD_LINKFLAGS = ;
467	} else if $(HOST_PLATFORM) = freebsd {
468		HOST_PTHREAD_LINKFLAGS = -pthread ;
469	} else {
470		HOST_PTHREAD_LINKFLAGS = -pthread ;
471	}
472
473	# the C++ support library
474	if $(HOST_GCC_VERSION[1]) < 3 {
475		HOST_LIBSUPC++ = ;
476	} else {
477		HOST_LIBSUPC++ = supc++ ;
478	}
479
480	if $(HOST_PLATFORM) = darwin {
481		# part of the C++ runtime lives in libstdc++ on Darwin
482		HOST_LIBSUPC++ = gcc_s.1 stdc++ ;
483		HOST_LIBSTDC++ = ;
484	} else if $(HOST_PLATFORM) = freebsd {
485		if $(HOST_CPU) = x86_64 {
486			# amd64 FreeBSD 8 doesn't come without a shared libsupc++, and the
487			# static one prevents us from building shared libraries. So we have
488			# to work around by using the shared libstdc++.
489			HOST_LIBSUPC++ = stdc++ ;
490			HOST_LIBSTDC++ = ;
491		}
492	}
493
494	# Unlike glibc FreeBSD's libc doesn't have built-in regex support.
495	if $(HOST_PLATFORM) = freebsd {
496		HOST_LIBROOT += /usr/lib/libgnuregex.so ;
497		HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ;
498	} else if $(HOST_PLATFORM) = darwin {
499		HOST_LIBROOT += libgnuregex_build.a ;
500		HOST_STATIC_LIBROOT += libgnuregex_build.a ;
501	}
502
503	# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
504	# build platform we need to make sure, this is also defined.
505	if $(HOST_CPU) = x86 {
506		HOST_DEFINES += __INTEL__ ;
507	} else if $(HOST_CPU) = x86_64 {
508		HOST_DEFINES += __x86_64__ ;
509	} else if $(HOST_CPU) = ppc {
510		HOST_DEFINES += __POWERPC__ ;
511	} else if $(HOST_CPU) = m68k {
512		HOST_DEFINES += __M68K__ ;
513	}
514
515	# Supposing this is a glibc platform, let's try to get features like large
516	# file support, ISO C 99 definitions, etc. On some platforms we need to
517	# request 64 bit off_t support explicitely.
518	HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 __STDC_FORMAT_MACROS
519		__STDC_LIMIT_MACROS ;
520
521	# On Linux with xattr support we can use it for our attribute emulation,
522	# which is somewhat more robust.
523	if $(HAIKU_HOST_USE_XATTR) = 1 {
524		HOST_DEFINES += HAIKU_HOST_USE_XATTR ;
525	} else {
526		# Otherwise the generic attribute emulation is used, which uses a
527		# directory per file to store its attribute. We need to redefine RM so
528		# that the attributes are removed as well. We use a wrapper script,
529		# which invokes a build tool. If the build tool hasn't been built yet,
530		# the normal "rm" is used and the attributes are leaked (likely there
531		# aren't any yet).
532		RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ";"
533			[ FDirName $(HAIKU_TOP) build scripts rm_attrs ]
534			[ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release
535				tools rm_attrs ] -f ;
536			# assumes that rm_attrs is built with debugging disabled
537		HOST_RM_ATTRS_TARGET = <build>rm_attrs ;
538
539		# If specified, use xattr support to tag files with unique IDs.
540		if $(HAIKU_HOST_USE_XATTR_REF) = 1 {
541			HOST_DEFINES += HAIKU_HOST_USE_XATTR_REF ;
542		}
543	}
544}
545
546# network libraries
547if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
548	HOST_NETWORK_LIBS = network ;
549	HOST_NETAPI_LIB = bnetapi ;
550	HOST_SELECT_UNAME_ETC_LIB = ;	# libroot
551} else if $(HOST_PLATFORM_BONE_COMPATIBLE) {
552	HOST_NETWORK_LIBS = socket bind ;
553	HOST_NETAPI_LIB = bnetapi ;
554	HOST_SELECT_UNAME_ETC_LIB = ;	# libroot
555} else if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
556	HOST_NETWORK_LIBS = net ;
557	HOST_NETAPI_LIB = netapi ;
558	HOST_SELECT_UNAME_ETC_LIB = net ;
559} else if $(HOST_PLATFORM) = "sunos" {
560	HOST_NETWORK_LIBS = xnet ;
561	HOST_NETAPI_LIB = ;
562	HOST_SELECT_UNAME_ETC_LIB = ;
563} else {
564	# Linux,...
565	HOST_NETWORK_LIBS = ;
566	HOST_NETAPI_LIB = ;
567	HOST_SELECT_UNAME_ETC_LIB = ;
568}
569
570# define the executable MIME type
571HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
572
573if $(METROWERKS) {
574	# at least parts of Haiku still can be compiled with
575	# the Metrowerks compiler on BeOS/PPC
576	HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ;
577}
578
579# Be API compatibility
580HOST_BE_API_HEADERS = ;
581HOST_BE_API_CCFLAGS = ;
582HOST_BE_API_C++FLAGS = ;
583
584# Add directory with system headers we need when building something for the host
585# platform, e.g. containing missing POSIX/GNU headers.
586HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ;
587
588if $(HOST_PLATFORM) = freebsd {
589	# FreeBSD's gcc doesn't include /usr/local/* in its search paths,
590	# though that's where most things from ports wind up being installed.
591	HOST_HDRS += /usr/local/include ;
592	HOST_LINKFLAGS += -L/usr/local/lib ;
593}
594
595if $(HOST_PLATFORM) = darwin {
596	HOST_HDRS += [ FDirName $(HAIKU_TOP) src build libgnuregex ] ;
597
598	# Mac OS X users may be using macports libraries, in which case the headers
599	# and the libs are located in /opt/local/.
600	HOST_HDRS += /opt/local/include ;
601	HOST_LINKFLAGS += -L/opt/local/lib ;
602}
603
604HOST_BE_API_HEADERS =
605	[ FDirName $(HAIKU_TOP) headers build ]
606	[ FDirName $(HAIKU_TOP) headers build os ]
607	[ FDirName $(HAIKU_TOP) headers build os add-ons registrar ]
608	[ FDirName $(HAIKU_TOP) headers build os app ]
609	[ FDirName $(HAIKU_TOP) headers build os bluetooth ]
610	[ FDirName $(HAIKU_TOP) headers build os drivers ]
611	[ FDirName $(HAIKU_TOP) headers build os kernel ]
612	[ FDirName $(HAIKU_TOP) headers build os interface ]
613	[ FDirName $(HAIKU_TOP) headers build os locale ]
614	[ FDirName $(HAIKU_TOP) headers build os storage ]
615	[ FDirName $(HAIKU_TOP) headers build os support ]
616	[ FDirName $(HAIKU_TOP) headers build private ]
617;
618if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
619	HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ;
620	HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
621}
622
623
624#pragma mark - target platform settings
625
626
627# check the target platform compatibility
628SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
629
630# check the compatibility between host and target platform
631if $(TARGET_PLATFORM) != haiku {
632	if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) {
633		Exit ERROR: The host platform is not compatible with target platform
634			$(TARGET_PLATFORM). ;
635	}
636}
637
638# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
639# specified TARGET_PLATFORM. Some variables are package architecture dependent
640# and their name gets a respective suffix. A few variables exist both with and
641# without suffix. The latter is either equivalent to the variable with the
642# primary architecture suffix (e.g. TARGET_ARCH) or is (additionally) applicable
643# for all architectures (e.g. TARGET_DEFINES).
644
645local buildVars =
646	ARCH ARCHS KERNEL_ARCH PACKAGING_ARCH PACKAGING_ARCHS
647
648	DEFINES
649	KERNEL_DEFINES
650
651	KERNEL_CCFLAGS KERNEL_C++FLAGS
652	KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS
653	BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS
654
655	KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
656
657	KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
658	KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
659
660	PRIVATE_KERNEL_HEADERS
661
662	NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB
663
664	EXECUTABLE_MIME_TYPE
665
666	OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR
667	;
668
669local archDependentBuildVars =
670	ARCH CPU GCC_VERSION
671
672	AR CC C++ ELFEDIT LD OBJCOPY RANLIB STRIP
673
674	ARFLAGS ASFLAGS UNARFLAGS CPPFLAGS CCFLAGS C++FLAGS HDRS LDFLAGS
675	LINK LINKFLAGS
676
677	WARNING_CCFLAGS WARNING_C++FLAGS WERROR_FLAGS
678
679	DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
680
681	INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION
682
683	PRIVATE_SYSTEM_HEADERS
684
685	ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
686	DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
687	;
688
689if $(TARGET_PLATFORM) = haiku {
690	local var ;
691	for var in $(buildVars) {
692		TARGET_$(var) = $(HAIKU_$(var)) ;
693	}
694
695	for var in $(archDependentBuildVars)_$(TARGET_PACKAGING_ARCHS) {
696		TARGET_$(var) = $(HAIKU_$(var)) ;
697	}
698
699	TARGET_BOOT_LIBGCC		= $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ;
700	TARGET_BOOT_LIBSUPC++	= $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ;
701
702	TARGET_BOOT_PLATFORM	?= $(HAIKU_BOOT_PLATFORM) ;
703	TARGET_BOOT_BOARD		?= $(HAIKU_BOOT_BOARD) ;
704
705	local architecture ;
706	for architecture in $(TARGET_PACKAGING_ARCHS) {
707		TARGET_DEFINES_$(architecture) = $(HAIKU_DEFINES_$(architecture)) ;
708		TARGET_LIBRARY_NAME_MAP_$(architecture)
709			= HAIKU_LIBRARY_NAME_MAP_$(architecture) ;
710	}
711} else {
712	local var ;
713	for var in $(buildVars) {
714		TARGET_$(var) = $(HOST_$(var)) ;
715	}
716
717	for var in $(archDependentBuildVars) {
718		TARGET_$(var)_$(TARGET_PACKAGING_ARCH) = $(HOST_$(var)) ;
719	}
720
721	TARGET_BOOT_LIBGCC			= ;
722	TARGET_BOOT_LIBSUPC++		= ;
723
724	TARGET_BOOT_PLATFORM		= ;
725	TARGET_BOOT_BOARD			= ;
726
727	TARGET_DEFINES_$(TARGET_PACKAGING_ARCH) = ;
728		# all flags are in TARGET_DEFINES
729
730	TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = HOST_LIBRARY_NAME_MAP ;
731}
732
733# define macro, for identifying the platform
734switch $(TARGET_PLATFORM) {
735	case r5			: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_BEOS ;
736	case bone		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_BONE ;
737	case dano		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_DANO ;
738	case haiku_host	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_HAIKU ;
739	case haiku		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_HAIKU ;
740	case linux		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_LINUX ;
741	case freebsd	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_FREEBSD ;
742	case darwin		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_DARWIN ;
743	case cygwin		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_CYGWIN ;
744	case sunos		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_SUNOS ;
745	case libbe_test	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
746}
747
748# define macro, for identifying the host platform
749switch $(HOST_PLATFORM) {
750	case r5			: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_BEOS ;
751	case bone		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_BONE ;
752	case dano		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_DANO ;
753	case haiku_host	: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_HAIKU ;
754	case linux		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_LINUX ;
755	case freebsd	: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_FREEBSD ;
756	case darwin		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_DARWIN ;
757	case cygwin		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_CYGWIN ;
758	case sunos		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_SUNOS ;
759}
760
761# define host platform 64 bit macro
762if $(HOST_PLATFORM_IS_64_BIT) {
763	HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ;
764}
765
766# define Haiku packaging architecture macro for host build
767HOST_DEFINES += HAIKU_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
768
769
770#pragma mark -
771
772# In case we build for a BeOS compatible platform, but not for Haiku, we
773# include the HaikuBuildCompatibility.h header and link against
774# libhaikucompat.a.
775
776if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) {
777	# headers and flags
778	local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
779		HaikuBuildCompatibility.h ] ;
780	TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH) += $(compatibilityHeader) ;
781	TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH) += $(compatibilityHeader) ;
782
783	# compatibility library
784	TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
785}
786
787# special target libbe_test
788
789if $(TARGET_PLATFORM) = libbe_test {
790	# headers and flags
791	TARGET_HDRS_$(TARGET_PACKAGING_ARCH) +=
792		[ PublicHeaders $(DOT) app drivers game interface kernel locale storage
793			support ]
794		[ PrivateHeaders $(DOT) ] ;
795	TARGET_DEFINES += __HAIKU__ ;
796
797	TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH) =
798		[ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ;
799
800	# directories
801	TARGET_OBJECT_BASE_DIR
802		= [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ;
803	TARGET_COMMON_ARCH_OBJECT_DIR
804		= [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ;
805	TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
806		= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ;
807	TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
808		= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
809			common ] ;
810	TARGET_DEBUG_0_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
811		= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
812			release ] ;
813
814	local level ;
815	for level in $(HAIKU_DEBUG_LEVELS[2-]) {
816		TARGET_DEBUG_$(level)_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)
817			= [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH))
818				debug_$(level) ] ;
819	}
820
821	# library name map
822	TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = LIBBE_LIBRARY_NAME_MAP ;
823	LIBBE_LIBRARY_NAME_MAP_be = libbe_test.so ;
824}
825
826
827#pragma mark - common stuff
828
829
830# start with a clean state
831CCFLAGS = ;
832C++FLAGS = ;
833DEFINES = ;
834
835# Set CC, C++, LINK to invalid values, so that we realize early, that we use
836# the wrong compiler.
837CC = bad-cc ;
838C++ = bad-c++ ;
839LINK = bad-link ;
840
841
842# Defaults for warnings, optimization, and debugging.
843#
844WARNINGS ?= 1 ;
845OPTIM ?= -O2 ;
846DEBUG ?= 0 ;
847
848
849# Set a sane default for whether this is a CI build.
850HAIKU_CONTINUOUS_INTEGRATION_BUILD ?= 0 ;
851
852
853# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only
854# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS
855# can be overridden by the author of a component.
856PLATFORM = $(TARGET_PLATFORM) ;
857SUPPORTED_PLATFORMS = haiku ;
858
859
860# Define two pseudo targets for the target and buildhost platform. The main
861# build rules (Cc, C++, As, ...) depend on these pseude targets such that global
862# initializations that are required before anything is built for a specific
863# platform can be forced by depending the pseudo target for the platform on the
864# initializations.
865# This is currently used to unpack the external headers from the
866# gcc_syslibs_devel build feature before anything is built for the target
867# platform.
868NotFile $(TARGET_PLATFORM) ;
869NotFile host ;
870
871
872# Instructs the Library rule to not make its object files temporary.
873# This is needed as some objects are used in a static library and for an
874# executable.
875KEEPOBJS = true ;
876
877
878# Set permissions to how they should be on the image.
879EXEMODE		= 755 ;
880FILEMODE	= 644 ;
881SHELLMODE	= 755 ;
882
883
884# output directories
885# TODO: Review this.
886HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
887HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR)
888	documentation ] ;
889
890# TODO: Rethink test stuff.
891HAIKU_TEST_DIR			?= [ FDirName $(HAIKU_OUTPUT_DIR) tests
892	$(TARGET_PLATFORM) $(HAIKU_ARCH) ] ;
893HAIKU_APP_TEST_DIR		?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
894HAIKU_APP_TEST_LIB_DIR 	?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
895HAIKU_TMP_DIR			?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
896
897local architecture ;
898for architecture in $(HAIKU_PACKAGING_ARCHS) {
899	local baseDir
900		= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(architecture) packaging ] ;
901	HAIKU_PACKAGES_DIR_$(architecture) = [ FDirName $(baseDir) packages ] ;
902	HAIKU_PACKAGES_BUILD_DIR_$(architecture)
903		= [ FDirName $(baseDir) packages_build ] ;
904	HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)
905		= [ FDirName $(baseDir) repositories ] ;
906}
907
908
909HAIKU_PACKAGE_INFOS_DIR			= [ FDirName $(HAIKU_TOP) src data
910									package_infos ] ;
911
912TARGET_TEST_DIR				?= [ FDirName $(HAIKU_TEST_DIR)
913									$(TARGET_PLATFORM) ] ;
914TARGET_UNIT_TEST_DIR		?= [ FDirName $(TARGET_TEST_DIR) unittests ] ;
915TARGET_UNIT_TEST_LIB_DIR	?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ;
916
917# automatically setup the objects directory per subdirectory
918SUBDIRRULES += SetupObjectsDir ;
919
920# Add the standard (userland) warning flags variables to the ones restored in
921# every subdirectory. Thus we can easily meddle with them in subdirectories
922# with imported sources.
923AUTO_SET_UP_CONFIG_VARIABLES +=
924	HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
925	TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCHS)
926	TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCHS)
927	;
928
929# also add PLATFORM and SUPPORTED_PLATFORMS
930AUTO_SET_UP_CONFIG_VARIABLES += PLATFORM SUPPORTED_PLATFORMS ;
931
932
933# set up warnings
934local architecture ;
935for architecture in $(TARGET_PACKAGING_ARCHS) {
936	ArchitectureSetupWarnings $(architecture) ;
937}
938
939
940# set up architecture build features
941local architecture ;
942for architecture in $(TARGET_PACKAGING_ARCHS) {
943	InitArchitectureBuildFeatures $(architecture) ;
944}
945
946
947# The following directories cannot currently be compiled with DEBUG=1
948SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ;
949SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio hda : 0 : local ;
950SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auich : 0 : local ; # fails with gcc4 only
951SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auvia : 0 : local ; # fails with gcc4 only
952SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 sis7018 : 0 : local ;
953SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems btrfs : 0 : local ;
954SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems ntfs libntfs : 0 : local ;
955SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems udf : 0 : local ;
956SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server : 0 : local ; # fails with gcc2 only
957SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems userlandfs server haiku : 0 : local ; # fails with gcc2 only
958SetConfigVar DEBUG : HAIKU_TOP src add-ons media media-add-ons dvb : 0 : local ;
959SetConfigVar DEBUG : HAIKU_TOP src add-ons print drivers gutenprint : 0 : local ;
960SetConfigVar DEBUG : HAIKU_TOP src servers input : 0 : local ;
961SetConfigVar DEBUG : HAIKU_TOP src servers media_addon : 0 : local ;
962SetConfigVar DEBUG : HAIKU_TOP src system boot loader file_systems bfs : 0 : local ;
963