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