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 ?= 128 ; # 128 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# analyze and optionally replace jam's target parameters 77ProcessCommandLineArguments ; 78 79 80# include Timezones/libgccObjects 81{ 82 local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ; 83 local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ; 84 85 if ! ( $(timezones) && $(libgccObjects) ) { 86 ECHO "No `Timezones' or `libgccObjects' found in" 87 "$(HAIKU_BUILD_OUTPUT_DIR)!" ; 88 EXIT "Please run ./configure in the source tree's root directory" 89 "again!" ; 90 } 91 92 LOCATE on Timezones = $(HAIKU_BUILD_OUTPUT_DIR) ; 93 LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ; 94 95 include Timezones ; 96 include libgccObjects ; 97} 98 99 100# supported debug levels 101HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ; 102 103# BeOS, BONE, Dan0 compatible platforms 104HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ; 105HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ; 106HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ; 107HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ; 108 109# configuration header directories 110HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ] 111 [ FDirName $(HAIKU_TOP) build config_headers ] ; 112 113 114#pragma mark - 115 116# haiku target platform settings 117 118# analyze GCC version 119HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ; 120 121# enable GCC -pipe option, if requested 122if $(HAIKU_USE_GCC_PIPE) = 1 { 123 HAIKU_GCC_BASE_FLAGS = -pipe ; 124} 125 126# disable strict aliasing on anything newer than gcc 2 as it may lead to 127# unexpected results. also disable the tree-vrp (value range propagation) 128# optimization for now as with the current gcc4 version we are using this 129# results in some broken code. 130# TODO: remove the -fno-strict-aliasing option when all code has been 131# analyzed/fixed with regard to aliasing. 132# TODO: retest/remove the -fno-tree-vrp option as soon as we have updated our 133# gcc4 compiler. 134if $(HAIKU_GCC_VERSION[1]) >= 3 { 135 HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; 136} 137 138# override gcc 2.95.3's header directory -- strictly necessary only when using 139# the BeOS native compiler (since its headers are incompatible), but it doesn't 140# harm for the cross-compiler either. 141if $(HAIKU_GCC_VERSION[1]) = 2 { 142 HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; 143} 144 145# the subdirectory into which the alternative GCC libraries are to be installed 146if $(HAIKU_GCC_VERSION[1]) = 2 { 147 HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc2 ; 148} else { 149 HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc4 ; 150} 151 152# initial state for flags etc. 153HAIKU_C++ ?= $(HAIKU_CC) ; 154HAIKU_LINK = $(HAIKU_CC) ; 155HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 156 157HAIKU_HDRS = [ FStandardHeaders ] ; 158HAIKU_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; 159HAIKU_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; 160HAIKU_KERNEL_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 161HAIKU_KERNEL_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) ; 162HAIKU_DEFINES = __HAIKU__ ; 163 164# distro compatibility level defines 165HAIKU_DISTRO_COMPATIBILITY ?= "default" ; 166switch $(HAIKU_DISTRO_COMPATIBILITY) { 167 case official : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ; 168 case compatible : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ; 169 case "default" : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ; 170 case * : Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:" 171 $(HAIKU_DISTRO_COMPATIBILITY) ; 172} 173 174# analyze the gcc machine spec to determine HAIKU_CPU 175switch $(HAIKU_GCC_MACHINE) { 176 case i386-* : HAIKU_CPU = x86 ; 177 case i486-* : HAIKU_CPU = x86 ; 178 case i586-* : HAIKU_CPU = x86 ; 179 case i686-* : HAIKU_CPU = x86 ; 180 case powerpc-* : HAIKU_CPU = ppc ; 181 case m68k-* : HAIKU_CPU = m68k ; 182 case mipsel-* : HAIKU_CPU = mipsel ; 183 case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ; 184} 185 186switch $(HAIKU_CPU) { 187 case ppc : 188 { 189 HAIKU_DEFINES += __POWERPC__ ; 190 HAIKU_BOOT_PLATFORM = openfirmware ; 191 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB 192 # offset in floppy image (>= sizeof(haiku_loader)) 193 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet 194 } 195 case x86 : 196 { 197 HAIKU_DEFINES += __INTEL__ ; 198 HAIKU_BOOT_PLATFORM = bios_ia32 ; 199 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB 200 # offset in floppy image (>= sizeof(haiku_loader)) 201 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB 202 203 # yasm is required for target arch x86 204 if ! $(HAIKU_YASM) { 205 Exit "HAIKU_YASM not set. Please re-run configure." ; 206 } 207 } 208 case m68k : 209 { 210 HAIKU_DEFINES += __M68K__ ; 211 HAIKU_BOOT_PLATFORM = atari_m68k ; 212 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB 213 # offset in floppy image (>= sizeof(haiku_loader)) 214 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 150 ; # in kB 215 } 216 case mipsel : 217 { 218 HAIKU_DEFINES += __MIPSEL__ ; 219 # RouterBOARD firmware (ELF image over TFTP) 220 HAIKU_BOOT_PLATFORM = routerboot_mipsel ; 221 # offset in floppy image (>= sizeof(haiku_loader)) 222 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - todo/fixme 223 } 224 case * : 225 Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; 226} 227HAIKU_ARCH ?= $(HAIKU_CPU) ; 228HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ; 229HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ; 230HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; 231HAIKU_ATA_STACK ?= 0 ; 232 233# directories 234HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; 235HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ; 236HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ; 237HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ; 238HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ; 239 240local level ; 241for level in $(HAIKU_DEBUG_LEVELS[2-]) { 242 HAIKU_DEBUG_$(level)_OBJECT_DIR 243 = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ; 244} 245 246# set variables for gcc header options 247SetIncludePropertiesVariables HAIKU ; 248 249# assembler flags 250HAIKU_ASFLAGS = ; 251 252# C/C++ flags 253HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin 254 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; 255HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions 256 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ; 257HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; 258 259if $(HAIKU_GCC_VERSION[1]) >= 3 { 260 HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ; 261} 262 263if $(HAIKU_GCC_VERSION[1]) >= 4 { 264 HAIKU_C++FLAGS += -Wno-deprecated ; 265 266 if $(HAIKU_GCC_VERSION[2]) >= 3 { 267 HAIKU_KERNEL_CCFLAGS += -ffreestanding ; 268 HAIKU_KERNEL_C++FLAGS += -ffreestanding ; 269 } 270} 271 272HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; 273HAIKU_KERNEL_PIC_LINKFLAGS = ; 274if $(HAIKU_ARCH) = ppc { 275 # Build a position independent PPC kernel. We need to be able to relocate 276 # the kernel, since the virtual address space layout at boot time is not 277 # fixed. 278 HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ; 279 HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; 280} 281if $(HAIKU_ARCH) = m68k { 282 # We don't need a PIC kernel as it's always at the same place. 283 # it's actually needed to not use pic, else linking fails due to too large 284 # pc refs. 285 HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; 286 HAIKU_KERNEL_PIC_LINKFLAGS = ; 287 # we don't want to have to handle emulating missing FPU opcodes for 040 and 288 # 060 in the kernel 289 HAIKU_KERNEL_CCFLAGS += -m68020-60 ; 290 HAIKU_KERNEL_C++FLAGS += -m68020-60 ; 291} 292if $(HAIKU_ARCH) = mipsel { 293 # todo: verify correctness of this 294 HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; 295 HAIKU_KERNEL_PIC_LINKFLAGS = ; 296} 297 298# If the environment variable DEBUG_PRINTF is defined we define an equally 299# named macro to the variable value. Some components use the macro to allow 300# another function than printf() to print the debug output. The variable should 301# be set to the name of the alternative function. 302# 303if $(DEBUG_PRINTF) { 304 HAIKU_CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ; 305 HAIKU_C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ; 306} 307 308# warning flags 309HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes 310 -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ; 311HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy 312 -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare 313 -Wno-multichar ; 314 315HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes 316 -Wno-multichar ; 317HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ; 318 319# debug flags 320HAIKU_DEBUG_FLAGS ?= -ggdb ; 321 322# debug 0: suppress asserts 323HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 324HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 325 326HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 327HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 328 329local level ; 330for level in $(HAIKU_DEBUG_LEVELS[2-]) { 331 local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; 332 HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ; 333 HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ; 334 HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; 335 HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; 336} 337 338if $(HAIKU_GCC_VERSION[1]) >= 3 { 339 # TODO: Temporary work-around. Should be defined in the compiler specs 340 HAIKU_LINKFLAGS += -Xlinker --no-undefined ; 341} else { 342 HAIKU_DEFINES += _BEOS_R5_COMPATIBLE_ ; 343} 344 345# private shared kernel/libroot headers 346HAIKU_PRIVATE_SYSTEM_HEADERS = 347 [ PrivateHeaders $(DOT) system system/arch/$(HAIKU_ARCH) ] 348; 349 350# private kernel headers to be used when compiling kernel code 351HAIKU_PRIVATE_KERNEL_HEADERS = 352 [ PrivateHeaders $(DOT) kernel libroot 353 kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] 354 [ ArchHeaders $(HAIKU_ARCH) ] 355 $(HAIKU_PRIVATE_SYSTEM_HEADERS) 356; 357 358# Add some grist to the libgcc objects 359HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ; 360 361# the C++ library 362if $(HAIKU_SHARED_LIBSTDC++) { 363 HAIKU_LIBSTDC++ = $(HAIKU_SHARED_LIBSTDC++) ; 364} else if $(HAIKU_STATIC_LIBSTDC++) { 365 HAIKU_LIBSTDC++ = $(HAIKU_STATIC_LIBSTDC++) ; 366} else { 367 HAIKU_LIBSTDC++ = libstdc++.r4.so ; 368 HAIKU_SHARED_LIBSTDC++ = $(HAIKU_LIBSTDC++) ; 369} 370 371# the C++ support library 372if $(HAIKU_SHARED_LIBSUPC++) { 373 HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ; 374} else if $(HAIKU_STATIC_LIBSUPC++) { 375 HAIKU_LIBSUPC++ = $(HAIKU_STATIC_LIBSUPC++) ; 376} else { 377 HAIKU_LIBSUPC++ = ; 378} 379 380# network libraries 381HAIKU_NETWORK_LIBS = network ; 382HAIKU_NETAPI_LIB = bnetapi ; 383HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway 384 385# library and executable glue code 386local commonGlueCode = 387 <src!system!glue>init_term_dyn.o 388 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 389 <src!system!glue!arch!$(HAIKU_ARCH)>crtn.o 390; 391HAIKU_LIBRARY_BEGIN_GLUE_CODE = 392 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 393 crtbegin.o 394 <src!system!glue>init_term_dyn.o 395; 396HAIKU_LIBRARY_END_GLUE_CODE = 397 # TODO: For the time being always link against libsupc++.a. 398 $(HAIKU_STATIC_LIBSUPC++) 399 crtend.o 400 <src!system!glue!arch!$(HAIKU_ARCH)>crtn.o 401; 402HAIKU_EXECUTABLE_BEGIN_GLUE_CODE = 403 <src!system!glue!arch!$(HAIKU_ARCH)>crti.o 404 crtbegin.o 405 <src!system!glue>start_dyn.o 406 <src!system!glue>init_term_dyn.o 407; 408HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ; 409HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o 410 <src!system!glue>haiku_version_glue.o ; 411HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ; 412 413SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ; 414 415HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; 416 417# TODO: The version stuff should probably go into a separate file and be made 418# available as macro, too. 419# Set our version number if not already set and mark it as a developer build 420if ! $(HAIKU_BUILD_VERSION) { 421 HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ; 422 HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ; 423} 424 425# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as 426# an unknown build. 427HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ; 428 429# init library name map 430{ 431 local i ; 432 for i in be game GL mail media midi midi2 network bnetapi opengl 433 screensaver root z textencoding tracker translation { 434 HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ; 435 } 436 HAIKU_LIBRARY_NAME_MAP_libstdc++ = $(HAIKU_LIBSTDC++) ; 437 HAIKU_LIBRARY_NAME_MAP_input_server = <nogrist>input_server ; 438} 439 440 441#pragma mark - 442 443# host platform settings 444 445# enable GCC -m32 option, if requested 446if $(HAIKU_HOST_USE_32BIT) = 1 { 447 HOST_GCC_BASE_FLAGS = -m32 ; 448} 449 450 451# save jam's variables for the build platform 452HOST_AR ?= $(AR) ; 453HOST_CC ?= $(CC) ; 454HOST_C++ ?= $(C++) ; 455HOST_LINK ?= $(LINK) ; 456HOST_LD ?= ld ; # TODO: Fix this! 457HOST_OBJCOPY ?= objcopy ; # 458HOST_RANLIB ?= $(RANLIB) ; 459HOST_CPPFLAGS ?= $(CPPFLAGS) ; 460HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ; 461HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ; 462HOST_LDFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LDFLAGS) ; 463HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ; 464HOST_DEFINES ?= $(DEFINES) ; 465HOST_HDRS ?= $(HDRS) ; 466 467 468# split up HOST_AR into the command name and flags 469HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ] 470 $(HOST_AR[2-]) ; 471HOST_ARFLAGS = $(HOST_AR[2-]) ; 472HOST_AR = $(HOST_AR[1]) ; 473HOST_UNARFLAGS ?= x ; 474 475# check the host platform compatibility 476SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host 477 : linux openbsd freebsd darwin sunos cygwin ; 478 479if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd 480 || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin 481 || $(HOST_PLATFORM) = sunos || $(HOST_PLATFORM) = openbsd { 482 # don't use lex: otherwise rc will not work correctly 483 if $(LEX) = lex { 484 LEX = flex ; 485 } 486} 487 488if $(HOST_PLATFORM) = cygwin { 489 HOST_LINKFLAGS += -Xlinker --allow-multiple-definition -Xlinker 490 --enable-auto-import ; 491} 492 493HOST_CPU ?= $(OSPLAT:L) ; 494 495HOST_ARCH ?= $(HOST_CPU) ; 496HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ; 497 498# directories 499HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ; 500HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ; 501HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ; 502HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ; 503HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ; 504 505local level ; 506for level in $(HAIKU_DEBUG_LEVELS[2-]) { 507 HOST_DEBUG_$(level)_OBJECT_DIR 508 = [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ; 509} 510 511# analyze GCC version 512HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ; 513 514# set variables for gcc header options 515SetIncludePropertiesVariables HOST ; 516 517# assembler flags 518HOST_ASFLAGS = ; 519 520# C/C++ flags 521HOST_CCFLAGS += -Wno-multichar ; 522HOST_C++FLAGS += -Wno-multichar ; 523 524if $(HOST_PLATFORM) != cygwin { 525 HOST_PIC_CCFLAGS += -fPIC ; 526 HOST_PIC_C++FLAGS += -fPIC ; 527} 528 529HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin 530 -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; 531HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin 532 -fno-exceptions -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ; 533HOST_KERNEL_DEFINES += _KERNEL_MODE ; 534 535HOST_KERNEL_PIC_CCFLAGS = -fno-pic ; 536HOST_KERNEL_PIC_LINKFLAGS = ; 537if $(HOST_ARCH) = ppc { 538 # Build a position independent PPC kernel. We need to be able to relocate 539 # the kernel, since the virtual address space layout at boot time is not 540 # fixed. 541 HOST_KERNEL_PIC_CCFLAGS = -fPIE ; 542 HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; 543} 544if $(HOST_ARCH) = m68k { 545 # Build a position independent M68K kernel. We need to be able to relocate 546 # the kernel, since the virtual address space layout at boot time is not 547 # fixed. 548 HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ; 549 HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ; 550} 551 552# warning flags 553HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith 554 -Wcast-align -Wsign-compare ; 555HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy 556 -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ; 557 558HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ; 559HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ; 560 561# debug flags 562switch $(HOST_PLATFORM) { 563 case haiku : HOST_DEBUG_FLAGS ?= -ggdb ; 564 case haiku_host : HOST_DEBUG_FLAGS ?= -ggdb ; 565 case linux : HOST_DEBUG_FLAGS ?= -ggdb ; 566 case freebsd : HOST_DEBUG_FLAGS ?= -ggdb ; 567 case darwin : HOST_DEBUG_FLAGS ?= -ggdb ; 568 case * : HOST_DEBUG_FLAGS ?= -g ; 569} 570 571# debug 0: suppress asserts 572HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 573HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 574 575HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 576HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; 577 578local level ; 579for level in $(HAIKU_DEBUG_LEVELS[2-]) { 580 local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; 581 HOST_DEBUG_$(level)_CCFLAGS = $(flags) ; 582 HOST_DEBUG_$(level)_C++FLAGS = $(flags) ; 583 HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; 584 HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; 585} 586 587# ld flags 588if $(HOST_ARCH) = x86 && $(HAIKU_HOST_USE_32BIT) = 1 { 589 HOST_LDFLAGS += -melf_i386 ; 590} 591 592# private kernel headers do be used when compiling kernel code 593HOST_PRIVATE_KERNEL_HEADERS = ; 594 595# private shared kernel/libroot headers 596HOST_PRIVATE_SYSTEM_HEADERS = ; 597 598# under BeOS use copyattr instead of cp 599if $(HOST_PLATFORM_BEOS_COMPATIBLE) 600{ 601 CP = copyattr --data ; 602} 603 604HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ; 605HOST_DEFINES += _NO_INLINE_ASM ; 606 607if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 608 # TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5 609 # macro is used, it actually seems to mean r5/bone/dano. 610 # TODO: Deprecated. Remove! 611 HOST_DEFINES += COMPILE_FOR_R5 ; 612} 613 614# for builds of tools in the current environment 615HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ; 616 617# For the generic attributes emulation: Target rm_attrs -- rm replacement that 618# also removes the attributes. 619HOST_RM_ATTRS_TARGET = ; 620 621if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 622 if $(HOST_GCC_VERSION[1]) < 3 { 623 HOST_LIBSTDC++ = stdc++.r4 ; 624 } else { 625 HOST_LIBSTDC++ = stdc++ ; 626 } 627 628 HOST_LIBROOT = root ; 629 HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ; 630 HOST_LIBBE = be ; 631 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = ; 632 HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ; 633} else { 634 HOST_LIBSTDC++ = stdc++ ; 635 HOST_LIBROOT = libroot_build.so ; 636 HOST_STATIC_LIBROOT = libroot_build.a ; 637 HOST_LIBBE = libbe_build.so ; 638 if $(HOST_PLATFORM) = cygwin { 639 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR 640 = "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; 641 } else if $(HOST_PLATFORM) = darwin { 642 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR 643 = "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; 644 } else { 645 HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR 646 = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; 647 } 648 649 # the C++ support library 650 if $(HOST_GCC_VERSION[1]) < 3 { 651 HOST_LIBSUPC++ = ; 652 } else { 653 HOST_LIBSUPC++ = supc++ ; 654 } 655 656 if $(HOST_PLATFORM) = darwin { 657 # part of the C++ runtime lives in libstdc++ on Darwin 658 HOST_LIBSUPC++ = gcc_s.1 stdc++ ; 659 HOST_LIBSTDC++ = ; 660 } 661 662 # Unlike glibc FreeBSD's libc doesn't have built-in regex support. 663 if $(HOST_PLATFORM) = freebsd { 664 HOST_LIBROOT += /usr/lib/libgnuregex.so ; 665 HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ; 666 } else if $(HOST_PLATFORM) = darwin { 667 HOST_LIBROOT += /opt/local/lib/libgnuregex.dylib ; 668 HOST_STATIC_LIBROOT += /opt/local/lib/libgnuregex.dylib ; 669 } 670 671 672 # The BeOS compilers define __INTEL__ respectively __POWERPC__. On the 673 # build platform we need to make sure, this is also defined. 674 if $(HOST_CPU) = x86 { 675 HOST_DEFINES += __INTEL__ ; 676 } else if $(HOST_CPU) = ppc { 677 HOST_DEFINES += __POWERPC__ ; 678 } else if $(HOST_CPU) = m68k { 679 HOST_DEFINES += __M68K__ ; 680 } else if $(HOST_CPU) = mipsel { 681 HOST_DEFINES += __MIPSEL__ ; 682 } 683 684 # Supposing this is a glibc platform, let's try to get features like large 685 # file support, ISO C 99 definitions, etc. On some platforms we need to 686 # request 64 bit off_t support explicitely. 687 HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 ; 688 689 # On Linux with xattr support we can use it for our attribute emulation, 690 # which is somewhat more robust. 691 if $(HAIKU_HOST_USE_XATTR) = 1 { 692 HOST_DEFINES += HAIKU_HOST_USE_XATTR ; 693 } else { 694 # Otherwise the generic attribute emulation is used, which uses a 695 # directory per file to store its attribute. We need to redefine RM so 696 # that the attributes are removed as well. We use a wrapper script, 697 # which invokes a build tool. If the build tool hasn't been built yet, 698 # the normal "rm" is used and the attributes are leaked (likely there 699 # aren't any yet). 700 RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ";" 701 [ FDirName $(HAIKU_TOP) build scripts rm_attrs ] 702 [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release 703 tools rm_attrs ] -f ; 704 # assumes that rm_attrs is built with debugging disabled 705 HOST_RM_ATTRS_TARGET = <build>rm_attrs ; 706 } 707} 708 709# network libraries 710if $(HOST_PLATFORM_HAIKU_COMPATIBLE) { 711 HOST_NETWORK_LIBS = network ; 712 HOST_NETAPI_LIB = bnetapi ; 713 HOST_SELECT_UNAME_ETC_LIB = ; # libroot 714} else if $(HOST_PLATFORM_BONE_COMPATIBLE) { 715 HOST_NETWORK_LIBS = socket bind ; 716 HOST_NETAPI_LIB = bnetapi ; 717 HOST_SELECT_UNAME_ETC_LIB = ; # libroot 718} else if $(HOST_PLATFORM_BEOS_COMPATIBLE) { 719 HOST_NETWORK_LIBS = net ; 720 HOST_NETAPI_LIB = netapi ; 721 HOST_SELECT_UNAME_ETC_LIB = net ; 722} else if $(HOST_PLATFORM) = "sunos" { 723 HOST_NETWORK_LIBS = xnet ; 724 HOST_NETAPI_LIB = ; 725 HOST_SELECT_UNAME_ETC_LIB = ; 726} else { 727 # Linux,... 728 HOST_NETWORK_LIBS = ; 729 HOST_NETAPI_LIB = ; 730 HOST_SELECT_UNAME_ETC_LIB = ; 731} 732 733# define the executable MIME type 734HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; 735 736if $(METROWERKS) { 737 # at least parts of Haiku still can be compiled with 738 # the Metrowerks compiler on BeOS/PPC 739 HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ; 740} 741 742# Be API compatibility 743HOST_BE_API_HEADERS = ; 744HOST_BE_API_CCFLAGS = ; 745HOST_BE_API_C++FLAGS = ; 746 747if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { 748 HOST_BE_API_HEADERS = 749 [ FDirName $(HAIKU_TOP) headers build ] 750 [ FDirName $(HAIKU_TOP) headers build os ] 751 [ FDirName $(HAIKU_TOP) headers build os app ] 752 [ FDirName $(HAIKU_TOP) headers build os drivers ] 753 [ FDirName $(HAIKU_TOP) headers build os kernel ] 754 [ FDirName $(HAIKU_TOP) headers build os interface ] 755 [ FDirName $(HAIKU_TOP) headers build os opengl ] 756 [ FDirName $(HAIKU_TOP) headers build os storage ] 757 [ FDirName $(HAIKU_TOP) headers build os support ] 758 ; 759 HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ; 760 HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ; 761} 762 763# Add directory with system headers we need when building something for the host 764# platform, e.g. containing missing POSIX/GNU headers. 765HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ; 766 767# For all versions of BeOS also add the common beos directory. 768if $(HOST_PLATFORM) in r5 bone dano { 769 HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host beos_common ] ; 770} 771 772 773#pragma mark - 774 775# target platform settings 776 777# check the target platform compatibility 778SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ; 779 780# check the compatibility between host and target platform 781if $(TARGET_PLATFORM) != haiku { 782 if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) { 783 Exit ERROR: The host platform is not compatible with target platform 784 $(TARGET_PLATFORM). ; 785 } 786} 787 788# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the 789# specified TARGET_PLATFORM. 790 791local buildVars = 792 ARCH CPU GCC_VERSION 793 794 AR CC C++ LD OBJCOPY RANLIB 795 796 INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION 797 798 HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES 799 ARFLAGS UNARFLAGS 800 KERNEL_DEFINES 801 802 KERNEL_CCFLAGS KERNEL_C++FLAGS 803 KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS 804 WARNING_CCFLAGS WARNING_C++FLAGS 805 806 KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS 807 808 DEBUG_FLAGS 809 810 DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS 811 812 KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS 813 KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS 814 815 PRIVATE_KERNEL_HEADERS 816 PRIVATE_SYSTEM_HEADERS 817 818 LIBSTDC++ LIBSUPC++ 819 STATIC_LIBSTDC++ STATIC_LIBSUPC++ 820 821 NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB 822 823 ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE 824 825 OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR 826 DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR 827; 828 829if $(TARGET_PLATFORM) = haiku { 830 local var ; 831 for var in $(buildVars) { 832 TARGET_$(var) = $(HAIKU_$(var)) ; 833 } 834 835 TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ; 836 TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ; 837 TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ; 838 TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ; 839 840 TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ; 841 842 TARGET_LIBRARY_NAME_MAP = HAIKU_LIBRARY_NAME_MAP ; 843 844} else { 845 local var ; 846 for var in $(buildVars) { 847 TARGET_$(var) = $(HOST_$(var)) ; 848 } 849 850 TARGET_GCC_LIB_DIR = ; 851 TARGET_GCC_HEADERS_DIR = ; 852 TARGET_GCC_LIBGCC = ; 853 TARGET_GCC_LIBGCC_OBJECTS = ; 854 855 TARGET_BOOT_PLATFORM = ; 856 857 TARGET_LIBRARY_NAME_MAP = HOST_LIBRARY_NAME_MAP ; 858} 859 860# define macro, for identifying the platform 861switch $(TARGET_PLATFORM) { 862 case r5 : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BEOS ; 863 case bone : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BONE ; 864 case dano : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DANO ; 865 case haiku_host : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; 866 case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ; 867 case linux : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LINUX ; 868 case freebsd : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_FREEBSD ; 869 case darwin : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DARWIN ; 870 case cygwin : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_CYGWIN ; 871 case sunos : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_SUNOS ; 872 case libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ; 873} 874 875# define macro, for identifying the host platform 876switch $(HOST_PLATFORM) { 877 case r5 : HOST_DEFINES += HAIKU_HOST_PLATFORM_BEOS ; 878 case bone : HOST_DEFINES += HAIKU_HOST_PLATFORM_BONE ; 879 case dano : HOST_DEFINES += HAIKU_HOST_PLATFORM_DANO ; 880 case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ; 881 case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ; 882 case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ; 883 case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ; 884 case cygwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_CYGWIN ; 885 case sunos : HOST_DEFINES += HAIKU_HOST_PLATFORM_SUNOS ; 886} 887 888 889#pragma mark - 890 891# In case we build for a BeOS compatible platform, but not for Haiku, we 892# include the HaikuBuildCompatibility.h header and link against 893# libhaikucompat.a. 894 895if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { 896 # headers and flags 897 local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build 898 HaikuBuildCompatibility.h ] ; 899 TARGET_CCFLAGS += $(compatibilityHeader) ; 900 TARGET_C++FLAGS += $(compatibilityHeader) ; 901 902 # compatibility library 903 TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ; 904} 905 906# special target libbe_test 907 908if $(TARGET_PLATFORM) = libbe_test { 909 # headers and flags 910 TARGET_HDRS += 911 [ PublicHeaders $(DOT) app drivers game interface kernel storage 912 support ] 913 [ PrivateHeaders $(DOT) ] ; 914 TARGET_DEFINES += __HAIKU__ ; 915 916 TARGET_PRIVATE_SYSTEM_HEADERS = 917 [ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ; 918 919 # directories 920 TARGET_OBJECT_BASE_DIR 921 = [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ; 922 TARGET_COMMON_ARCH_OBJECT_DIR 923 = [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ; 924 TARGET_ARCH_OBJECT_DIR 925 = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ; 926 TARGET_COMMON_DEBUG_OBJECT_DIR 927 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) common ] ; 928 TARGET_DEBUG_0_OBJECT_DIR 929 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) release ] ; 930 931 local level ; 932 for level in $(HAIKU_DEBUG_LEVELS[2-]) { 933 TARGET_DEBUG_$(level)_OBJECT_DIR 934 = [ FDirName $(TARGET_ARCH_OBJECT_DIR) debug_$(level) ] ; 935 } 936 937 # library name map 938 TARGET_LIBRARY_NAME_MAP = LIBBE_LIBRARY_NAME_MAP ; 939 LIBBE_LIBRARY_NAME_MAP_be = libbe_haiku.so ; 940} 941 942 943#pragma mark - 944 945# common stuff 946 947# start with a clean state 948CCFLAGS = ; 949C++FLAGS = ; 950DEFINES = ; 951 952# Set CC, C++, LINK to invalid values, so that we realize early, that we use 953# the wrong compiler. 954CC = bad-cc ; 955C++ = bad-c++ ; 956LINK = bad-link ; 957 958# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage() 959# issues, they deprecated that nice function. This will enable it again: 960C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ; 961# Same for buggy find_directory threadsafety fixes 962C++FLAGS += -D_ZETA_TS_FIND_DIR_=1 ; 963 # TODO: Doesn't really belong here. 964 965 966# Defaults for warnings, optimization, and debugging. 967# 968WARNINGS ?= 1 ; 969OPTIM ?= -O2 ; 970DEBUG ?= 0 ; 971 972 973# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only 974# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS 975# can be overridden by the author of a component. 976PLATFORM = $(TARGET_PLATFORM) ; 977SUPPORTED_PLATFORMS = haiku ; 978 979 980# Instructs the Library rule to not make its object files temporary. 981# This is needed as some objects are used in a static library and for an 982# executable. 983KEEPOBJS = true ; 984 985 986# Set permissions to how they should be on the image. 987EXEMODE = 755 ; 988FILEMODE = 644 ; 989SHELLMODE = 755 ; 990 991 992# output directories 993# TODO: Review this. 994HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ; 995HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) 996 documentation ] ; 997 998# TODO: Rethink test stuff. 999HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests 1000 $(TARGET_PLATFORM) $(HAIKU_ARCH) ] ; 1001HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ; 1002HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ; 1003HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ; 1004 1005HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ; 1006HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ; 1007 1008TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) 1009 $(TARGET_PLATFORM) ] ; 1010TARGET_UNIT_TEST_DIR ?= [ FDirName $(TARGET_TEST_DIR) unittests ] ; 1011TARGET_UNIT_TEST_LIB_DIR ?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ; 1012 1013# automatically setup the objects directory per subdirectory 1014SUBDIRRULES += SetupObjectsDir ; 1015 1016# Add the standard (userland) warning flags variables to the ones restored in 1017# every subdirectory. Thus we can easily meddle with them in subdirectories 1018# with imported sources. 1019AUTO_SET_UP_CONFIG_VARIABLES += 1020 HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS 1021 TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS 1022 1023 # also add PLATFORM and SUPPORTED_PLATFORMS 1024 PLATFORM SUPPORTED_PLATFORMS 1025; 1026 1027 1028# enable -Werror for certain parts of the source tree 1029 1030if $(HAIKU_GCC_VERSION[1]) = 2 { 1031 rule EnableWerror dirTokens : scope { 1032 AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) : -Werror 1033 : $(scope) ; 1034 AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) : -Werror 1035 : $(scope) ; 1036 } 1037} else { 1038 # -Wuninitialized gives too many false positives. 1039 rule EnableWerror dirTokens : scope { 1040 AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) 1041 : -Werror -Wno-error=uninitialized : $(scope) ; 1042 AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) 1043 : -Werror -Wno-error=uninitialized : $(scope) ; 1044 } 1045} 1046 1047# Work-around for GCC 2 problem -- despite -Wno-multichar it reports 1048# multichar warnings in headers/private/kernel/debugger_keymaps.h included by 1049# src/system/kernel/arch/x86/arch_debug_console.c. 1050if $(HAIKU_GCC_VERSION[1]) = 2 { 1051 local file = <src!system!kernel!arch!x86>arch_debug_console.o ; 1052 CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] ; 1053} 1054 1055EnableWerror src kits app ; 1056EnableWerror src kits interface ; 1057EnableWerror src kits storage ; 1058EnableWerror src kits support ; 1059EnableWerror src system kernel ; 1060EnableWerror src system runtime_loader ; 1061EnableWerror src add-ons kernel file_systems bfs ; 1062EnableWerror src add-ons kernel file_systems userlandfs ; 1063