1 2rule AddSharedObjectGlueCode 3{ 4 # AddSharedObjectGlueCode <target> : <isExecutable> ; 5 6 # we link with -nostdlib and add the required libs manually, when building 7 # for Haiku 8 local platform ; 9 on $(1) { 10 platform = $(PLATFORM) ; 11 if $(platform) = haiku { 12 local stdLibs = libroot.so ; 13 local beginGlue ; 14 local endGlue ; 15 if $(2) = true { 16 beginGlue += $(HAIKU_EXECUTABLE_BEGIN_GLUE_CODE) ; 17 endGlue += $(HAIKU_EXECUTABLE_END_GLUE_CODE) ; 18 } else { 19 beginGlue += $(HAIKU_LIBRARY_BEGIN_GLUE_CODE) ; 20 endGlue += $(HAIKU_LIBRARY_END_GLUE_CODE) ; 21 22 # special case for libroot: don't link it against itself 23 if $(DONT_LINK_AGAINST_LIBROOT) { 24 stdLibs = ; 25 } 26 } 27 28 LINK_BEGIN_GLUE on $(1) = $(beginGlue) ; 29 LINK_END_GLUE on $(1) = $(endGlue) ; 30 31 NEEDLIBS on $(1) = [ on $(1) return $(NEEDLIBS) ] $(stdLibs) ; 32 Depends $(1) : $(stdLibs) $(beginGlue) $(endGlue) ; 33 LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] -nostdlib 34 -Xlinker --no-undefined ; 35 } 36 } 37 38 # link against the compatibility libraries needed for the target 39 if $(platform) != host && $(TARGET_HAIKU_COMPATIBILITY_LIBS) { 40 LinkAgainst $(1) : $(TARGET_HAIKU_COMPATIBILITY_LIBS) ; 41 } 42} 43 44rule Executable 45{ 46 # Executable <name> : <sources> : <libraries> : <res> ; 47 # 48 if ! [ IsPlatformSupportedForTarget $(1) ] { 49 return ; 50 } 51 52 AddResources $(1) : $(4) ; 53 Main $(1) : $(2) ; 54 LinkAgainst $(1) : $(3) ; 55 LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ] 56 -Xlinker -soname=_APP_ ; 57 58 # we link with -nostdlib and add the required libs manually, when building 59 # for Haiku 60 AddSharedObjectGlueCode $(1) : true ; 61} 62 63rule Application 64{ 65 # Application <name> : <sources> : <libraries> : <res> ; 66 Executable $(1) : $(2) : $(3) : $(4) ; 67} 68 69rule BinCommand 70{ 71 # BinCommand <name> : <sources> : <libraries> : <res> ; 72 Executable $(1) : $(2) : $(3) : $(4) ; 73} 74 75rule StdBinCommands 76{ 77 # StdBinCommands <sources> : <libs> : <res> ; 78 local libs = $(2) ; 79 local ress = $(3) ; 80 local source ; 81 for source in $(1) 82 { 83 local target = $(source:S=) ; 84 85 BinCommand $(target) : $(source) : $(libs) : $(ress) ; 86 } 87} 88 89rule Preference 90{ 91 # Preference <name> : <sources> : <libraries> : <res> ; 92 Executable $(1) : $(2) : $(3) : $(4) ; 93} 94 95rule Server 96{ 97 # Server <name> : <sources> : <libraries> : <res> ; 98 99 Executable $(1) : $(2) : $(3) : $(4) ; 100} 101 102rule Addon target : sources : libraries : isExecutable 103{ 104 # Addon <target> : <sources> : <is executable> : <libraries> ; 105 # <target>: The add-on. 106 # <sources>: Source files. 107 # <libraries>: Libraries to be linked against. 108 # <isExecutable>: true, if the target shall be executable as well. 109 110 if ! [ IsPlatformSupportedForTarget $(target) ] { 111 return ; 112 } 113 114 Main $(target) : $(sources) ; 115 116 local linkFlags = -Xlinker -soname=\"$(target:G=)\" ; 117 if $(isExecutable) != true { 118 linkFlags = -nostart $(linkFlags) ; 119 } 120 LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] $(linkFlags) ; 121 LinkAgainst $(target) : $(libraries) ; 122 123 AddSharedObjectGlueCode $(target) : $(isExecutable) ; 124} 125 126rule Translator target : sources : libraries : isExecutable 127{ 128 # Translator <target> : <sources> : <libraries> : <isExecutable> ; 129 Addon $(target) : $(sources) : $(libraries) : $(isExecutable) ; 130} 131 132rule ScreenSaver target : sources : libraries 133{ 134 # ScreenSaver <target> : <sources> : <libraries> ; 135 Addon $(target) : $(sources) : $(libraries) : false ; 136} 137 138rule StaticLibrary 139{ 140 # StaticLibrary <lib> : <sources> : <otherObjects> ; 141 # Creates a static library from sources. 142 # <lib>: The static library to be built. 143 # <sources>: List of source files. 144 # <otherObjects>: List of additional object files. 145 # 146 local lib = $(1) ; 147 local sources = [ FGristFiles $(2) ] ; 148 local otherObjects = $(3) ; 149 local objects = $(sources:S=$(SUFOBJ)) ; 150 151 if ! [ IsPlatformSupportedForTarget $(1) ] { 152 return ; 153 } 154 155 InheritPlatform $(objects) : $(lib) ; 156 157 StaticLibraryFromObjects $(lib) : $(objects) $(otherObjects) ; 158 Objects $(2) ; 159} 160 161rule StaticLibraryFromObjects 162{ 163 if ! [ IsPlatformSupportedForTarget $(1) ] { 164 return ; 165 } 166 167 LibraryFromObjects $(1) : $(2) ; 168} 169 170rule AssembleNasm 171{ 172 Depends $(<) : $(>) ; 173} 174 175actions AssembleNasm 176{ 177 if test $(ASFLAGS) ; then 178 $(HAIKU_YASM) -d $(ASFLAGS) -f elf32 -o $(1) $(2); 179 else 180 $(HAIKU_YASM) -f elf32 -o $(1) $(2); 181 fi 182} 183 184rule Ld 185{ 186 # Ld <name> : <objs> : <linkerscript> : <flags> ; 187 # 188 local target = $(1) ; 189 local objects = $(2) ; 190 local linkerScript = $(3) ; 191 local linkerFlags = $(4) ; 192 193 if $(linkerScript) { 194 linkerFlags += --script=$(linkerScript) ; 195 } 196 197 on $(target) { 198 if $(PLATFORM) = host { 199 LINK on $(target) = $(HOST_LD) ; 200 LINKFLAGS on $(target) = $(HOST_LDFLAGS) $(LINKFLAGS) $(linkerFlags) ; 201 } else { 202 LINK on $(target) = $(TARGET_LD) ; 203 LINKFLAGS on $(target) = $(TARGET_LDFLAGS) $(LINKFLAGS) 204 $(linkerFlags) ; 205 } 206 207 NEEDLIBS on $(target) = $(NEEDLIBS) ; 208 LINKLIBS on $(target) = $(LINKLIBS) ; 209 } 210 211 LocalClean clean : $(target) ; 212 LocalDepends all : $(target) ; 213 Depends $(target) : $(objects) ; 214 215 MakeLocateDebug $(target) ; 216 217 on $(1) XRes $(1) : $(RESFILES) ; 218 if ! [ on $(1) return $(DONT_USE_BEOS_RULES) ] { 219 SetType $(1) ; 220 MimeSet $(1) ; 221 SetVersion $(1) ; 222 } 223} 224 225actions Ld 226{ 227 $(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS) 228} 229 230rule CreateAsmStructOffsetsHeader header : source 231{ 232 # CreateAsmStructOffsetsHeader header : source 233 # 234 # Grist will be added to both header and source. 235 236 header = [ FGristFiles $(header) ] ; 237 source = [ FGristFiles $(source) ] ; 238 239 # find out which headers, defines, etc. to use 240 local headers ; 241 local sysHeaders ; 242 local defines ; 243 local flags ; 244 local includesSeparator ; 245 local localIncludesOption ; 246 local systemIncludesOption ; 247 248 on $(header) { # use on $(1) variable values 249 if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) { 250 return ; 251 } 252 253 # headers and defines 254 headers = $(HAIKU_CONFIG_HEADERS) $(SEARCH_SOURCE) $(SUBDIRHDRS) 255 $(HDRS) ; 256 sysHeaders = $(SUBDIRSYSHDRS) $(SYSHDRS) ; 257 defines = $(DEFINES) ; 258 259 if $(PLATFORM) = host { 260 sysHeaders += $(HOST_HDRS) ; 261 defines += $(HOST_DEFINES) ; 262 263 if $(USES_BE_API) { 264 sysHeaders += $(HOST_BE_API_HEADERS) ; 265 } 266 267 } else { 268 sysHeaders += $(TARGET_HDRS) ; 269 defines += $(TARGET_DEFINES) ; 270 } 271 272 # optimization flags 273 if $(DEBUG) = 0 { 274 flags += $(OPTIM) ; 275 } else { 276 flags += -O0 ; 277 } 278 279 if $(PLATFORM) = host { 280 # warning flags 281 if $(WARNINGS) != 0 { 282 flags += $(HOST_WARNING_C++FLAGS) ; 283 } 284 285 # debug and other flags 286 flags += $(HOST_C++FLAGS) $(HOST_DEBUG_$(DEBUG)_C++FLAGS) 287 $(SUBDIRC++FLAGS) $(C++FLAGS) ; 288 289 if $(USES_BE_API) { 290 flags += $(HOST_BE_API_C++FLAGS) ; 291 } 292 293 C++ on $(header) = $(HOST_C++) ; 294 295 includesSeparator = $(HOST_INCLUDES_SEPARATOR) ; 296 localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ; 297 systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ; 298 299 } else { 300 # warning flags 301 if $(WARNINGS) != 0 { 302 flags += $(TARGET_WARNING_C++FLAGS) ; 303 } 304 305 # debug and other flags 306 flags += $(TARGET_C++FLAGS) $(TARGET_DEBUG_$(DEBUG)_C++FLAGS) 307 $(SUBDIRC++FLAGS) $(C++FLAGS) ; 308 309 C++ on $(header) = $(TARGET_C++) ; 310 311 includesSeparator = $(TARGET_INCLUDES_SEPARATOR) ; 312 localIncludesOption = $(TARGET_LOCAL_INCLUDES_OPTION) ; 313 systemIncludesOption = $(TARGET_SYSTEM_INCLUDES_OPTION) ; 314 } 315 } 316 317 # locate object, search for source, and set on target variables 318 319 Depends $(header) : $(source) ; 320 SEARCH on $(source) += $(SEARCH_SOURCE) ; 321 MakeLocateArch $(header) ; 322 LocalClean clean : $(header) ; 323 324 HDRRULE on $(source) = HdrRule ; 325 HDRSCAN on $(source) = $(HDRPATTERN) ; 326 HDRSEARCH on $(source) = $(headers) $(sysHeaders) $(STDHDRS) ; 327 HDRGRIST on $(source) = $(HDRGRIST) ; 328 329 C++FLAGS on $(header) = $(flags) ; 330 CCHDRS on $(header) = [ FIncludes $(headers) : $(localIncludesOption) ] 331 $(includesSeparator) 332 [ FSysIncludes $(sysHeaders) : $(systemIncludesOption) ] ; 333 CCDEFS on $(header) = [ FDefines $(defines) ] ; 334 335 CreateAsmStructOffsetsHeader1 $(header) : $(source) ; 336} 337 338actions CreateAsmStructOffsetsHeader1 339{ 340 $(C++) -S "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o - \ 341 | grep "#define" | sed -e 's/[\$\#]\([0-9]\)/\1/' > "$(1)" 342} 343 344rule MergeObjectFromObjects 345{ 346 # MergeObjectFromObjects <name> : <objects> : <other objects> ; 347 # Merges object files to an object file. 348 # <name>: Name of the object file to create. No grist will be added. 349 # <objects>: Object files to be merged. Grist will be added. 350 # <other objects>: Object files or static libraries to be merged. No grist 351 # will be added. 352 # 353 local objects = [ FGristFiles $(2) ] ; 354 355 on $(1) { 356 if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) { 357 return ; 358 } 359 360 if $(PLATFORM) = host { 361 LINK on $(1) = $(HOST_LD) ; 362 LINKFLAGS on $(target) = $(HOST_LDFLAGS) ; 363 } else { 364 LINK on $(1) = $(TARGET_LD) ; 365 LINKFLAGS on $(target) = $(TARGET_LDFLAGS) ; 366 } 367 } 368 369 MakeLocateDebug $(1) ; 370 Depends $(1) : $(objects) ; 371 Depends $(1) : $(3) ; 372 LocalDepends obj : $(1) ; 373 MergeObjectFromObjects1 $(1) : $(objects) $(3) ; 374} 375 376actions MergeObjectFromObjects1 377{ 378 $(LINK) $(LINKFLAGS) -r $(2) -o $(1) ; 379} 380 381rule MergeObject 382{ 383 # MergeObject <name> : <sources> : <other objects> ; 384 # Compiles source files and merges the object files to an object file. 385 # <name>: Name of the object file to create. No grist will be added. 386 # <sources>: Sources to be compiled. Grist will be added. 387 # <other objects>: Object files or static libraries to be merged. No grist 388 # will be added. 389 # 390 local target = $(1) ; 391 local sources = [ FGristFiles $(2) ] ; 392 local otherObjects = $(3) ; 393 local objects = $(sources:S=$(SUFOBJ)) ; 394 395 if ! [ IsPlatformSupportedForTarget $(1) ] { 396 return ; 397 } 398 399 InheritPlatform $(objects) : $(target) ; 400 Objects $(sources) ; 401 MergeObjectFromObjects $(target) : $(objects) : $(otherObjects) ; 402} 403 404rule SharedLibraryFromObjects 405{ 406 # SharedLibraryFromObjects <lib> : <objects> : <libraries> ; 407 # 408 local _lib = $(1) ; 409 410 if ! [ IsPlatformSupportedForTarget $(1) ] { 411 return ; 412 } 413 414 local soname = [ on $(_lib) return $(HAIKU_SONAME) ] ; 415 soname ?= $(_lib:BS) ; 416 417 MainFromObjects $(_lib) : $(2) ; 418 LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ] 419 -nostart -Xlinker -soname=\"$(soname)\" ; 420 LinkAgainst $(_lib) : $(3) ; 421 422 AddSharedObjectGlueCode $(_lib) : false ; 423} 424 425rule SharedLibrary 426{ 427 # SharedLibrary <lib> : <sources> : <libraries> ; 428 local lib = $(1) ; 429 local sources = [ FGristFiles $(2) ] ; 430 local objects = $(sources:S=$(SUFOBJ)) ; 431 local libs = $(3) ; 432 433 if ! [ IsPlatformSupportedForTarget $(1) ] { 434 return ; 435 } 436 437 InheritPlatform $(objects) : $(lib) ; 438 Objects $(sources) ; 439 SharedLibraryFromObjects $(lib) : $(objects) : $(libs) ; 440} 441 442rule LinkAgainst 443{ 444 # LinkAgainst <name> : <libs> [ : <mapLibs> ] ; 445 # Valid elements for <libs> are e.g. "be" or "libtranslation.so" or 446 # "/boot/.../libfoo.so". If the basename starts with "lib" or the thingy 447 # has a dirname or grist, it is added to the NEEDLIBS variable (i.e. the 448 # file will be bound!), otherwise it is prefixed "-l" and added to 449 # LINKLIBS. If you want to specify a target that isn't a library and 450 # also has neither grist nor a dirname, you can prepend "<nogrist>" as 451 # grist; it will be stripped by this rule. 452 # <mapLibs> specifies whether the to translate library names (e.g. "be" 453 # to "libbe.so" in case of target platform "haiku"). Defaults to "true". 454 # 455 local target = $(1) ; 456 local libs = $(2) ; 457 local mapLibs = $(3:E=true) ; 458 459 on $(target) { 460 # map libraries, if desired and target platform is Haiku 461 if $(PLATFORM) != host && $(mapLibs) = true 462 && $(TARGET_LIBRARY_NAME_MAP) { 463 local mappedLibs ; 464 465 for i in $(libs) { 466 local mapped = $($(TARGET_LIBRARY_NAME_MAP)_$(i)) ; 467 mapped ?= $(i) ; 468 mappedLibs += $(mapped) ; 469 } 470 471 libs = $(mappedLibs) ; 472 } 473 474 local linkLibs ; 475 local needLibs ; 476 477 for i in $(libs) 478 { 479 local isfile = ; 480 if $(i:D) || $(i:G) { 481 isfile = true ; 482 if $(i:G) = <nogrist> { 483 i = $(i:G=) ; 484 } 485 } else { 486 switch $(i:B) 487 { 488 # XXX: _APP_ and _KERNEL_ should not be needed for ELF. 489 case _APP_ : isfile = true ; 490 case _KERNEL_ : isfile = true ; 491 case lib* : isfile = true ; 492 case * : isfile = ; 493 } 494 if ! $(isfile) && ( $(i:S) = .so || $(i:S) = .a ) { 495 isfile = true ; 496 } 497 } 498 499 if $(isfile) { 500 needLibs += $(i) ; 501 } else { 502 linkLibs += $(i) ; 503 } 504 } 505 506 NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ; 507 LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ; 508 509 if $(needLibs) && ! $(NO_LIBRARY_DEPENDENCIES) { 510 Depends $(1) : $(needLibs) ; 511 } 512 } 513} 514 515rule AddResources 516{ 517 # AddResources <name> : <resourcefiles> ; 518 519 # add grist to the resource files which don't have any yet 520 local resfiles ; 521 local file ; 522 for file in $(2) { 523 if ! $(file:G) { 524 file = [ FGristFiles $(file) ] ; 525 } 526 resfiles += $(file) ; 527 } 528 529 SEARCH on $(resfiles) += $(SEARCH_SOURCE) ; 530 531 for file in $(resfiles) { 532 if $(file:S) = .rdef { 533 local rdef = $(file) ; 534 file = $(rdef:S=.rsrc) ; 535 ResComp $(file) : $(rdef) ; 536 } 537 InheritPlatform $(file) : $(1) ; 538 RESFILES on $(1) += $(file) ; 539 } 540} 541 542rule SetVersionScript target : versionScript 543{ 544 # SetVersionScript <target> : <versionScript> 545 # 546 # Sets the version script for <target>. Grist will be added to 547 # <versionScript> and SEARCH will be set on it. 548 549 versionScript = [ FGristFiles $(versionScript) ] ; 550 551 SEARCH on $(versionScript) += $(SEARCH_SOURCE) ; 552 553 VERSION_SCRIPT on $(target) = $(versionScript) ; 554 Depends $(target) : $(versionScript) ; 555} 556 557rule BuildPlatformObjects 558{ 559 # Usage BuildPlatformObjects <sources> ; 560 # <sources> The sources. 561 # 562 local sources = [ FGristFiles $(1) ] ; 563 local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; 564 565 PLATFORM on $(objects) = host ; 566 SUPPORTED_PLATFORMS on $(objects) = host ; 567 568 Objects $(sources) ; 569} 570 571actions CygwinExtensionFix 572{ 573 if test -f $(1).exe ; then 574 rm -f $(1) 575 mv $(1).exe $(1) 576 fi 577} 578 579rule BuildPlatformMain 580{ 581 # Usage BuildPlatformMain <target> : <sources> : <libraries> ; 582 # <target> The executable/library. 583 # <sources> The sources. 584 # <libraries> Libraries to link against. 585 # 586 local target = $(1) ; 587 local sources = $(2) ; 588 local libs = $(3) ; 589 local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; 590 591 PLATFORM on $(target) = host ; 592 SUPPORTED_PLATFORMS on $(target) = host ; 593 DONT_USE_BEOS_RULES on $(target) = true ; 594 595 local usesBeAPI = [ on $(target) return $(USES_BE_API) ] ; 596 if $(usesBeAPI) { 597 # propagate the flag to the objects 598 USES_BE_API on $(objects) = $(usesBeAPI) ; 599 600 # add the build libroot 601 if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { 602 local libroot = [ on $(target) return $(HOST_LIBROOT) ] ; 603 Depends $(target) : $(libroot) ; 604 NEEDLIBS on $(target) += $(libroot) ; 605 } 606 } 607 608 Main $(target) : $(sources) ; 609 LinkAgainst $(target) : $(libs) ; 610 if $(HOST_PLATFORM) = cygwin { 611 # Cygwin gcc adds the ".exe" extension. We cannot force 612 # jam to use SUFEXE as haiku target executables are not 613 # supposed to have this extension, thus finding 614 # dependencies will fail for these. 615 # The hack is to remove the extension after a successful 616 # build of the Target. 617 CygwinExtensionFix $(target) ; 618 } 619} 620 621rule BuildPlatformSharedLibrary 622{ 623 # Usage BuildPlatformSharedLibrary <target> : <sources> : <libraries> ; 624 # <target> The library. 625 # <sources> The sources. 626 # <libraries> Libraries to link against. 627 # 628 local target = $(1) ; 629 local sources = $(2) ; 630 local libs = $(3) ; 631 632 BuildPlatformMain $(target) : $(sources) : $(libs) ; 633 634 if $(HOST_PLATFORM) = darwin { 635 LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] 636 -dynamic -dynamiclib -Xlinker -flat_namespace ; 637 } else if $(HOST_PLATFORM) = cygwin { 638 LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] 639 -shared -Xlinker --allow-multiple-definition ; 640 } else { 641 LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] 642 -shared -Xlinker -soname=\"$(target:G=)\" ; 643 } 644 645 local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; 646 CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; 647 C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; 648} 649 650rule BuildPlatformMergeObject 651{ 652 # BuildPlatformMergeObject <name> : <sources> : <other objects> ; 653 # Compiles source files and merges the object files to an object file. 654 # <name>: Name of the object file to create. No grist will be added. 655 # <sources>: Sources to be compiled. Grist will be added. 656 # <other objects>: Object files or static libraries to be merged. No grist 657 # will be added. 658 # 659 local target = $(1) ; 660 local sources = $(2) ; 661 local otherObjects = $(3) ; 662 local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; 663 664 PLATFORM on $(target) = host ; 665 SUPPORTED_PLATFORMS on $(target) = host ; 666 667 local usesBeAPI = [ on $(target[1]) return $(USES_BE_API) ] ; 668 if $(usesBeAPI) { 669 # propagate the flag to the objects 670 USES_BE_API on $(objects) = $(usesBeAPI) ; 671 } 672 673 MergeObject $(target) : $(sources) : $(otherObjects) ; 674} 675 676rule BuildPlatformMergeObjectPIC target : sources : otherObjects 677{ 678 # BuildPlatformMergeObjectPIC <name> : <sources> : <other objects> ; 679 # Compiles source files and merges the object files to an object file. 680 # Same as BuildPlatformMergeObject rule but adds position-independent 681 # flags to the compiler (if any). 682 # <name>: Name of the object file to create. No grist will be added. 683 # <sources>: Sources to be compiled. Grist will be added. 684 # <other objects>: Object files or static libraries to be merged. No grist 685 # will be added. 686 # 687 ObjectCcFlags $(sources) : $(HOST_PIC_CCFLAGS) ; 688 ObjectC++Flags $(sources) : $(HOST_PIC_C++FLAGS) ; 689 690 BuildPlatformMergeObject $(target) : $(sources) : $(otherObjects) ; 691} 692 693rule BuildPlatformStaticLibrary lib : sources : otherObjects 694{ 695 # BuildPlatformStaticLibrary <lib> : <sources> ; 696 # Creates a static library from sources. 697 # <lib>: The static library to be built. 698 # <sources>: List of source files. 699 # <otherObjects>: List of additional object files. 700 # 701 702 local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; 703 704 PLATFORM on $(lib) = host ; 705 SUPPORTED_PLATFORMS on $(lib) = host ; 706 707 local usesBeAPI = [ on $(lib) return $(USES_BE_API) ] ; 708 if $(usesBeAPI) { 709 # propagate the flag to the objects 710 USES_BE_API on $(objects) = $(usesBeAPI) ; 711 } 712 713 StaticLibrary $(lib) : $(sources) : $(otherObjects) ; 714} 715 716