1rule ArchitectureSetup architecture 2{ 3 # ArchitectureSetup <architecture> ; 4 # 5 # Initializes all global packaging architecture dependent variables for the 6 # given packaging architecture. Also sets HAIKU_ARCH (to the primary 7 # architecture), if this is the first invocation of the rule, and adds 8 # the architecture to HAIKU_ARCHS, if not yet contained. 9 10 # analyze GCC version 11 local gccVersion 12 = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION_$(architecture) ] ; 13 HAIKU_GCC_VERSION_$(architecture) = $(gccVersion) ; 14 15 # enable GCC -pipe option, if requested 16 local gccBaseFlags ; 17 if $(HAIKU_USE_GCC_PIPE) = 1 { 18 gccBaseFlags = -pipe ; 19 } 20 21 # disable strict aliasing on anything newer than gcc 2 as it may lead to 22 # unexpected results. also disable the tree-vrp (value range propagation) 23 # optimization for now as with the current gcc4 version we are using this 24 # results in some broken code. 25 # TODO: remove the -fno-strict-aliasing option when all code has been 26 # analyzed/fixed with regard to aliasing. 27 # TODO: retest/remove the -fno-tree-vrp option as soon as we have updated 28 # our gcc4 compiler. See this discussion on some issues: 29 # http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization 30 if $(gccVersion[1]) >= 3 { 31 gccBaseFlags += -fno-strict-aliasing ; 32 if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 { 33 gccBaseFlags += -fno-tree-vrp ; 34 } 35 } 36 37 # disable array bounds warnings on gcc 4.6 or newer since they trigger 38 # too many false positives. Coverity does a better job of this kind of 39 # analysis anyways. 40 if $(gccVersion[1]) >= 4 { 41 gccBaseFlags += -Wno-array-bounds ; 42 } 43 44 local cpu = $(HAIKU_CPU_$(architecture)) ; 45 if $(cpu) = arm { 46 if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 { 47 # For stackcrawls - not supported by Clang 48 gccBaseFlags += -mapcs-frame ; 49 } 50 } 51 52 # activating graphite optimizations 53 if $(HAIKU_USE_GCC_GRAPHITE_$(architecture)) = 1 { 54 gccBaseFlags += -floop-interchange -ftree-loop-distribution 55 -floop-strip-mine -floop-block ; 56 } 57 HAIKU_GCC_BASE_FLAGS_$(architecture) = $(gccBaseFlags) ; 58 59 # initial state for flags etc. 60 HAIKU_C++_$(architecture) ?= $(HAIKU_CC_$(architecture)) ; 61 HAIKU_LINK_$(architecture) = $(HAIKU_CC_$(architecture)) ; 62 HAIKU_LINKFLAGS_$(architecture) = $(gccBaseFlags) ; 63 64 HAIKU_CCFLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ; 65 HAIKU_C++FLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ; 66 67 # strip is required 68 if ! $(HAIKU_STRIP_$(architecture)) { 69 Exit "HAIKU_STRIP_$(architecture) not set. Please re-run configure." ; 70 } 71 72 HAIKU_ARCH_$(architecture) = $(cpu) ; 73 HAIKU_ARCH ?= $(cpu) ; 74 # Set only, if not set yet. This way HAIKU_ARCH is set to the primary 75 # architecture. 76 if ! $(cpu) in $(HAIKU_ARCHS) { 77 HAIKU_ARCHS += $(cpu) ; 78 } 79 HAIKU_DEFINES_$(architecture) += ARCH_$(cpu) ; 80 81 # directories 82 HAIKU_ARCH_OBJECT_DIR_$(architecture) 83 = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(architecture) ] ; 84 HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture) 85 = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) common ] ; 86 HAIKU_DEBUG_0_OBJECT_DIR_$(architecture) 87 = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) release ] ; 88 89 local level ; 90 for level in $(HAIKU_DEBUG_LEVELS[2-]) { 91 HAIKU_DEBUG_$(level)_OBJECT_DIR_$(architecture) 92 = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) 93 debug_$(level) ] ; 94 } 95 96 # set variables for gcc header options 97 SetIncludePropertiesVariables HAIKU : _$(architecture) ; 98 99 # assembler flags 100 HAIKU_ASFLAGS_$(architecture) = ; 101 102 # C/C++ flags 103 if $(gccVersion[1]) >= 4 { 104 HAIKU_C++FLAGS_$(architecture) += -Wno-deprecated ; 105 } 106 107 switch $(cpu) { 108 case x86* : 109 # Enable use of the gcc built-in atomic functions instead of 110 # atomic_*(). The former are inlined and have thus less overhead. 111 # They are not available with gcc 2, but the header will take care 112 # of that. 113 HAIKU_DEFINES_$(architecture) += B_USE_BUILTIN_ATOMIC_FUNCTIONS ; 114 } 115 116 # warning flags 117 HAIKU_WARNING_CCFLAGS_$(architecture) 118 = -Wall -Wno-trigraphs -Wmissing-prototypes 119 -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ; 120 HAIKU_WARNING_C++FLAGS_$(architecture) = -Wall -Wno-trigraphs 121 -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align 122 -Wsign-compare -Wno-multichar ; 123 124 HAIKU_WERROR_FLAGS_$(architecture) = ; 125 126 if $(gccVersion[1]) >= 4 { 127 # -Wuninitialized gives too many false positives. 128 HAIKU_WERROR_FLAGS_$(architecture) += -Wno-error=uninitialized 129 -Wno-error=maybe-uninitialized ; 130 131 # TODO: remove the -Wno-unused-but-set-variable option 132 HAIKU_WERROR_FLAGS_$(architecture) += -Wno-unused-but-set-variable ; 133 } 134 135 # debug flags 136 local debugFlags = -ggdb ; 137 138 # debug 0: suppress asserts 139 HAIKU_DEBUG_0_CCFLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ; 140 HAIKU_DEBUG_0_C++FLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ; 141 142 local level ; 143 for level in $(HAIKU_DEBUG_LEVELS[2-]) { 144 local flags = $(debugFlags) [ FDefines DEBUG=$(level) ] ; 145 HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture) = $(flags) ; 146 HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture) = $(flags) ; 147 } 148 149 if $(gccVersion[1]) >= 3 { 150 # TODO: Temporary work-around. Should be defined in the compiler specs 151 HAIKU_LINKFLAGS_$(architecture) += -Xlinker --no-undefined ; 152 } else { 153 HAIKU_DEFINES_$(architecture) += _BEOS_R5_COMPATIBLE_ ; 154 } 155 156 # private shared kernel/libroot headers 157 HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture) 158 = [ PrivateHeaders $(DOT) system system/arch/$(cpu) ] ; 159 160 # library and executable glue code 161 local commonGlueCode = 162 <src!system!glue!$(architecture)>init_term_dyn.o 163 <src!system!glue!arch!$(HAIKU_ARCH)!$(architecture)>crti.o 164 <src!system!glue!arch!$(HAIKU_ARCH)!$(architecture)>crtn.o 165 ; 166 HAIKU_LIBRARY_BEGIN_GLUE_CODE_$(architecture) = 167 <src!system!glue!arch!$(HAIKU_ARCH)!$(architecture)>crti.o 168 <$(architecture)>crtbeginS.o 169 <src!system!glue!$(architecture)>init_term_dyn.o 170 ; 171 HAIKU_LIBRARY_END_GLUE_CODE_$(architecture) = 172 <$(architecture)>crtendS.o 173 <src!system!glue!arch!$(HAIKU_ARCH)!$(architecture)>crtn.o 174 ; 175 HAIKU_EXECUTABLE_BEGIN_GLUE_CODE_$(architecture) = 176 <src!system!glue!arch!$(HAIKU_ARCH)!$(architecture)>crti.o 177 <$(architecture)>crtbeginS.o 178 <src!system!glue!$(architecture)>start_dyn.o 179 <src!system!glue!$(architecture)>init_term_dyn.o 180 ; 181 HAIKU_EXECUTABLE_END_GLUE_CODE_$(architecture) 182 = $(HAIKU_LIBRARY_END_GLUE_CODE_$(architecture)) ; 183 184 SEARCH on <$(architecture)>crtbeginS.o <$(architecture)>crtendS.o 185 = $(HAIKU_GCC_LIB_DIR_$(architecture)) ; 186 187 # init library name map 188 local libraryGrist = "" ; 189 if $(architecture) != $(HAIKU_PACKAGING_ARCHS[1]) { 190 libraryGrist = $(architecture) ; 191 } 192 local i ; 193 for i in be bnetapi debug device game locale mail media midi midi2 194 network package root screensaver textencoding tracker 195 translation z { 196 local library = lib$(i).so ; 197 HAIKU_LIBRARY_NAME_MAP_$(architecture)_$(i) 198 = $(library:G=$(libraryGrist)) ; 199 } 200 HAIKU_LIBRARY_NAME_MAP_$(architecture)_localestub 201 = <$(architecture)>liblocalestub.a ; 202 HAIKU_LIBRARY_NAME_MAP_$(architecture)_shared 203 = <$(architecture)>libshared.a ; 204 if $(architecture) = $(HAIKU_PACKAGING_ARCHS[1]) { 205 HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server 206 = <nogrist>input_server ; 207 } else { 208 HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server 209 = <$(architecture)>input_server ; 210 } 211} 212 213 214rule KernelArchitectureSetup architecture 215{ 216 # KernelArchitectureSetup <architecture> ; 217 # 218 # Initializes the global kernel and boot loader related variables. Those 219 # don't have a packaging architecture suffix, since they are only set for 220 # the primary packaging architecture. <architecture> is the primary 221 # packaging architecture (supplied for convenience). 222 223 HAIKU_KERNEL_ARCH = $(HAIKU_ARCH) ; 224 225 local gccVersion = $(HAIKU_GCC_VERSION_$(architecture)) ; 226 local cpu = $(HAIKU_CPU_$(architecture)) ; 227 228 switch $(cpu) { 229 case ppc : 230 HAIKU_BOOT_PLATFORM ?= openfirmware ; 231 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB 232 # offset in floppy image (>= sizeof(haiku_loader)) 233 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet 234 235 case arm : 236 switch $(HAIKU_BOOT_BOARD) { 237 case beagleboard : 238 { 239 HAIKU_BOOT_PLATFORM ?= u-boot ; 240 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 241 } 242 case beaglebone : 243 { 244 HAIKU_BOOT_PLATFORM ?= u-boot ; 245 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 246 } 247 case neo_freerunner : 248 { 249 HAIKU_BOOT_PLATFORM ?= u-boot ; 250 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 251 } 252 case overo : 253 { 254 HAIKU_BOOT_PLATFORM ?= u-boot ; 255 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 256 } 257 case rpi1 : 258 { 259 HAIKU_BOOT_PLATFORM ?= u-boot ; 260 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 261 } 262 case rpi2 : 263 { 264 HAIKU_BOOT_PLATFORM ?= u-boot ; 265 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 266 } 267 case cubieboard4 : 268 { 269 HAIKU_BOOT_PLATFORM ?= u-boot ; 270 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 271 } 272 case verdex : 273 { 274 HAIKU_BOOT_PLATFORM ?= u-boot ; 275 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; 276 } 277 case * : 278 { 279 Exit "Set HAIKU_BOOT_BOARD for your target ARM device!" ; 280 } 281 } 282 283 # offset in floppy image (>= sizeof(haiku_loader)) 284 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet 285 286 case x86 : 287 HAIKU_BOOT_PLATFORM ?= bios_ia32 ; 288 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB 289 # offset in floppy image (>= sizeof(haiku_loader)) 290 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB 291 292 # nasm is required for target arch x86 293 if ! $(HAIKU_NASM) { 294 Exit "HAIKU_NASM not set. Please re-run configure." ; 295 } 296 297 case x86_64 : 298 # x86_64 completely shares the x86 bootloader. 299 HAIKU_BOOT_PLATFORM ?= bios_ia32 ; 300 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB 301 # offset in floppy image (>= sizeof(haiku_loader)) 302 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB 303 304 # x86_64 kernel source is under arch/x86. 305 HAIKU_KERNEL_ARCH = x86 ; 306 307 # nasm is required for target arch x86_64 308 if ! $(HAIKU_NASM) { 309 Exit "HAIKU_NASM not set. Please re-run configure." ; 310 } 311 312 case m68k : 313 HAIKU_BOOT_PLATFORM ?= atari_m68k ; 314 switch $(HAIKU_BOOT_PLATFORM) { 315 case atari_m68k : 316 { 317 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB 318 } 319 case amiga_m68k : 320 { 321 # for now we have trouble reading from double-sided images 322 HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 880 ; # in kB 323 } 324 } 325 # offset in floppy image (>= sizeof(haiku_loader)) 326 HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB 327 HAIKU_CONTAINER_STRIP_EXECUTABLES on 328 $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = 1 ; 329 330 case * : 331 Exit "Currently unsupported target CPU:" $(cpu) ; 332 } 333 334 # private kernel headers to be used when compiling kernel code 335 HAIKU_PRIVATE_KERNEL_HEADERS = 336 [ PrivateHeaders $(DOT) kernel libroot shared 337 kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] 338 [ ArchHeaders $(HAIKU_KERNEL_ARCH) ] 339 [ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture)) system 340 kernel ] 341 $(HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture)) 342 ; 343 344 # C/C++ flags 345 local gccBaseFlags = $(HAIKU_GCC_BASE_FLAGS_$(architecture)) 346 -finline -fno-builtin ; 347 348 if $(gccVersion[1]) >= 4 { 349 gccBaseFlags += -ffreestanding ; 350 } 351 352 local g++BaseFlags = $(gccBaseFlags) -fno-exceptions ; 353 354 if $(gccVersion[1]) >= 3 && $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 { 355 g++BaseFlags += -fno-use-cxa-atexit ; 356 } 357 358 HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(gccBaseFlags) ; 359 HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(g++BaseFlags) ; 360 HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(gccBaseFlags) ; 361 HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(g++BaseFlags) ; 362 HAIKU_BOOT_LINKFLAGS = ; 363 HAIKU_BOOT_LDFLAGS = -Bstatic ; 364 365 if $(gccVersion[1]) >= 4 { 366 HAIKU_KERNEL_C++FLAGS += -std=gnu++11 ; 367 } 368 369 HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; 370 HAIKU_KERNEL_PIC_LINKFLAGS = ; 371 HAIKU_KERNEL_ADDON_LINKFLAGS = ; 372 373 # Include embedded board-specific file. 374 if $(HAIKU_BOOT_BOARD) { 375 include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD) 376 BoardSetup ] ; 377 if $(HAIKU_BOARD_LOADER_BASE) { 378 HAIKU_BOOT_LDFLAGS += 379 --defsym BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ; 380 } 381 } 382 383 switch $(cpu) { 384 case ppc : 385 # Build a position independent PPC kernel. We need to be able to 386 # relocate the kernel, since the virtual address space layout at 387 # boot time is not fixed. 388 HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ; 389 HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; 390 391 case m68k : 392 # We don't want to have to handle emulating missing FPU opcodes for 393 # 040 and 060 in the kernel. 394 HAIKU_KERNEL_CCFLAGS += -mtune=68020-60 ; 395 HAIKU_KERNEL_C++FLAGS += -mtune=68020-60 ; 396 397 case x86 : 398 HAIKU_KERNEL_CCFLAGS += -march=pentium ; 399 HAIKU_KERNEL_C++FLAGS += -march=pentium ; 400 401 case x86_64 : 402 # Kernel lives in the top 2GB of the address space, use kernel code 403 # model. 404 HAIKU_KERNEL_PIC_CCFLAGS += -mcmodel=kernel ; 405 406 # Disable the red zone, which cannot be used in kernel code due to 407 # interrupts, and always enable the frame pointer so stack traces 408 # are correct. 409 HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ; 410 HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ; 411 HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ; 412 HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ; 413 414 # BIOS Bootloader is 32-bit. 415 if $(HAIKU_BOOT_PLATFORM) = bios_ia32 { 416 HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; 417 HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ; 418 HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ; 419 } 420 } 421 422 if $(HAIKU_BOOT_PLATFORM) = efi { 423 HAIKU_BOOT_CCFLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar -mno-red-zone 424 -maccumulate-outgoing-args -Wno-error=unused-variable ; 425 HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC -fshort-wchar -mno-red-zone 426 -maccumulate-outgoing-args -Wno-error=unused-variable ; 427 HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib -znocombreloc -nostartfiles -no-undefined ; 428 } else { 429 HAIKU_BOOT_CCFLAGS += -fno-pic ; 430 HAIKU_BOOT_C++FLAGS += -fno-pic ; 431 } 432 433 # warning flags 434 HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes 435 -Wno-multichar ; 436 HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ; 437 438 # debug flags 439 local level ; 440 for level in $(HAIKU_DEBUG_LEVELS) { 441 local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; 442 HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS 443 = $(HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture)) ; 444 HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS 445 = $(HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture)) ; 446 } 447 448 # defines 449 HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; 450 451 HAIKU_DEFINES_$(architecture) 452 += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; 453 # TODO: That doesn't need to be a general define. It's just needed for 454 # compiling (part of) the boot loader. 455 456 # kernel add-on glue code 457 HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = <$(architecture)>crtbeginS.o 458 <src!system!glue!$(architecture)>haiku_version_glue.o ; 459 HAIKU_KERNEL_ADDON_END_GLUE_CODE = <$(architecture)>crtendS.o ; 460} 461 462 463rule ArchitectureSetupWarnings architecture 464{ 465 # ArchitectureSetupWarnings <architecture> ; 466 # 467 # Sets up compiler warnings and error flags for various subdirectories for 468 # the given packaging architecture. 469 470 local cpu = $(HAIKU_CPU_$(architecture)) ; 471 switch $(cpu) { 472 case arm : 473 return ; 474 # we use #warning as placeholders for things to write... 475 case m68k : 476 return ; 477 # we use #warning as placeholders for things to write... 478 case ppc : 479 return ; 480 # we use #warning as placeholders for things to write... 481 } 482 483 # enable -Werror for certain parts of the source tree 484 HAIKU_WERROR_ARCH = $(architecture) ; 485 486 rule EnableWerror dirTokens : scope { 487 # Clang gives way more warnings than GCC, so that code won't compile 488 # with -Werror when using Clang. 489 if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 { 490 SetConfigVar WARNINGS : HAIKU_TOP $(dirTokens) : treatAsErrors 491 : $(scope) ; 492 } 493 } 494 495 # Work-around for GCC 2 problem -- despite -Wno-multichar it reports 496 # multichar warnings in headers/private/kernel/debugger_keymaps.h included 497 # by src/system/kernel/arch/x86/arch_debug_console.cpp. 498 local gccVersion = $(HAIKU_GCC_VERSION_$(architecture)) ; 499 if $(gccVersion[1]) = 2 { 500 local file = <src!system!kernel!arch!x86>arch_debug_console.o ; 501 WARNINGS on $(file) = $(WARNINGS) ; 502 } 503 504 if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { 505 # We need -integrated-as, as otherwise Clang uses GCC as assembler and 506 # passes -fheinous-gnu-extensions to GCC, which GCC does not understand 507 # then errors out. 508 AppendToConfigVar CCFLAGS : 509 HAIKU_TOP src system libroot posix glibc : 510 -integrated-as -fgnu89-inline -fheinous-gnu-extensions : global ; 511 } 512 513 EnableWerror src add-ons accelerants ; 514 EnableWerror src add-ons bluetooth ; 515 EnableWerror src add-ons decorators ; 516 EnableWerror src add-ons disk_systems ; 517 EnableWerror src add-ons input_server devices ; 518 EnableWerror src add-ons input_server filters ; 519# EnableWerror src add-ons input_server methods pen ; 520 EnableWerror src add-ons input_server methods t9 ; 521 EnableWerror src add-ons kernel bluetooth ; 522# EnableWerror src add-ons kernel bus_managers acpi ; 523 EnableWerror src add-ons kernel bus_managers agp_gart ; 524 EnableWerror src add-ons kernel bus_managers ata ; 525 EnableWerror src add-ons kernel bus_managers config_manager ; 526# EnableWerror src add-ons kernel bus_managers firewire ; 527 EnableWerror src add-ons kernel bus_managers ide ; 528 EnableWerror src add-ons kernel bus_managers isa ; 529 EnableWerror src add-ons kernel bus_managers pci ; 530 EnableWerror src add-ons kernel bus_managers ps2 ; 531 EnableWerror src add-ons kernel bus_managers random ; 532 EnableWerror src add-ons kernel bus_managers scsi ; 533 EnableWerror src add-ons kernel bus_managers tty ; 534 EnableWerror src add-ons kernel bus_managers usb ; 535 EnableWerror src add-ons kernel bus_managers virtio ; 536 EnableWerror src add-ons kernel busses agp_gart ; 537 EnableWerror src add-ons kernel busses ata ; 538 EnableWerror src add-ons kernel busses scsi ; 539 EnableWerror src add-ons kernel busses usb ; 540 EnableWerror src add-ons kernel console ; 541 EnableWerror src add-ons kernel cpu ; 542# EnableWerror src add-ons kernel debugger ; # gcc2 543# EnableWerror src add-ons kernel drivers audio ; 544 EnableWerror src add-ons kernel drivers bluetooth ; 545 EnableWerror src add-ons kernel drivers bus ; 546 EnableWerror src add-ons kernel drivers common ; 547 EnableWerror src add-ons kernel drivers disk ; 548 EnableWerror src add-ons kernel drivers dvb ; 549# EnableWerror src add-ons kernel drivers graphics ; 550 EnableWerror src add-ons kernel drivers graphics intel_extreme ; 551# EnableWerror src add-ons kernel drivers input ; 552 EnableWerror src add-ons kernel drivers joystick ; 553 EnableWerror src add-ons kernel drivers midi ; 554 EnableWerror src add-ons kernel drivers misc ; 555# EnableWerror src add-ons kernel drivers network ; 556 EnableWerror src add-ons kernel drivers ports ; 557# EnableWerror src add-ons kernel drivers power ; 558 EnableWerror src add-ons kernel drivers printer ; 559 EnableWerror src add-ons kernel drivers random ; 560 EnableWerror src add-ons kernel drivers tty ; 561 EnableWerror src add-ons kernel drivers video ; 562 EnableWerror src add-ons kernel file_systems bfs ; 563 EnableWerror src add-ons kernel file_systems cdda ; 564# EnableWerror src add-ons kernel file_systems ext2 ; 565# EnableWerror src add-ons kernel file_systems fat ; 566# EnableWerror src add-ons kernel file_systems googlefs ; 567 EnableWerror src add-ons kernel file_systems iso9660 ; 568 EnableWerror src add-ons kernel file_systems layers ; 569 EnableWerror src add-ons kernel file_systems netfs ; 570 EnableWerror src add-ons kernel file_systems nfs ; 571 EnableWerror src add-ons kernel file_systems nfs4 ; 572# EnableWerror src add-ons kernel file_systems ntfs ; 573 EnableWerror src add-ons kernel file_systems packagefs ; 574 EnableWerror src add-ons kernel file_systems ramfs ; 575# EnableWerror src add-ons kernel file_systems reiserfs ; 576 EnableWerror src add-ons kernel file_systems udf ; 577 EnableWerror src add-ons kernel file_systems userlandfs ; 578 EnableWerror src add-ons kernel generic ; 579# EnableWerror src add-ons kernel network datalink_protocols ; 580 EnableWerror src add-ons kernel network devices ; 581 EnableWerror src add-ons kernel network dns_resolver ; 582 EnableWerror src add-ons kernel network notifications ; 583 EnableWerror src add-ons kernel network ppp ; 584 EnableWerror src add-ons kernel network protocols ; 585# EnableWerror src add-ons kernel network stack ; 586 EnableWerror src add-ons kernel partitioning_systems ; 587 EnableWerror src add-ons kernel power ; 588 EnableWerror src add-ons locale ; 589 EnableWerror src add-ons mail_daemon ; 590 EnableWerror src add-ons media media-add-ons demultiplexer ; 591 EnableWerror src add-ons media media-add-ons dvb ; 592 EnableWerror src add-ons media media-add-ons esound_sink ; 593 EnableWerror src add-ons media media-add-ons finepix_webcam ; 594 EnableWerror src add-ons media media-add-ons firewire_dv ; 595 EnableWerror src add-ons media media-add-ons legacy ; 596 EnableWerror src add-ons media media-add-ons mixer ; 597 EnableWerror src add-ons media media-add-ons multi_audio ; 598 EnableWerror src add-ons media media-add-ons opensound ; 599 EnableWerror src add-ons media media-add-ons radeon ; 600 EnableWerror src add-ons media media-add-ons reader ; 601 EnableWerror src add-ons media media-add-ons tone_producer_demo ; 602 EnableWerror src add-ons media media-add-ons usb_vision ; 603# EnableWerror src add-ons media media-add-ons usb_webcam ; 604 EnableWerror src add-ons media media-add-ons video_mixer ; 605# EnableWerror src add-ons media media-add-ons video_producer_demo ; 606 EnableWerror src add-ons media media-add-ons videowindow ; 607 EnableWerror src add-ons media media-add-ons writer ; 608 EnableWerror src add-ons media plugins ac3_decoder ; 609 EnableWerror src add-ons media plugins aiff_reader ; 610 EnableWerror src add-ons media plugins ape_reader ; 611# EnableWerror src add-ons media plugins asf_reader ; 612 EnableWerror src add-ons media plugins au_reader ; 613# EnableWerror src add-ons media plugins avi_reader ; 614# EnableWerror src add-ons media plugins ffmpeg ; 615# EnableWerror src add-ons media plugins matroska ; 616# EnableWerror src add-ons media plugins mov_reader ; 617 EnableWerror src add-ons media plugins mp3_decoder ; 618# EnableWerror src add-ons media plugins mp3_reader ; 619 EnableWerror src add-ons media plugins mp4_reader ; 620 EnableWerror src add-ons media plugins musepack ; 621# EnableWerror src add-ons media plugins ogg ; 622# EnableWerror src add-ons media plugins raw_decoder ; 623# EnableWerror src add-ons media plugins speex ; 624 EnableWerror src add-ons media plugins theora ; 625 EnableWerror src add-ons media plugins vorbis ; 626# EnableWerror src add-ons media plugins wav_reader ; 627 EnableWerror src add-ons media plugins xvid_decoder ; 628 EnableWerror src add-ons print ; 629 EnableWerror src add-ons screen_savers ; 630 EnableWerror src add-ons tracker ; 631 EnableWerror src add-ons translators bmp ; 632# EnableWerror src add-ons translators exr ; 633 EnableWerror src add-ons translators gif ; 634# EnableWerror src add-ons translators hpgs ; 635 EnableWerror src add-ons translators hvif ; 636 EnableWerror src add-ons translators ico ; 637 EnableWerror src add-ons translators jpeg ; 638 EnableWerror src add-ons translators jpeg2000 ; 639 EnableWerror src add-ons translators pcx ; 640 EnableWerror src add-ons translators png ; 641 EnableWerror src add-ons translators ppm ; 642 EnableWerror src add-ons translators raw ; 643 EnableWerror src add-ons translators rtf ; 644 EnableWerror src add-ons translators sgi ; 645 EnableWerror src add-ons translators shared ; 646 EnableWerror src add-ons translators stxt ; 647 EnableWerror src add-ons translators tga ; 648 EnableWerror src add-ons translators tiff ; 649 EnableWerror src add-ons translators wonderbrush ; 650 EnableWerror src add-ons print ; 651 EnableWerror src bin desklink ; 652 EnableWerror src bin multiuser ; 653 EnableWerror src bin package ; 654 EnableWerror src bin package_repo ; 655 EnableWerror src bin pkgman ; 656 EnableWerror src libs bsd ; 657 EnableWerror src apps ; 658 EnableWerror src kits ; 659 EnableWerror src preferences ; 660 EnableWerror src servers ; 661 EnableWerror src system boot ; 662# EnableWerror src system kernel ; 663 EnableWerror src system libroot add-ons ; 664 EnableWerror src system libroot os ; 665 EnableWerror src system libroot posix locale ; 666 EnableWerror src system libroot posix wchar ; 667 EnableWerror src system runtime_loader ; 668} 669 670 671rule MultiArchIfPrimary ifValue : elseValue : architecture 672{ 673 # MultiArchIfPrimary <ifValue> : <elseValue> 674 # [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ; 675 # 676 # Returns one of the two given values depending on whether 677 # <architecture> is the primary packaging architecture. 678 679 architecture ?= $(TARGET_PACKAGING_ARCH) ; 680 681 if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) { 682 return $(ifValue) ; 683 } 684 return $(elseValue) ; 685} 686 687 688rule MultiArchConditionalGristFiles files : primaryGrist : secondaryGrist 689 : architecture 690{ 691 # MultiArchConditionalGristFiles <files> : <primaryGrist> 692 # : <secondaryGrist> [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ; 693 # 694 # Returns <files> with their grist set to either <primaryGrist> or 695 # <secondaryGrist> depending on whether <architecture> is the primary 696 # packaging architecture. 697 698 architecture ?= $(TARGET_PACKAGING_ARCH) ; 699 700 local grist = [ MultiArchIfPrimary $(primaryGrist) : $(secondaryGrist) 701 : $(architecture) ] ; 702 return $(files:G=$(grist:E=)) ; 703} 704 705 706rule MultiArchDefaultGristFiles files : gristPrefix : architecture 707{ 708 # MultiArchDefaultGristFiles <files> : <gristPrefix> 709 # [ : <architecture> = $(TARGET_PACKAGING_ARCH) ] ; 710 # 711 # Convenient shorthand for MultiArchConditionalGristFiles for the common 712 # case that for a secondary packaging architecture the packaging 713 # architecture name shall be appended to the grist while it shall be omitted 714 # for the primary packaging architecture. IOW, if architecture is the 715 # primary packaging architecture, <files> are returned with their grist set 716 # to <gristPrefix>, otherwise <files> are returned with their grist set to 717 # <gristPrefix>!<architecture> respectively <architecture> (if <gristPrefix> 718 # is empty). 719 720 architecture ?= $(TARGET_PACKAGING_ARCH) ; 721 722 local secondaryGrist = $(gristPrefix)!$(architecture) ; 723 secondaryGrist ?= $(architecture) ; 724 725 return [ MultiArchConditionalGristFiles $(files) : $(gristPrefix) : 726 $(secondaryGrist) : $(architecture) ] ; 727} 728 729 730rule MultiArchSubDirSetup architectures 731{ 732 # MultiArchSubDirSetup <architectures> ; 733 # 734 # For each of the given packaging architectures <architectures> that are 735 # in the packaging architectures configured for the build (or all configured 736 # packaging architectures, if <architectures> is empty) an object is 737 # prepared that can be used for an "on ... { ... }" block to set up subdir 738 # variables for the respective packaging architecture. Most notably 739 # TARGET_PACKAGING_ARCH, TARGET_ARCH are set to the values for the 740 # respective packaging architecture. The per-subdir variables SOURCE_GRIST, 741 # LOCATE_TARGET, LOCATE_SOURCE, SEARCH_SOURCE, *_LOCATE_TARGET, are reset. 742 # All SUBDIR* and config variables are set to the values they had when this 743 # rule was invoked. 744 745 local result ; 746 architectures ?= $(TARGET_PACKAGING_ARCHS) ; 747 local architecture ; 748 for architecture in $(architectures) { 749 if ! $(architecture) in $(TARGET_PACKAGING_ARCHS) { 750 continue ; 751 } 752 753 local architectureObject = $(architecture:G=<arch-object>) ; 754 result += $(architectureObject) ; 755 756 # Set the variables that default to the values of the respective 757 # variables for the primary architecture. 758 TARGET_PACKAGING_ARCH on $(architectureObject) = $(architecture) ; 759 760 local var ; 761 for var in TARGET_ARCH { 762 $(var) on $(architectureObject) = $($(var)_$(architecture)) ; 763 } 764 765 # Clone the current config variable values and the variables SubDir 766 # resets. 767 for var in $(AUTO_SET_UP_CONFIG_VARIABLES) SUBDIR$(SUBDIRRESET) { 768 $(var) on $(architectureObject) = $($(var)) ; 769 } 770 771 # adjust SOURCE_GRIST and HDRGRIST 772 SOURCE_GRIST on $(architectureObject) 773 = $(SOURCE_GRIST:E=)!$(architecture) ; 774 775 HDRGRIST on $(architectureObject) 776 = $(HDRGRIST:E=)!$(architecture) ; 777 778 # Adjust the subdir's object dirs that are architecture dependent. To 779 # avoid duplicating the code from SetupObjectsDir, we call it. Since it 780 # sets global variables, we set these variables on our object, call 781 # SetupObjectsDir in an "on" block, and grab the new variable values. 782 local hostTarget = HOST TARGET ; 783 local objectDirVars = 784 COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS) 785 ; 786 objectDirVars = 787 COMMON_PLATFORM_LOCATE_TARGET 788 $(hostTarget)_$(objectDirVars)_LOCATE_TARGET 789 LOCATE_TARGET 790 LOCATE_SOURCE 791 SEARCH_SOURCE 792 ; 793 794 for var in $(objectDirVars) { 795 $(var) on $(architectureObject) = ; 796 } 797 798 on $(architectureObject) { 799 SetupObjectsDir ; 800 801 for var in $(objectDirVars) { 802 $(var) on $(architectureObject) = $($(var)) ; 803 } 804 } 805 } 806 807 return $(result) ; 808} 809