xref: /haiku/build/jam/BuildSetup (revision 90ae2e54f6ccaca73c011a2aa4cdd660417108ad)
1
2# Variable naming conventions:
3# TARGET_*:	A build system variable specifying a property for building for
4#			the target platform (usually Haiku). E.g. TARGET_CC specifies the
5#			compiler when building a target for the target platform.
6# HOST_*:	A build system variable specifying a property of the platform
7#			hosting the build. E.g. HOST_CC specifies the compiler when
8#			building a target for the host platform (a build tool for
9#			instance).
10# HAIKU_*:	A build system variable specifying a build system property. Usually
11#			directory paths and the like.
12
13
14#pragma mark - container settings
15
16# Haiku image
17HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ;
18HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ;
19HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
20	= HAIKU_INCLUDE_IN_IMAGE ;
21HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
22	= HAIKU_IMAGE_INSTALL_TARGETS ;
23
24# network boot archive
25HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ;
26HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
27	= NetBootArchive ;
28# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
29HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
30	= HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ;
31
32# alternative gcc archive
33HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME
34	= haiku-alternative-gcc-archive-container ;
35HAIKU_CONTAINER_GRIST on $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
36	= AlternativeGCCArchive ;
37# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
38HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
39	= HAIKU_ALTERNATIVE_GCC_ARCHIVE_INSTALL_TARGETS ;
40
41# boot floppy
42HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ;
43HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
44	= FloppyBootImage ;
45# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
46HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
47	= HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ;
48
49# boot CD image
50HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ;
51HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ;
52# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
53HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
54	= HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ;
55
56# boot CD for PPC image
57HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME = haiku-boot-cd-ppc-container ;
58HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) = CDBootPPCImage ;
59# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
60HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME)
61	= HAIKU_CD_BOOT_PPC_IMAGE_INSTALL_TARGETS ;
62
63# Haiku image/install defaults
64HAIKU_DEFAULT_IMAGE_NAME = haiku.image ;
65HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ;
66HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ;
67HAIKU_DEFAULT_INSTALL_DIR = /Haiku ;
68HAIKU_DEFAULT_IMAGE_SIZE ?= 300 ; # 300 MB
69HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ;
70
71# Haiku CD defaults
72HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ;
73HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ;
74HAIKU_DEFAULT_CD_LABEL = Haiku ;
75
76# Haiku Anyboot defaults
77HAIKU_DEFAULT_ANYBOOT_NAME = haiku-anyboot.image ;
78HAIKU_DEFAULT_ANYBOOT_DIR = $(HAIKU_OUTPUT_DIR) ;
79HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ;
80
81# analyze and optionally replace jam's target parameters
82ProcessCommandLineArguments ;
83
84
85# include libgccObjects
86{
87	local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ;
88
89	if ! $(libgccObjects) {
90		ECHO "No `libgccObjects' found in"
91			"$(HAIKU_BUILD_OUTPUT_DIR)!" ;
92		EXIT "Please run ./configure in the source tree's root directory"
93			"again!" ;
94	}
95
96	LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ;
97
98	include libgccObjects ;
99}
100
101
102# supported debug levels
103HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
104
105# BeOS, BONE, Dan0 compatible platforms
106HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ;
107HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ;
108HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ;
109HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ;
110
111# configuration header directories
112HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ]
113	[ FDirName $(HAIKU_TOP) build config_headers ] ;
114
115
116#pragma mark -
117
118# haiku target platform settings
119
120# analyze GCC version
121HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ;
122
123# enable GCC -pipe option, if requested
124if $(HAIKU_USE_GCC_PIPE) = 1 {
125	HAIKU_GCC_BASE_FLAGS = -pipe ;
126}
127
128# disable strict aliasing on anything newer than gcc 2 as it may lead to
129# unexpected results. also disable the tree-vrp (value range propagation)
130# optimization for now as with the current gcc4 version we are using this
131# results in some broken code.
132# TODO: remove the -fno-strict-aliasing option when all code has been
133#		analyzed/fixed with regard to aliasing.
134# TODO: retest/remove the -fno-tree-vrp option as soon as we have updated our
135#		gcc4 compiler.
136if $(HAIKU_GCC_VERSION[1]) >= 3 {
137	HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ;
138}
139
140if $(HOST_GCC_VERSION[1]) >= 3 {
141	HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ;
142}
143
144# override gcc 2.95.3's header directory -- strictly necessary only when using
145# the BeOS native compiler (since its headers are incompatible), but it doesn't
146# harm for the cross-compiler either.
147if $(HAIKU_GCC_VERSION[1]) = 2 {
148	HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ;
149}
150
151# the subdirectory into which the alternative GCC libraries are to be installed
152if $(HAIKU_GCC_VERSION[1]) = 2 {
153	HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc2 ;
154} else {
155	HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc4 ;
156}
157
158# initial state for flags etc.
159HAIKU_C++ ?= $(HAIKU_CC) ;
160HAIKU_LINK = $(HAIKU_CC) ;
161HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
162HAIKU_BOOT_LINKFLAGS = ;
163
164HAIKU_HDRS = [ FStandardHeaders ] ;
165HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
166HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
167HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
168HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ;
169HAIKU_CCFLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
170HAIKU_C++FLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
171HAIKU_DEFINES = __HAIKU__ ;
172HAIKU_NO_WERROR ?= 0 ;
173
174# distro compatibility level defines
175HAIKU_DISTRO_COMPATIBILITY ?= "default" ;
176switch $(HAIKU_DISTRO_COMPATIBILITY) {
177	case official	: {
178		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ;
179		HAIKU_INCLUDE_TRADEMARKS = "" ;
180	}
181	case compatible	: {
182		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ;
183		HAIKU_INCLUDE_TRADEMARKS = "" ;
184	}
185	case "default"	: {
186		HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ;
187		HAIKU_INCLUDE_TRADEMARKS = ;
188	}
189	case *			: Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:"
190						$(HAIKU_DISTRO_COMPATIBILITY) ;
191}
192
193# analyze the gcc machine spec to determine HAIKU_CPU
194switch $(HAIKU_GCC_MACHINE) {
195	case i?86-*		: HAIKU_CPU = x86 ;
196	case x86_64-*	: HAIKU_CPU = x86_64 ;
197	case powerpc-*	: HAIKU_CPU = ppc ;
198	case m68k-*		: HAIKU_CPU = m68k ;
199	case mipsel-*	: HAIKU_CPU = mipsel ;
200	case arm-*		: HAIKU_CPU = arm ;
201	case *			: Exit "Unsupported gcc target machine:"
202						$(HAIKU_GCC_MACHINE) ;
203}
204
205# determine the endianness of the host
206switch $(HOST_GCC_MACHINE) {
207	case amd64-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
208	case i?86-*		: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
209	case powerpc-*	: HAIKU_HOST_IS_BIG_ENDIAN = 1 ;
210	case x86_64-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
211
212	# the following are rather unlikely as hosts ...
213	case arm-*		: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
214	case m68k-*		: HAIKU_HOST_IS_BIG_ENDIAN = 1 ;
215	case mipsel-*	: HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
216	case *			: Exit "Unsupported gcc host machine:" $(HOST_GCC_MACHINE) ;
217}
218
219switch $(HAIKU_CPU) {
220	case ppc :
221	{
222		HAIKU_DEFINES += __POWERPC__ ;
223		HAIKU_BOOT_PLATFORM ?= openfirmware ;
224		HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
225		# offset in floppy image (>= sizeof(haiku_loader))
226		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
227	}
228	case arm :
229	{
230		HAIKU_DEFINES += __ARM__ ;
231		HAIKU_BOOT_PLATFORM ?= u-boot ;
232		HAIKU_BOOT_BOARD ?= verdex ;
233		HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ;
234			# in kB (there is not really a floppy on the gumstix ;) )
235		# offset in floppy image (>= sizeof(haiku_loader))
236		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
237		HAIKU_NO_WERROR = 1 ;
238			# we use #warning as placeholders for things to write...
239	}
240	case x86 :
241	{
242		HAIKU_DEFINES += __INTEL__ ;
243		HAIKU_BOOT_PLATFORM = bios_ia32 ;
244		HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
245		# offset in floppy image (>= sizeof(haiku_loader))
246		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
247
248		# yasm is required for target arch x86
249		if ! $(HAIKU_YASM) {
250			Exit "HAIKU_YASM not set. Please re-run configure." ;
251		}
252	}
253	case x86_64 :
254	{
255		# x86_64 completely shares the x86 bootloader.
256		HAIKU_BOOT_PLATFORM = bios_ia32 ;
257		HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
258		# offset in floppy image (>= sizeof(haiku_loader))
259		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
260
261		# x86_64 kernel source is under arch/x86.
262		HAIKU_KERNEL_ARCH = x86 ;
263
264		# yasm is required for target arch x86_64
265		if ! $(HAIKU_YASM) {
266			Exit "HAIKU_YASM not set. Please re-run configure." ;
267		}
268	}
269	case m68k :
270	{
271		HAIKU_DEFINES += __M68K__ ;
272		HAIKU_BOOT_PLATFORM ?= atari_m68k ;
273		switch $(HAIKU_BOOT_PLATFORM) {
274			case atari_m68k :
275			{
276				HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
277			}
278			case amiga_m68k :
279			{
280				# for now we have trouble reading from double-sided images
281				HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 880 ; # in kB
282			}
283		}
284		# offset in floppy image (>= sizeof(haiku_loader))
285		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB
286		HAIKU_NO_WERROR = 1 ;
287			# we use #warning as placeholders for things to write...
288	}
289	case mipsel :
290	{
291		HAIKU_DEFINES += __MIPSEL__ ;
292		# RouterBOARD firmware (ELF image over TFTP)
293		HAIKU_BOOT_PLATFORM = routerboard_mipsel ;
294		# offset in floppy image (>= sizeof(haiku_loader))
295		HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB
296		HAIKU_NO_WERROR = 1 ;
297			# we use #warning as placeholders for things to write...
298	}
299	case * :
300		Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ;
301}
302
303# strip is required
304if ! $(HAIKU_STRIP) {
305	Exit "HAIKU_STRIP not set. Please re-run configure." ;
306}
307
308# Include embedded board-specific file.
309if $(HAIKU_BOOT_BOARD) {
310	include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD)
311		BoardSetup ] ;
312}
313
314HAIKU_ARCH ?= $(HAIKU_CPU) ;
315HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ;
316HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ;
317HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
318HAIKU_KERNEL_ARCH ?= $(HAIKU_ARCH) ;
319HAIKU_ATA_STACK ?= 1 ;
320
321# directories
322HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
323HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
324HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ;
325HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ;
326HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ;
327
328local level ;
329for level in $(HAIKU_DEBUG_LEVELS[2-]) {
330	HAIKU_DEBUG_$(level)_OBJECT_DIR
331		= [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ;
332}
333
334# set variables for gcc header options
335SetIncludePropertiesVariables HAIKU ;
336
337# assembler flags
338HAIKU_ASFLAGS = ;
339
340# C/C++ flags
341HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin ;
342HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
343HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
344HAIKU_BOOT_CCFLAGS += -finline -fno-builtin ;
345HAIKU_BOOT_C++FLAGS += -finline -fno-builtin -fno-exceptions ;
346
347if $(HAIKU_GCC_VERSION[1]) >= 3 {
348	HAIKU_BOOT_C++FLAGS += -fno-use-cxa-atexit ;
349	HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
350}
351
352if $(HAIKU_GCC_VERSION[1]) >= 4 {
353	HAIKU_C++FLAGS += -Wno-deprecated ;
354
355	if $(HAIKU_GCC_VERSION[2]) >= 3 {
356		HAIKU_KERNEL_CCFLAGS += -ffreestanding ;
357		HAIKU_KERNEL_C++FLAGS += -ffreestanding ;
358		HAIKU_BOOT_CCFLAGS += -ffreestanding ;
359		HAIKU_BOOT_C++FLAGS += -ffreestanding ;
360	}
361}
362
363HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
364HAIKU_KERNEL_PIC_LINKFLAGS = ;
365HAIKU_KERNEL_ADDON_LINKFLAGS = ;
366
367switch $(HAIKU_ARCH) {
368	case ppc :
369	{
370		# Build a position independent PPC kernel. We need to be able to
371		# relocate the kernel, since the virtual address space layout at boot
372		# time is not fixed.
373		HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ;
374		HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
375	}
376
377	case m68k :
378	{
379		# We don't want to have to handle emulating missing FPU opcodes for 040
380		# and 060 in the kernel.
381		HAIKU_KERNEL_CCFLAGS += -m68020-60 ;
382		HAIKU_KERNEL_C++FLAGS += -m68020-60 ;
383	}
384	case x86 :
385	{
386		HAIKU_CCFLAGS += -march=pentium ;
387		HAIKU_C++FLAGS += -march=pentium ;
388		HAIKU_KERNEL_CCFLAGS += -march=pentium ;
389		HAIKU_KERNEL_C++FLAGS += -march=pentium ;
390
391		# Enable use of the gcc built-in atomic functions instead of atomic_*().
392		# The former are inlined and have thus less overhead. They are not
393		# available with gcc 2, but the header will take care of that.
394		HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ;
395	}
396	case x86_64 :
397	{
398		# Kernel lives in the top 2GB of the address space, use kernel code
399		# model.
400		HAIKU_KERNEL_PIC_CCFLAGS += -mcmodel=kernel ;
401
402		# Disable the red zone, which cannot be used in kernel code due to
403		# interrupts, and always enable the frame pointer so stack traces are
404		# correct.
405		HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ;
406		HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ;
407		HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
408		HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
409
410		# Bootloader is 32-bit.
411		HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;
412		HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ;
413		HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ;
414
415		# Enable use of the gcc built-in atomic functions instead of atomic_*().
416		# The former are inlined and have thus less overhead.
417		HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ;
418	}
419}
420
421# If the environment variable HAIKU_INCLUDE_PATENTED_CODE is defined, we
422# define an equally named macro to the variable value. Some components use the
423# macro to allow compilation of code known to implemented patented ideas and/or
424# techniques, for example the Freetype bytecode hinter or sub-pixel rendering
425# as well as some problematic media codecs.
426if $(HAIKU_INCLUDE_PATENTED_CODE) {
427	HAIKU_DEFINES
428		+= HAIKU_INCLUDE_PATENTED_CODE=$(HAIKU_INCLUDE_PATENTED_CODE) ;
429}
430
431# warning flags
432HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
433	-Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ;
434HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
435	-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare
436	-Wno-multichar ;
437
438HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
439	-Wno-multichar ;
440HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ;
441
442# debug flags
443HAIKU_DEBUG_FLAGS ?= -ggdb ;
444
445# debug 0: suppress asserts
446HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
447HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
448
449HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
450HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
451
452local level ;
453for level in $(HAIKU_DEBUG_LEVELS[2-]) {
454	local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
455	HAIKU_DEBUG_$(level)_CCFLAGS			= $(flags) ;
456	HAIKU_DEBUG_$(level)_C++FLAGS			= $(flags) ;
457	HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS		= $(flags) ;
458	HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS	= $(flags) ;
459}
460
461if $(HAIKU_GCC_VERSION[1]) >= 3 {
462	# TODO: Temporary work-around. Should be defined in the compiler specs
463	HAIKU_LINKFLAGS += -Xlinker --no-undefined ;
464} else {
465	HAIKU_DEFINES += _BEOS_R5_COMPATIBLE_ ;
466}
467
468# private shared kernel/libroot headers
469HAIKU_PRIVATE_SYSTEM_HEADERS =
470	[ PrivateHeaders $(DOT) system system/arch/$(HAIKU_ARCH) ]
471;
472
473# private kernel headers to be used when compiling kernel code
474HAIKU_PRIVATE_KERNEL_HEADERS =
475	[ PrivateHeaders $(DOT) kernel libroot shared
476		kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ]
477	[ ArchHeaders $(HAIKU_KERNEL_ARCH) ]
478	[ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR) system kernel ]
479	$(HAIKU_PRIVATE_SYSTEM_HEADERS)
480;
481
482# Add some grist to the libgcc objects
483HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ;
484
485# the C++ standard library
486HAIKU_BUILD_SHARED_LIBSTDC++ = ;
487if $(HAIKU_SHARED_LIBSTDC++) {
488	HAIKU_LIBSTDC++ = $(HAIKU_SHARED_LIBSTDC++) ;
489} else {
490	# no shared library available with the compiler -- build it
491	if $(HAIKU_GCC_VERSION[1]) = 2 {
492		HAIKU_LIBSTDC++ = libstdc++.r4.so ;
493	} else {
494		HAIKU_LIBSTDC++ = libstdc++.so ;
495	}
496	HAIKU_SHARED_LIBSTDC++ = $(HAIKU_LIBSTDC++) ;
497	HAIKU_BUILD_SHARED_LIBSTDC++ = 1 ;
498}
499
500# the C++ support (runtime) library
501HAIKU_BUILD_SHARED_LIBSUPC++ = ;
502if $(HAIKU_SHARED_LIBSUPC++) {
503	HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ;
504} else {
505	# no shared library available with the compiler -- build it for gcc 4
506	if $(HAIKU_GCC_VERSION[1]) != 2 {
507		HAIKU_SHARED_LIBSUPC++ = libsupc++.so ;
508		HAIKU_BUILD_SHARED_LIBSUPC++ = 1 ;
509	}
510
511	HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ;
512}
513
514
515# network libraries
516HAIKU_NETWORK_LIBS = network ;
517HAIKU_NETAPI_LIB = bnetapi ;
518HAIKU_SELECT_UNAME_ETC_LIB = ;	# libroot, against which we link anyway
519
520
521# locale libraries
522HAIKU_LOCALE_LIBS = liblocalestub.a ;
523
524
525# library and executable glue code
526local commonGlueCode =
527	<src!system!glue>init_term_dyn.o
528	<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
529	<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
530;
531HAIKU_LIBRARY_BEGIN_GLUE_CODE =
532	<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
533	crtbegin.o
534	<src!system!glue>init_term_dyn.o
535;
536HAIKU_LIBRARY_END_GLUE_CODE =
537	crtend.o
538	<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
539;
540HAIKU_EXECUTABLE_BEGIN_GLUE_CODE =
541	<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
542	crtbegin.o
543	<src!system!glue>start_dyn.o
544	<src!system!glue>init_term_dyn.o
545;
546HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ;
547HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o
548	<src!system!glue>haiku_version_glue.o ;
549HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ;
550
551SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ;
552
553HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
554
555# TODO: The version stuff should probably go into a separate file and be made
556# available as macro, too.
557# Set our version number if not already set and mark it as a developer build
558if ! $(HAIKU_BUILD_VERSION) {
559	HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ;
560	HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ;
561}
562
563# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as
564# an unknown build.
565HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
566
567# init library name map
568{
569	local i ;
570	for i in be bnetapi debug device game GL locale mail media midi midi2
571			network opengl package root screensaver textencoding tracker
572			translation z {
573		HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ;
574	}
575	HAIKU_LIBRARY_NAME_MAP_libstdc++ = $(HAIKU_LIBSTDC++) ;
576	HAIKU_LIBRARY_NAME_MAP_libsupc++ = $(HAIKU_LIBSUPC++) ;
577	HAIKU_LIBRARY_NAME_MAP_input_server = <nogrist>input_server ;
578}
579
580
581#pragma mark -
582
583# host platform settings
584
585# analyze the host gcc machine spec to find out about 64-bitness
586HOST_PLATFORM_IS_64_BIT = ;
587switch $(HOST_GCC_MACHINE) {
588	case amd64-* :				HOST_PLATFORM_IS_64_BIT = 1 ;
589	case i686-apple-darwin10 :	HOST_PLATFORM_IS_64_BIT = 1 ;
590	case i686-apple-darwin11 :	HOST_PLATFORM_IS_64_BIT = 1 ;
591	case x86_64-* :				HOST_PLATFORM_IS_64_BIT = 1 ;
592}
593
594# If HAIKU_HOST_USE_32BIT is set, add the required gcc base flag (the LD flag
595# is set later), or, if the architecture isn't actually 64 bit, clear
596# HAIKU_HOST_USE_32BIT.
597# Afterwards HOST_PLATFORM_IS_64_BIT will indicate whether the architecture is
598# effectively (i.e. when using the compiler/linker flags) 64 bit and
599# HAIKU_HOST_USE_32BIT will be set, iff the architecture is really 64 bit and
600# 32 bit mode was requested.
601if $(HAIKU_HOST_USE_32BIT) = 1 {
602	if $(HOST_PLATFORM_IS_64_BIT) {
603		# enable GCC -m32 option
604		HOST_GCC_BASE_FLAGS = -m32 ;
605		HOST_PLATFORM_IS_64_BIT = ;
606	} else {
607		HAIKU_HOST_USE_32BIT = 0 ;
608	}
609}
610
611
612# save jam's variables for the build platform
613HOST_AR				?= $(AR) ;
614HOST_CC				?= $(CC) ;
615HOST_C++			?= $(C++) ;
616HOST_LINK			?= $(LINK) ;
617HOST_RANLIB			?= $(RANLIB) ;
618HOST_CPPFLAGS		?= $(CPPFLAGS) ;
619HOST_CCFLAGS		?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ;
620HOST_C++FLAGS		?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ;
621HOST_LDFLAGS		?= $(LDFLAGS) ;
622HOST_LINKFLAGS		?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ;
623HOST_DEFINES		?= $(DEFINES) ;
624HOST_HDRS			?= $(HDRS) ;
625
626
627# split up HOST_AR into the command name and flags
628HOST_AR				= [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ]
629					  $(HOST_AR[2-]) ;
630HOST_ARFLAGS		= $(HOST_AR[2-]) ;
631HOST_AR				= $(HOST_AR[1]) ;
632HOST_UNARFLAGS		?= x ;
633
634# check the host platform compatibility
635SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
636	: linux openbsd freebsd darwin sunos cygwin ;
637
638if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
639	|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin
640	|| $(HOST_PLATFORM) = sunos || $(HOST_PLATFORM) = openbsd {
641	# don't use lex: otherwise rc will not work correctly
642	if $(LEX) = lex {
643		LEX = flex ;
644	}
645}
646
647# On recent versions of OS X cc and c++ point to clang, which fails to
648# compile some of the host tools. As a workaround, force use of GCC.
649if $(HOST_PLATFORM) = darwin {
650	HOST_CC = gcc ;
651	HOST_C++ = g++ ;
652}
653
654if $(HOST_PLATFORM) = cygwin {
655	HOST_LINKFLAGS += -Xlinker --allow-multiple-definition -Xlinker
656		--enable-auto-import ;
657}
658
659HOST_CPU	?= $(OSPLAT:L) ;
660
661# Jam doesn't know x86_64, so override HOST_CPU, if 64 bit.
662if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) {
663	HOST_CPU = x86_64 ;
664}
665
666HOST_ARCH				?= $(HOST_CPU) ;
667HOST_ARCH_MACRO_DEFINE	= ARCH_$(HOST_CPU) ;
668
669
670# directories
671HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ;
672HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ;
673HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ;
674HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ;
675HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ;
676
677local level ;
678for level in $(HAIKU_DEBUG_LEVELS[2-]) {
679	HOST_DEBUG_$(level)_OBJECT_DIR
680		= [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ;
681}
682
683# analyze GCC version
684HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ;
685
686# set variables for gcc header options
687SetIncludePropertiesVariables HOST ;
688
689# assembler flags
690HOST_ASFLAGS = ;
691
692# C/C++ flags
693HOST_CCFLAGS += -Wno-multichar ;
694HOST_C++FLAGS += -Wno-multichar ;
695
696if $(HOST_PLATFORM) != cygwin {
697	HOST_PIC_CCFLAGS += -fPIC ;
698	HOST_PIC_C++FLAGS += -fPIC ;
699}
700
701HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
702	-D_KERNEL_MODE ;
703HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
704	-fno-exceptions -D_KERNEL_MODE ;
705HOST_KERNEL_DEFINES += _KERNEL_MODE ;
706
707HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
708HOST_KERNEL_PIC_LINKFLAGS = ;
709if $(HOST_ARCH) = ppc {
710	# Build a position independent PPC kernel. We need to be able to relocate
711	# the kernel, since the virtual address space layout at boot time is not
712	# fixed.
713	HOST_KERNEL_PIC_CCFLAGS = -fPIE ;
714	HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
715}
716if $(HOST_ARCH) = m68k {
717	# Build a position independent M68K kernel. We need to be able to relocate
718	# the kernel, since the virtual address space layout at boot time is not
719	# fixed.
720	HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ;
721	HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ;
722}
723
724if $(HOST_PLATFORM) != darwin {
725	# fix for new changes to DSO linking policies
726	HOST_LINKFLAGS += -Xlinker --no-as-needed ;
727}
728
729
730# warning flags
731HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith
732	-Wcast-align -Wsign-compare ;
733HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
734	-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
735
736HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ;
737HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ;
738
739# debug flags
740switch $(HOST_PLATFORM) {
741	case haiku	: HOST_DEBUG_FLAGS ?= -ggdb ;
742	case haiku_host	: HOST_DEBUG_FLAGS ?= -ggdb ;
743	case linux	: HOST_DEBUG_FLAGS ?= -ggdb ;
744	case freebsd	: HOST_DEBUG_FLAGS ?= -ggdb ;
745	case darwin	: HOST_DEBUG_FLAGS ?= -ggdb ;
746	case *		: HOST_DEBUG_FLAGS ?= -g ;
747}
748
749# debug 0: suppress asserts
750HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
751HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
752
753HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
754HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
755
756local level ;
757for level in $(HAIKU_DEBUG_LEVELS[2-]) {
758	local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
759	HOST_DEBUG_$(level)_CCFLAGS			= $(flags) ;
760	HOST_DEBUG_$(level)_C++FLAGS		= $(flags) ;
761	HOST_KERNEL_DEBUG_$(level)_CCFLAGS	= $(flags) ;
762	HOST_KERNEL_DEBUG_$(level)_C++FLAGS	= $(flags) ;
763}
764
765# ld flags
766if $(HAIKU_HOST_USE_32BIT) = 1 {
767	HOST_LDFLAGS += -melf_i386 ;
768}
769
770# private kernel headers do be used when compiling kernel code
771HOST_PRIVATE_KERNEL_HEADERS = ;
772
773# private shared kernel/libroot headers
774HOST_PRIVATE_SYSTEM_HEADERS = ;
775
776# under BeOS use copyattr instead of cp
777if $(HOST_PLATFORM_BEOS_COMPATIBLE)
778{
779	CP = copyattr --data ;
780}
781
782HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ;
783HOST_DEFINES += _NO_INLINE_ASM ;
784
785if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
786	# TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5
787	# macro is used, it actually seems to mean r5/bone/dano.
788	# TODO: Deprecated. Remove!
789	HOST_DEFINES += COMPILE_FOR_R5 ;
790}
791
792# for builds of tools in the current environment
793HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
794
795# For the generic attributes emulation: Target rm_attrs -- rm replacement that
796# also removes the attributes.
797HOST_RM_ATTRS_TARGET = ;
798
799if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
800	# the C++ standard and support libraries
801	if $(HOST_GCC_VERSION[1]) < 3 {
802		HOST_LIBSTDC++ = stdc++.r4 ;
803		HOST_LIBSUPC++ = ;
804	} else {
805		HOST_LIBSTDC++ = stdc++ ;
806		HOST_LIBSUPC++ = supc++ ;
807	}
808
809	HOST_LIBROOT = root ;
810	HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ;
811	HOST_LIBBE = be ;
812	HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)"  ;
813	HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ;
814	HOST_DEFINES += __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ;
815
816	local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
817		HaikuBuildCompatibility.h ] ;
818	HOST_CCFLAGS += $(compatibilityHeader) ;
819	HOST_C++FLAGS += $(compatibilityHeader) ;
820
821	# compatibility library
822	HOST_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
823} else {
824	HOST_LINKFLAGS += -lm ;
825	HOST_LIBSTDC++ = stdc++ ;
826	HOST_LIBROOT = libroot_build_function_remapper.a libroot_build.so ;
827	HOST_STATIC_LIBROOT = libroot_build_function_remapper.a libroot_build.a ;
828	HOST_LIBBE = libbe_build.so ;
829	if $(HOST_PLATFORM) = cygwin {
830		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
831			= "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
832	} else if $(HOST_PLATFORM) = darwin {
833		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
834			= "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
835	} else {
836		HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
837			= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
838	}
839
840	# the C++ support library
841	if $(HOST_GCC_VERSION[1]) < 3 {
842		HOST_LIBSUPC++ = ;
843	} else {
844		HOST_LIBSUPC++ = supc++ ;
845	}
846
847	if $(HOST_PLATFORM) = darwin {
848		# part of the C++ runtime lives in libstdc++ on Darwin
849		HOST_LIBSUPC++ = gcc_s.1 stdc++ ;
850		HOST_LIBSTDC++ = ;
851	} else if $(HOST_PLATFORM) = freebsd {
852		if $(HOST_CPU) = x86_64 {
853			# amd64 FreeBSD 8 doesn't come without a shared libsupc++, and the
854			# static one prevents us from building shared libraries. So we have
855			# to work around by using the shared libstdc++.
856			HOST_LIBSUPC++ = stdc++ ;
857			HOST_LIBSTDC++ = ;
858		}
859	}
860
861	# Unlike glibc FreeBSD's libc doesn't have built-in regex support.
862	if $(HOST_PLATFORM) = freebsd {
863		HOST_LIBROOT += /usr/lib/libgnuregex.so ;
864		HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ;
865	} else if $(HOST_PLATFORM) = darwin {
866		HOST_LIBROOT += /opt/local/lib/libgnuregex.dylib ;
867		HOST_STATIC_LIBROOT += /opt/local/lib/libgnuregex.dylib ;
868	}
869
870	# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
871	# build platform we need to make sure, this is also defined.
872	if $(HOST_CPU) = x86 {
873		HOST_DEFINES += __INTEL__ ;
874	} else if $(HOST_CPU) = x86_64 {
875		HOST_DEFINES += __x86_64__ ;
876	} else if $(HOST_CPU) = ppc {
877		HOST_DEFINES += __POWERPC__ ;
878	} else if $(HOST_CPU) = m68k {
879		HOST_DEFINES += __M68K__ ;
880	} else if $(HOST_CPU) = mipsel {
881		HOST_DEFINES += __MIPSEL__ ;
882	}
883
884	# Supposing this is a glibc platform, let's try to get features like large
885	# file support, ISO C 99 definitions, etc. On some platforms we need to
886	# request 64 bit off_t support explicitely.
887	HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 __STDC_FORMAT_MACROS
888		__STDC_LIMIT_MACROS ;
889
890	# On Linux with xattr support we can use it for our attribute emulation,
891	# which is somewhat more robust.
892	if $(HAIKU_HOST_USE_XATTR) = 1 {
893		HOST_DEFINES += HAIKU_HOST_USE_XATTR ;
894	} else {
895		# Otherwise the generic attribute emulation is used, which uses a
896		# directory per file to store its attribute. We need to redefine RM so
897		# that the attributes are removed as well. We use a wrapper script,
898		# which invokes a build tool. If the build tool hasn't been built yet,
899		# the normal "rm" is used and the attributes are leaked (likely there
900		# aren't any yet).
901		RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ";"
902			[ FDirName $(HAIKU_TOP) build scripts rm_attrs ]
903			[ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release
904				tools rm_attrs ] -f ;
905			# assumes that rm_attrs is built with debugging disabled
906		HOST_RM_ATTRS_TARGET = <build>rm_attrs ;
907	}
908}
909
910# network libraries
911if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
912	HOST_NETWORK_LIBS = network ;
913	HOST_NETAPI_LIB = bnetapi ;
914	HOST_SELECT_UNAME_ETC_LIB = ;	# libroot
915} else if $(HOST_PLATFORM_BONE_COMPATIBLE) {
916	HOST_NETWORK_LIBS = socket bind ;
917	HOST_NETAPI_LIB = bnetapi ;
918	HOST_SELECT_UNAME_ETC_LIB = ;	# libroot
919} else if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
920	HOST_NETWORK_LIBS = net ;
921	HOST_NETAPI_LIB = netapi ;
922	HOST_SELECT_UNAME_ETC_LIB = net ;
923} else if $(HOST_PLATFORM) = "sunos" {
924	HOST_NETWORK_LIBS = xnet ;
925	HOST_NETAPI_LIB = ;
926	HOST_SELECT_UNAME_ETC_LIB = ;
927} else {
928	# Linux,...
929	HOST_NETWORK_LIBS = ;
930	HOST_NETAPI_LIB = ;
931	HOST_SELECT_UNAME_ETC_LIB = ;
932}
933
934# define the executable MIME type
935HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
936
937if $(METROWERKS) {
938	# at least parts of Haiku still can be compiled with
939	# the Metrowerks compiler on BeOS/PPC
940	HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ;
941}
942
943# Be API compatibility
944HOST_BE_API_HEADERS = ;
945HOST_BE_API_CCFLAGS = ;
946HOST_BE_API_C++FLAGS = ;
947
948if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
949	HOST_BE_API_HEADERS =
950		[ FDirName $(HAIKU_TOP) headers build ]
951		[ FDirName $(HAIKU_TOP) headers build os ]
952		[ FDirName $(HAIKU_TOP) headers build os app ]
953		[ FDirName $(HAIKU_TOP) headers build os drivers ]
954		[ FDirName $(HAIKU_TOP) headers build os kernel ]
955		[ FDirName $(HAIKU_TOP) headers build os interface ]
956		[ FDirName $(HAIKU_TOP) headers build os locale ]
957		[ FDirName $(HAIKU_TOP) headers build os opengl ]
958		[ FDirName $(HAIKU_TOP) headers build os storage ]
959		[ FDirName $(HAIKU_TOP) headers build os support ]
960		[ FDirName $(HAIKU_TOP) headers build private ]
961	;
962	HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ;
963	HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
964}
965
966# Add directory with system headers we need when building something for the host
967# platform, e.g. containing missing POSIX/GNU headers.
968HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ;
969
970# For all versions of BeOS also add the common beos directory.
971if $(HOST_PLATFORM) in r5 bone dano {
972	HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host beos_common ] ;
973}
974
975
976#pragma mark -
977
978# target platform settings
979
980# check the target platform compatibility
981SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
982
983# check the compatibility between host and target platform
984if $(TARGET_PLATFORM) != haiku {
985	if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) {
986		Exit ERROR: The host platform is not compatible with target platform
987			$(TARGET_PLATFORM). ;
988	}
989}
990
991# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
992# specified TARGET_PLATFORM.
993
994local buildVars =
995	ARCH CPU GCC_VERSION KERNEL_ARCH
996
997	AR CC C++ LD OBJCOPY RANLIB ELFEDIT
998
999	INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION
1000
1001	HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES
1002	ARFLAGS UNARFLAGS
1003	KERNEL_DEFINES
1004
1005	KERNEL_CCFLAGS KERNEL_C++FLAGS
1006	KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS
1007	BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS
1008	WARNING_CCFLAGS WARNING_C++FLAGS
1009
1010	KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
1011
1012	DEBUG_FLAGS
1013
1014	DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
1015
1016	KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
1017	KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
1018
1019	PRIVATE_KERNEL_HEADERS
1020	PRIVATE_SYSTEM_HEADERS
1021
1022	LIBSTDC++ LIBSUPC++
1023	STATIC_LIBSTDC++ STATIC_LIBSUPC++
1024
1025	NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB
1026
1027	ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE
1028
1029	OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
1030	DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
1031;
1032
1033if $(TARGET_PLATFORM) = haiku {
1034	local var ;
1035	for var in $(buildVars) {
1036		TARGET_$(var) = $(HAIKU_$(var)) ;
1037	}
1038
1039	TARGET_GCC_LIB_DIR			= $(HAIKU_GCC_LIB_DIR) ;
1040	TARGET_GCC_HEADERS_DIR		= $(HAIKU_GCC_HEADERS_DIR) ;
1041	TARGET_GCC_LIBGCC			= $(HAIKU_GCC_LIBGCC) ;
1042	TARGET_GCC_LIBGCC_OBJECTS	= $(HAIKU_GCC_LIBGCC_OBJECTS) ;
1043
1044	TARGET_KERNEL_LIBGCC		= $(HAIKU_KERNEL_LIBGCC) ;
1045	TARGET_KERNEL_LIBSUPC++		= $(HAIKU_KERNEL_LIBSUPC++) ;
1046	TARGET_BOOT_LIBGCC			= $(HAIKU_BOOT_LIBGCC) ;
1047	TARGET_BOOT_LIBSUPC++		= $(HAIKU_BOOT_LIBSUPC++) ;
1048
1049	TARGET_BOOT_PLATFORM		?= $(HAIKU_BOOT_PLATFORM) ;
1050	TARGET_BOOT_BOARD			?= $(HAIKU_BOOT_BOARD) ;
1051
1052	TARGET_LIBRARY_NAME_MAP		= HAIKU_LIBRARY_NAME_MAP ;
1053
1054} else {
1055	local var ;
1056	for var in $(buildVars) {
1057		TARGET_$(var) = $(HOST_$(var)) ;
1058	}
1059
1060	TARGET_GCC_LIB_DIR			= ;
1061	TARGET_GCC_HEADERS_DIR		= ;
1062	TARGET_GCC_LIBGCC			= ;
1063	TARGET_GCC_LIBGCC_OBJECTS	= ;
1064
1065	TARGET_KERNEL_LIBGCC		= ;
1066	TARGET_KERNEL_LIBSUPC++		= ;
1067	TARGET_BOOT_LIBGCC			= ;
1068	TARGET_BOOT_LIBSUPC++		= ;
1069
1070	TARGET_BOOT_PLATFORM		= ;
1071	TARGET_BOOT_BOARD			= ;
1072
1073	TARGET_LIBRARY_NAME_MAP		= HOST_LIBRARY_NAME_MAP ;
1074}
1075
1076# define macro, for identifying the platform
1077switch $(TARGET_PLATFORM) {
1078	case r5			: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_BEOS ;
1079	case bone		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_BONE ;
1080	case dano		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_DANO ;
1081	case haiku_host	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_HAIKU ;
1082	case haiku		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_HAIKU ;
1083	case linux		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_LINUX ;
1084	case freebsd	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_FREEBSD ;
1085	case darwin		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_DARWIN ;
1086	case cygwin		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_CYGWIN ;
1087	case sunos		: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_SUNOS ;
1088	case libbe_test	: TARGET_DEFINES	+= HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
1089}
1090
1091# define macro, for identifying the host platform
1092switch $(HOST_PLATFORM) {
1093	case r5			: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_BEOS ;
1094	case bone		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_BONE ;
1095	case dano		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_DANO ;
1096	case haiku_host	: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_HAIKU ;
1097	case linux		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_LINUX ;
1098	case freebsd	: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_FREEBSD ;
1099	case darwin		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_DARWIN ;
1100	case cygwin		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_CYGWIN ;
1101	case sunos		: HOST_DEFINES	+= HAIKU_HOST_PLATFORM_SUNOS ;
1102}
1103
1104# define host platform 64 bit macro
1105if $(HOST_PLATFORM_IS_64_BIT) {
1106	HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ;
1107}
1108
1109#pragma mark -
1110
1111# In case we build for a BeOS compatible platform, but not for Haiku, we
1112# include the HaikuBuildCompatibility.h header and link against
1113# libhaikucompat.a.
1114
1115if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) {
1116	# headers and flags
1117	local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
1118		HaikuBuildCompatibility.h ] ;
1119	TARGET_CCFLAGS += $(compatibilityHeader) ;
1120	TARGET_C++FLAGS += $(compatibilityHeader) ;
1121
1122	# compatibility library
1123	TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
1124}
1125
1126# special target libbe_test
1127
1128if $(TARGET_PLATFORM) = libbe_test {
1129	# headers and flags
1130	TARGET_HDRS +=
1131		[ PublicHeaders $(DOT) app drivers game interface kernel locale storage
1132			support ]
1133		[ PrivateHeaders $(DOT) ] ;
1134	TARGET_DEFINES += __HAIKU__ ;
1135
1136	TARGET_PRIVATE_SYSTEM_HEADERS =
1137		[ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ;
1138
1139	# directories
1140	TARGET_OBJECT_BASE_DIR
1141		= [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ;
1142	TARGET_COMMON_ARCH_OBJECT_DIR
1143		= [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ;
1144	TARGET_ARCH_OBJECT_DIR
1145		= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ;
1146	TARGET_COMMON_DEBUG_OBJECT_DIR
1147		= [ FDirName $(TARGET_ARCH_OBJECT_DIR) common ] ;
1148	TARGET_DEBUG_0_OBJECT_DIR
1149		= [ FDirName $(TARGET_ARCH_OBJECT_DIR) release ] ;
1150
1151	local level ;
1152	for level in $(HAIKU_DEBUG_LEVELS[2-]) {
1153		TARGET_DEBUG_$(level)_OBJECT_DIR
1154			= [ FDirName $(TARGET_ARCH_OBJECT_DIR) debug_$(level) ] ;
1155	}
1156
1157	# library name map
1158	TARGET_LIBRARY_NAME_MAP = LIBBE_LIBRARY_NAME_MAP ;
1159	LIBBE_LIBRARY_NAME_MAP_be = libbe_test.so ;
1160}
1161
1162
1163#pragma mark -
1164
1165# common stuff
1166
1167# start with a clean state
1168CCFLAGS = ;
1169C++FLAGS = ;
1170DEFINES = ;
1171
1172# Set CC, C++, LINK to invalid values, so that we realize early, that we use
1173# the wrong compiler.
1174CC = bad-cc ;
1175C++ = bad-c++ ;
1176LINK = bad-link ;
1177
1178# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage()
1179# issues, they deprecated that nice function. This will enable it again:
1180C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ;
1181# Same for buggy find_directory threadsafety fixes
1182C++FLAGS += -D_ZETA_TS_FIND_DIR_=1 ;
1183	# TODO: Doesn't really belong here.
1184
1185
1186# Defaults for warnings, optimization, and debugging.
1187#
1188WARNINGS ?= 1 ;
1189OPTIM ?= -O2 ;
1190DEBUG ?= 0 ;
1191
1192
1193# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only
1194# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS
1195# can be overridden by the author of a component.
1196PLATFORM = $(TARGET_PLATFORM) ;
1197SUPPORTED_PLATFORMS = haiku ;
1198
1199
1200# Instructs the Library rule to not make its object files temporary.
1201# This is needed as some objects are used in a static library and for an
1202# executable.
1203KEEPOBJS = true ;
1204
1205
1206# Set permissions to how they should be on the image.
1207EXEMODE		= 755 ;
1208FILEMODE	= 644 ;
1209SHELLMODE	= 755 ;
1210
1211
1212# output directories
1213# TODO: Review this.
1214HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
1215HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR)
1216	documentation ] ;
1217
1218# TODO: Rethink test stuff.
1219HAIKU_TEST_DIR			?= [ FDirName $(HAIKU_OUTPUT_DIR) tests
1220	$(TARGET_PLATFORM) $(HAIKU_ARCH) ] ;
1221HAIKU_APP_TEST_DIR		?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
1222HAIKU_APP_TEST_LIB_DIR 	?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
1223HAIKU_TMP_DIR			?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
1224
1225HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ;
1226HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ;
1227
1228TARGET_TEST_DIR				?= [ FDirName $(HAIKU_TEST_DIR)
1229									$(TARGET_PLATFORM) ] ;
1230TARGET_UNIT_TEST_DIR		?= [ FDirName $(TARGET_TEST_DIR) unittests ] ;
1231TARGET_UNIT_TEST_LIB_DIR	?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ;
1232
1233# automatically setup the objects directory per subdirectory
1234SUBDIRRULES += SetupObjectsDir ;
1235
1236# Add the standard (userland) warning flags variables to the ones restored in
1237# every subdirectory. Thus we can easily meddle with them in subdirectories
1238# with imported sources.
1239AUTO_SET_UP_CONFIG_VARIABLES +=
1240	HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
1241	TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS
1242
1243	# also add PLATFORM and SUPPORTED_PLATFORMS
1244	PLATFORM SUPPORTED_PLATFORMS
1245;
1246
1247
1248# enable -Werror for certain parts of the source tree
1249HAIKU_WERRORFLAGS = ;
1250if $(HAIKU_GCC_VERSION[1]) >= 4 {
1251	# -Wuninitialized gives too many false positives.
1252	HAIKU_WERRORFLAGS = -Wno-error=uninitialized ;
1253
1254	if $(HAIKU_GCC_VERSION[2]) >= 6 {
1255		# TODO: remove the -Wno-unused-but-set-variable option
1256		HAIKU_WERRORFLAGS += -Wno-unused-but-set-variable ;
1257	}
1258}
1259
1260rule EnableWerror dirTokens : scope {
1261	AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens)
1262		: -Werror $(HAIKU_WERRORFLAGS) : $(scope) ;
1263	AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens)
1264		: -Werror $(HAIKU_WERRORFLAGS) : $(scope) ;
1265}
1266
1267# Work-around for GCC 2 problem -- despite -Wno-multichar it reports
1268# multichar warnings in headers/private/kernel/debugger_keymaps.h included by
1269# src/system/kernel/arch/x86/arch_debug_console.cpp.
1270if $(HAIKU_GCC_VERSION[1]) = 2 {
1271	local file = <src!system!kernel!arch!x86>arch_debug_console.o ;
1272	C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] ;
1273}
1274
1275if $(HAIKU_NO_WERROR) != 1 {
1276	EnableWerror src add-ons accelerants 3dfx ;
1277	EnableWerror src add-ons accelerants ati ;
1278	EnableWerror src add-ons accelerants common ;
1279	EnableWerror src add-ons accelerants et6x00 ;
1280#	EnableWerror src add-ons accelerants intel_extreme ;
1281#	EnableWerror src add-ons accelerants matrox ;
1282	EnableWerror src add-ons accelerants neomagic ;
1283#	EnableWerror src add-ons accelerants nvidia ;
1284	EnableWerror src add-ons accelerants nvidia_gpgpu ;
1285#	EnableWerror src add-ons accelerants radeon ;
1286#	EnableWerror src add-ons accelerants radeon_hd ;
1287	EnableWerror src add-ons accelerants s3 ;
1288	EnableWerror src add-ons accelerants skeleton ;
1289	EnableWerror src add-ons accelerants vesa ;
1290	EnableWerror src add-ons accelerants via ;
1291	EnableWerror src add-ons accelerants vmware ;
1292	EnableWerror src add-ons bluetooth ;
1293	EnableWerror src add-ons decorators ;
1294	EnableWerror src add-ons disk_systems ;
1295	EnableWerror src add-ons input_server devices ;
1296#	EnableWerror src add-ons input_server filters ;
1297#	EnableWerror src add-ons input_server methods ;
1298	EnableWerror src add-ons kernel bluetooth ;
1299#	EnableWerror src add-ons kernel bus_managers acpi ;
1300	EnableWerror src add-ons kernel bus_managers agp_gart ;
1301	EnableWerror src add-ons kernel bus_managers ata ;
1302	EnableWerror src add-ons kernel bus_managers config_manager ;
1303#	EnableWerror src add-ons kernel bus_managers firewire ;
1304	EnableWerror src add-ons kernel bus_managers isa ;
1305	EnableWerror src add-ons kernel bus_managers pci ;
1306#	EnableWerror src add-ons kernel bus_managers ps2 ; # gcc2
1307	EnableWerror src add-ons kernel bus_managers scsi ;
1308	EnableWerror src add-ons kernel bus_managers usb ;
1309	EnableWerror src add-ons kernel busses agp_gart ;
1310	EnableWerror src add-ons kernel busses ata ;
1311	EnableWerror src add-ons kernel busses scsi ;
1312	EnableWerror src add-ons kernel busses usb ;
1313	EnableWerror src add-ons kernel console ;
1314	EnableWerror src add-ons kernel cpu ;
1315#	EnableWerror src add-ons kernel debugger ; # gcc2
1316#	EnableWerror src add-ons kernel drivers audio ;
1317	EnableWerror src add-ons kernel drivers bluetooth ;
1318	EnableWerror src add-ons kernel drivers bus ;
1319	EnableWerror src add-ons kernel drivers common ;
1320	EnableWerror src add-ons kernel drivers disk ;
1321	EnableWerror src add-ons kernel drivers dvb ;
1322#	EnableWerror src add-ons kernel drivers graphics ;
1323#	EnableWerror src add-ons kernel drivers input ;
1324	EnableWerror src add-ons kernel drivers joystick ;
1325	EnableWerror src add-ons kernel drivers midi ;
1326	EnableWerror src add-ons kernel drivers misc ;
1327#	EnableWerror src add-ons kernel drivers network ;
1328	EnableWerror src add-ons kernel drivers ports ;
1329#	EnableWerror src add-ons kernel drivers power ;
1330	EnableWerror src add-ons kernel drivers printer ;
1331	EnableWerror src add-ons kernel drivers random ;
1332	EnableWerror src add-ons kernel drivers tty ;
1333	EnableWerror src add-ons kernel drivers video ;
1334	EnableWerror src add-ons kernel file_systems bfs ;
1335	EnableWerror src add-ons kernel file_systems cdda ;
1336#	EnableWerror src add-ons kernel file_systems ext2 ;
1337#	EnableWerror src add-ons kernel file_systems fat ;
1338#	EnableWerror src add-ons kernel file_systems googlefs ;
1339	EnableWerror src add-ons kernel file_systems iso9660 ;
1340	EnableWerror src add-ons kernel file_systems layers ;
1341	EnableWerror src add-ons kernel file_systems netfs ;
1342	EnableWerror src add-ons kernel file_systems nfs ;
1343#	EnableWerror src add-ons kernel file_systems ntfs ;
1344	EnableWerror src add-ons kernel file_systems packagefs ;
1345	EnableWerror src add-ons kernel file_systems ramfs ;
1346#	EnableWerror src add-ons kernel file_systems reiserfs ;
1347	EnableWerror src add-ons kernel file_systems udf ;
1348	EnableWerror src add-ons kernel file_systems userlandfs ;
1349	EnableWerror src add-ons kernel generic ;
1350#	EnableWerror src add-ons kernel network datalink_protocols ;
1351	EnableWerror src add-ons kernel network devices ;
1352	EnableWerror src add-ons kernel network notifications ;
1353	EnableWerror src add-ons kernel network ppp ;
1354	EnableWerror src add-ons kernel network protocols ;
1355#	EnableWerror src add-ons kernel network stack ;
1356	EnableWerror src add-ons kernel partitioning_systems ;
1357	EnableWerror src add-ons locale ;
1358	EnableWerror src add-ons mail_daemon ;
1359	EnableWerror src add-ons media media-add-ons demultiplexer ;
1360	EnableWerror src add-ons media media-add-ons dvb ;
1361	EnableWerror src add-ons media media-add-ons esound_sink ;
1362	EnableWerror src add-ons media media-add-ons finepix_webcam ;
1363	EnableWerror src add-ons media media-add-ons firewire_dv ;
1364	EnableWerror src add-ons media media-add-ons legacy ;
1365	EnableWerror src add-ons media media-add-ons mixer ;
1366	EnableWerror src add-ons media media-add-ons multi_audio ;
1367	EnableWerror src add-ons media media-add-ons opensound ;
1368	EnableWerror src add-ons media media-add-ons radeon ;
1369	EnableWerror src add-ons media media-add-ons reader ;
1370	EnableWerror src add-ons media media-add-ons tone_producer_demo ;
1371	EnableWerror src add-ons media media-add-ons usb_vision ;
1372#	EnableWerror src add-ons media media-add-ons usb_webcam ;
1373	EnableWerror src add-ons media media-add-ons video_mixer ;
1374#	EnableWerror src add-ons media media-add-ons video_producer_demo ;
1375	EnableWerror src add-ons media media-add-ons videowindow ;
1376	EnableWerror src add-ons media media-add-ons writer ;
1377	EnableWerror src add-ons media plugins ac3_decoder ;
1378	EnableWerror src add-ons media plugins aiff_reader ;
1379	EnableWerror src add-ons media plugins ape_reader ;
1380#	EnableWerror src add-ons media plugins asf_reader ;
1381	EnableWerror src add-ons media plugins au_reader ;
1382#	EnableWerror src add-ons media plugins avi_reader ;
1383#	EnableWerror src add-ons media plugins ffmpeg ;
1384#	EnableWerror src add-ons media plugins matroska ;
1385#	EnableWerror src add-ons media plugins mov_reader ;
1386	EnableWerror src add-ons media plugins mp3_decoder ;
1387#	EnableWerror src add-ons media plugins mp3_reader ;
1388	EnableWerror src add-ons media plugins mp4_reader ;
1389	EnableWerror src add-ons media plugins musepack ;
1390#	EnableWerror src add-ons media plugins ogg ;
1391#	EnableWerror src add-ons media plugins raw_decoder ;
1392#	EnableWerror src add-ons media plugins speex ;
1393	EnableWerror src add-ons media plugins theora ;
1394	EnableWerror src add-ons media plugins vorbis ;
1395#	EnableWerror src add-ons media plugins wav_reader ;
1396	EnableWerror src add-ons media plugins xvid_decoder ;
1397	EnableWerror src add-ons opengl ;
1398	EnableWerror src add-ons print ;
1399	EnableWerror src add-ons screen_savers ;
1400	EnableWerror src add-ons tracker ;
1401	EnableWerror src add-ons translators bmp ;
1402#	EnableWerror src add-ons translators exr ;
1403	EnableWerror src add-ons translators gif ;
1404#	EnableWerror src add-ons translators hpgs ;
1405	EnableWerror src add-ons translators hvif ;
1406	EnableWerror src add-ons translators ico ;
1407#	EnableWerror src add-ons translators jpeg ; # gcc2
1408	EnableWerror src add-ons translators jpeg2000 ;
1409	EnableWerror src add-ons translators pcx ;
1410#	EnableWerror src add-ons translators png ; # gcc2
1411	EnableWerror src add-ons translators ppm ;
1412	EnableWerror src add-ons translators raw ;
1413	EnableWerror src add-ons translators rtf ;
1414	EnableWerror src add-ons translators sgi ;
1415	EnableWerror src add-ons translators shared ;
1416#	EnableWerror src add-ons translators stxt ;
1417	EnableWerror src add-ons translators tga ;
1418	EnableWerror src add-ons translators tiff ;
1419#	EnableWerror src add-ons translators wonderbrush ;
1420	EnableWerror src add-ons print ;
1421	EnableWerror src bin package ;
1422	EnableWerror src apps ;
1423	EnableWerror src kits ;
1424	EnableWerror src preferences ;
1425	EnableWerror src servers ;
1426	EnableWerror src system kernel ;
1427	EnableWerror src system libroot add-ons ;
1428	EnableWerror src system libroot posix locale ;
1429	EnableWerror src system libroot posix wchar ;
1430	EnableWerror src system runtime_loader ;
1431}
1432
1433# The following directories cannot currently be compiled with DEBUG=1
1434SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ;
1435SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio hda : 0 : local ;
1436SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auich : 0 : local ; # fails with gcc4 only
1437SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 auvia : 0 : local ; # fails with gcc4 only
1438SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio ac97 sis7018 : 0 : local ;
1439SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems btrfs : 0 : local ;
1440SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems ntfs libntfs : 0 : local ;
1441SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel file_systems udf : 0 : local ;
1442SetConfigVar DEBUG : HAIKU_TOP src add-ons media media-add-ons dvb : 0 : local ;
1443SetConfigVar DEBUG : HAIKU_TOP src add-ons print drivers gutenprint : 0 : local ;
1444SetConfigVar DEBUG : HAIKU_TOP src servers input : 0 : local ;
1445SetConfigVar DEBUG : HAIKU_TOP src servers media_addon : 0 : local ;
1446SetConfigVar DEBUG : HAIKU_TOP src system boot loader file_systems bfs : 0 : local ;
1447SetConfigVar DEBUG : HAIKU_TOP src system boot loader file_systems tarfs : 0 : local ;
1448