1#---------------------------------------------------------------------------- 2# Project: Horizon 3# File: targetdefs.om 4# 5# Copyright (C)2009-2011 Nintendo Co., Ltd. All rights reserved. 6# 7# These coded instructions, statements, and computer programs contain 8# proprietary information of Nintendo of America Inc. and/or Nintendo 9# Company Ltd., and are protected by Federal copyright law. They may 10# not be disclosed to third parties or copied or duplicated in any form, 11# in whole or in part, without the prior written consent of Nintendo. 12# 13# $Rev: 35731 $ 14#---------------------------------------------------------------------------- 15 16#---------------------------------------------------------------------------- 17# ����` 18#---------------------------------------------------------------------------- 19 20#------------------------------------------------------- 21# getOutputBaseDirectory 22# 23# �T�v 24# �^�[�Q�b�g�Ɉˑ����Ȃ��f�B���N�g���擾�� 25# 26# �Q�Ƃ��Ă���O���[�o���ϐ� 27# | 28#------------------------------------------------------- 29getOutputBaseDirectory() = 30 abs_cwd = $(absname $(CWD)) 31 #println(abs_cwd: $(abs_cwd)) 32 # �v���W�F�N�g�̃��[�g��HORIZON_ROOT�H�iSDK �̃r���h�H�j 33 if $(equal $(AROOT), $(HORIZON_ROOT)) 34 return $(dir $(HORIZON_ROOT)) 35 36 # �J�����g�f�B���N�g���� HORIZON_ROOT �̒��H 37 subdir = $(removeprefix $(HORIZON_ROOT), $(abs_cwd)) 38 if $(not $(equal $(subdir), $(abs_cwd))) 39 #println("UNDER HORIZON: "$(abs_cwd)) 40 return $(dir $(HORIZON_ROOT)) 41 42 # �v���W�F�N�g�̃��[�g�ɂ� sources �f�B���N�g��������H 43 subdir = $(removeprefix $(AROOT)\\sources\\, $(abs_cwd)) 44 if $(not $(equal $(subdir), $(abs_cwd))) 45 #println("SOURCES EXIST: "$(abs_cwd)) 46 return $(ROOT) 47 48 #println(subdir: $(subdir)) 49 # �J�����g�f�B���N�g���ɏo�� 50 return $(dir .) 51 52#------------------------------------------------------- 53# getModuleOutputSubDirectoryOf 54# 55# �T�v 56# | 57# 58# �Q�Ƃ��Ă���O���[�o���ϐ� 59# | 60#------------------------------------------------------- 61getModuleOutputSubDirectoryOf(module_dir, sub_dir) = 62 if $(defined SOURCES_BASE_ROOT) 63 module_dir = $(SOURCES_BASE_ROOT) 64 export 65 66 abs_dir = $(absname $(module_dir)) 67 subpath = $(removeprefix $(AROOT)$(DIRSEP), $(abs_dir)) 68 subpath = $(removeprefix sources$(DIRSEP), $(subpath)) 69 70 # �v���W�F�N�g�̃��[�g��HORIZON_ROOT�H�iSDK �̃r���h�H�j 71 if $(equal $(AROOT), $(HORIZON_ROOT)) 72 return $(dir $(HORIZON_ROOT)/$(sub_dir)/$(subpath)) 73 74 # �J�����g�f�B���N�g���� HORIZON_ROOT �̒��H 75 subdir = $(removeprefix $(HORIZON_ROOT), $(abs_dir)) 76 if $(not $(equal $(subdir), $(abs_dir))) 77 return $(dir $(HORIZON_ROOT)/$(sub_dir)/$(subpath)) 78 79 # �v���W�F�N�g�̃��[�g�ɂ� sources �f�B���N�g��������H 80 subdir = $(removeprefix $(AROOT)\\sources\\, $(abs_dir)) 81 if $(not $(equal $(subdir), $(abs_dir))) 82 return $(dir $(ROOT)/$(sub_dir)/$(subpath)) 83 84 # �Ώۃf�B���N�g���ɏo�� 85 return $(dir $(module_dir)$(DIRSEP)$(sub_dir)) 86 87#------------------------------------------------------- 88# getModuleImageSubDirectoryOf 89# 90# �T�v 91# | 92# 93# �Q�Ƃ��Ă���O���[�o���ϐ� 94# | 95#------------------------------------------------------- 96getModuleImageSubDirectoryOf(module_dir) = 97 return $(getModuleOutputSubDirectoryOf $(module_dir), $(SUBDIR_IMAGES)) 98 99#------------------------------------------------------- 100# getModuleObjectsSubDirectoryOf 101# 102# �T�v 103# | 104# 105# �Q�Ƃ��Ă���O���[�o���ϐ� 106# | 107#------------------------------------------------------- 108getModuleObjectsSubDirectoryOf(module_dir) = 109 return $(getModuleOutputSubDirectoryOf $(module_dir), $(SUBDIR_OBJECTS)) 110 111#------------------------------------------------------- 112# getModuleSubDirectory 113# 114# �T�v 115# �\�[�X�̃p�X�����琶�������i�[����T�u�f�B���N�g������ 116# 117# �Q�Ƃ��Ă���O���[�o���ϐ� 118# | 119#------------------------------------------------------- 120getModuleSubDirectory() = 121 if $(defined SOURCES_BASE_ROOT) 122 basedir = $(SOURCES_BASE_ROOT) 123 export 124 else 125 basedir = $(CWD) 126 export 127 #println(basedir: $(basedir)) 128 if $(equal $(ROOT), $(basedir)) 129 return . 130 131 basedir = $(absname $(basedir)) 132 subpath = $(removeprefix $(AROOT)$(DIRSEP), $(basedir)) 133 subpath = $(removeprefix sources$(DIRSEP), $(subpath)) 134 return $(subpath) 135 136#------------------------------------------------------- 137# getObjectBaseDirectory 138# 139# �T�v 140# | 141# 142# �Q�Ƃ��Ă���O���[�o���ϐ� 143# | 144#------------------------------------------------------- 145getObjectBaseDirectory() = 146 base_dir = $(getOutputBaseDirectory) 147 if $(equal ., $(base_dir)) 148 module_dir = 149 export 150 else 151 module_dir = $(getModuleSubDirectory)$(DIRSEP) 152 export 153 return $(base_dir)$(DIRSEP)$(SUBDIR_OBJECTS)$(DIRSEP)$(module_dir) 154 155 156 157 158#---------------------------------------------------------------------------- 159# �N���X��` 160#---------------------------------------------------------------------------- 161 162TargetSpec. = 163 class TargetSpec 164 165 #---------------------------------------------------------------------------- 166 # �ϐ���` 167 #---------------------------------------------------------------------------- 168 169 this.processor = $(EMPTY) 170 this.platform = $(EMPTY) 171 this.hardware = $(EMPTY) 172 this.name = $(EMPTY) 173 174 175 #---------------------------------------------------------------------------- 176 # ����` 177 #---------------------------------------------------------------------------- 178 179 #------------------------------------------------------- 180 # new 181 # 182 # �T�v 183 # | 184 # 185 # �Q�Ƃ��Ă���O���[�o���ϐ� 186 # �Ȃ� 187 #------------------------------------------------------- 188 new(name) = 189 this.name = $(name) 190 return $(this) 191 192 #------------------------------------------------------- 193 # dump 194 # 195 # �T�v 196 # | 197 # 198 # �Q�Ƃ��Ă���O���[�o���ϐ� 199 # �Ȃ� 200 #------------------------------------------------------- 201 dump() = 202 println($"name: "$(name)) 203 println($" platform: "$(platform)) 204 println($" hardware: "$(hardware)) 205 println($" processors: "$(processors)) 206 println($' ') 207 208 #------------------------------------------------------- 209 # getMacroFlags 210 # 211 # �T�v 212 # | 213 # 214 # �Q�Ƃ��Ă���O���[�o���ϐ� 215 # �Ȃ� 216 #------------------------------------------------------- 217 getMacroFlags(systemname, processor) = 218 return $(EMPTY) 219 220TargetConfig. = 221 class TargetConfig 222 223 #---------------------------------------------------------------------------- 224 # �ϐ���` 225 #---------------------------------------------------------------------------- 226 227 this.hardware = $(EMPTY) 228 this.systemname = $(EMPTY) 229 this.processor = $(EMPTY) 230 this.effort = $(EMPTY) 231 this.buildtype = $(EMPTY) 232 this.matched = true 233 234 235 236 #---------------------------------------------------------------------------- 237 # ����` 238 #---------------------------------------------------------------------------- 239 240 #------------------------------------------------------- 241 # new 242 # 243 # �T�v 244 # | 245 # 246 # �Q�Ƃ��Ă���O���[�o���ϐ� 247 # �Ȃ� 248 #------------------------------------------------------- 249 new() = 250 return $(this) 251 252 #------------------------------------------------------- 253 # dump 254 # 255 # �T�v 256 # | 257 # 258 # �Q�Ƃ��Ă���O���[�o���ϐ� 259 # �Ȃ� 260 #------------------------------------------------------- 261 dump() = 262 println($"hardware: "$(hardware)) 263 println($" processor: "$(processor)) 264 println($' ') 265 266 #------------------------------------------------------- 267 # getFullname 268 # 269 # �T�v 270 # | 271 # 272 # �Q�Ƃ��Ă���O���[�o���ϐ� 273 # �Ȃ� 274 #------------------------------------------------------- 275 getFullname() = 276 return $(hardware).$(systemname).$(processor).$(effort) 277 278 #------------------------------------------------------- 279 # getFullnameWithSystem 280 # 281 # �T�v 282 # | 283 # 284 # �Q�Ƃ��Ă���O���[�o���ϐ� 285 # | 286 #------------------------------------------------------- 287 getFullnameWithSystem(altsystemname) = 288 return $(hardware).$(altsystemname).$(processor).$(effort) 289 290 #------------------------------------------------------- 291 # getFullnameWithSystemAndEffort 292 # 293 # �T�v 294 # | 295 # 296 # �Q�Ƃ��Ă���O���[�o���ϐ� 297 # �Ȃ� 298 #------------------------------------------------------- 299 getFullnameWithSystemAndEffort(altsystemname, alteffort) = 300 return $(hardware).$(altsystemname).$(processor).$(alteffort) 301 302 #------------------------------------------------------- 303 # getScannerName 304 # 305 # �T�v 306 # | 307 # 308 # �Q�Ƃ��Ă���O���[�o���ϐ� 309 # | 310 #------------------------------------------------------- 311 getScannerName() = 312 return $(getFullname)-$(buildtype) 313 314 #------------------------------------------------------- 315 # getObjectDirectory 316 # 317 # �T�v 318 # | 319 # 320 # �Q�Ƃ��Ă���O���[�o���ϐ� 321 # | 322 #------------------------------------------------------- 323 getObjectDirectory() = 324 return $(makeDirectory $(getObjectBaseDirectory)$(DIRSEP)$(getTargetSubDirectory false)) 325 326 #------------------------------------------------------- 327 # getObjectDirectory 328 # 329 # �T�v 330 # | 331 # 332 # �Q�Ƃ��Ă���O���[�o���ϐ� 333 # | 334 #------------------------------------------------------- 335 getObjectDirectory() = 336 return $(getObjectDirectoryFeedback false) 337 338 #------------------------------------------------------- 339 # getObjectDirectoryFeedback 340 # 341 # �T�v 342 # | 343 # 344 # �Q�Ƃ��Ă���O���[�o���ϐ� 345 # | 346 #------------------------------------------------------- 347 getObjectDirectoryFeedback(isFeedback) = 348 return $(makeDirectory $(getModuleObjectsSubDirectoryOf $(CWD))$(DIRSEP)$(getTargetSubDirectory false)) 349 350 #------------------------------------------------------- 351 # getLibraryDirectory 352 # 353 # �T�v 354 # | 355 # 356 # �Q�Ƃ��Ă���O���[�o���ϐ� 357 # INSTALL_ROOT, INSTALL_ROOT_LIBRARIES, 358 # HORIZON_ROOT_LIBRARIES 359 #------------------------------------------------------- 360 getLibraryDirectory(isInstall) = 361 if $(and $(isInstall), $(defined INSTALL_ROOT)) 362 return $(makeDirectory $(INSTALL_ROOT_LIBRARIES)$(DIRSEP)$(getTargetSubDirectory true)) 363 else 364 return $(makeDirectory $(HORIZON_ROOT_LIBRARIES)$(DIRSEP)$(getTargetSubDirectory true)) 365 366 #------------------------------------------------------- 367 # isTestBuild 368 # 369 # �T�v 370 # | 371 # 372 # �Q�Ƃ��Ă���O���[�o���ϐ� 373 # BUILD_TESTS 374 #------------------------------------------------------- 375 isTestBuild() = 376 if $(not $(defined BUILD_TESTS)) 377 return false 378 else 379 return $(BUILD_TESTS) 380 381 #------------------------------------------------------- 382 # getOutputBaseDirectory 383 # 384 # �T�v 385 # | 386 # 387 # �Q�Ƃ��Ă���O���[�o���ϐ� 388 # �Ȃ� 389 #------------------------------------------------------- 390 getOutputBaseDirectory() = 391 return $(getOutputBaseDirectory) 392 393 #------------------------------------------------------- 394 # getImageDirectory 395 # 396 # �T�v 397 # | 398 # 399 # �Q�Ƃ��Ă���O���[�o���ϐ� 400 # INSTALL_ROOT_IMAGES, INSTALL_ROOT 401 #------------------------------------------------------- 402 getImageDirectory(isInstall) = 403 private.module_dir = $(getModuleSubDirectory)$(DIRSEP) 404 private.images_dir = $(EMPTY) 405 406 if $(and $(isInstall), $(isSdkTool)) 407 images_dir = $(ROOT_TARGETTOOLS) 408 return $(makeDirectory $(images_dir)$(DIRSEP)$(hardware)$(DIRSEP)$(buildtype)) 409 elseif $(and $(isInstall), $(defined INSTALL_ROOT)) 410 images_dir = $(INSTALL_ROOT_IMAGES) 411 export images_dir 412 else 413 export module_dir images_dir 414 private.base_dir = $(getOutputBaseDirectory) 415 if $(equal ., $(base_dir)) 416 module_dir = 417 images_dir = $(base_dir)$(DIRSEP)$(SUBDIR_IMAGES) 418 419 # �e�X�g���r���h����ꍇ�̓p�X�̋K�����ς�� 420 if $(isTestBuild) 421 module_dir = tests$(DIRSEP)$(gsub $(module_dir), $"\$(DIRSEP)tests?(\$(DIRSEP)|$$)", $(DIRSEP)) 422 export module_dir 423 424 return $(makeDirectory $(images_dir)$(DIRSEP)$(module_dir)$(getTargetSubDirectory false)) 425 426 #------------------------------------------------------- 427 # getImageDirectoryOf 428 # 429 # �T�v 430 # | 431 # 432 # �Q�Ƃ��Ă���O���[�o���ϐ� 433 # �Ȃ� 434 #------------------------------------------------------- 435 getImageDirectoryOf(target_dir) = 436 private.images_dir = $(getModuleImageSubDirectoryOf $(target_dir)) 437 return $(dir $(images_dir)$(DIRSEP)$(getTargetSubDirectory false)) 438 439 #------------------------------------------------------- 440 # isSdkTool 441 # 442 # �T�v 443 # | 444 # 445 # �Q�Ƃ��Ă���O���[�o���ϐ� 446 # INSTALL_SDK_TOOL 447 #------------------------------------------------------- 448 isSdkTool() = 449 if $(and $(defined INSTALL_SDK_TOOL), $(INSTALL_SDK_TOOL), \ 450 $(equal $(systemname), Process), \ 451 $(equal $(processor), MPCore), \ 452 $(equal $(effort), fast)) 453 return true 454 else 455 return false 456 457 458 #------------------------------------------------------- 459 # getOptimizeType 460 # 461 # �T�v 462 # | 463 # 464 # �Q�Ƃ��Ă���O���[�o���ϐ� 465 # �Ȃ� 466 #------------------------------------------------------- 467 getOptimizeType() = 468 private.opttype = 469 switch($(buildtype)) 470 case Debug 471 value noopt 472 case Development 473 value verbose 474 case Release 475 value release 476 default 477 value etc 478 return $(opttype) 479 480 #------------------------------------------------------- 481 # getTargetSubDirectory 482 # 483 # �T�v 484 # | 485 # 486 # �Q�Ƃ��Ă���O���[�o���ϐ� 487 # �Ȃ� 488 #------------------------------------------------------- 489 getTargetSubDirectory(isLibrary) = 490 private.subdir = $(hardware).$(systemname).$(processor) 491 if $(isLibrary) 492 return $(subdir)$(DIRSEP)$(getOptimizeType) 493 else 494 return $(subdir).$(effort)$(DIRSEP)$(buildtype) 495 496 #------------------------------------------------------- 497 # getLibraryName 498 # 499 # �T�v 500 # | 501 # 502 # �Q�Ƃ��Ă���O���[�o���ϐ� 503 # �Ȃ� 504 #------------------------------------------------------- 505 getLibraryName(name) = 506 return $(name).$(effort)$(EXT_LIB) 507 508 #------------------------------------------------------- 509 # getStaticObjectName 510 # 511 # �T�v 512 # | 513 # 514 # �Q�Ƃ��Ă���O���[�o���ϐ� 515 # �Ȃ� 516 #------------------------------------------------------- 517 getStaticObjectName(name) = 518 return $(basename $(name)).$(effort)$(EXT_OBJ) 519 520 #------------------------------------------------------- 521 # getLdscriptPath 522 # 523 # �T�v 524 # | 525 # 526 # �Q�Ƃ��Ă���O���[�o���ϐ� 527 # �Ȃ� 528 #------------------------------------------------------- 529 getLdscriptPath(name) = 530 return $(getBinaryPath $(name), $(EXT_LDS)) 531 532 #------------------------------------------------------- 533 # getMapfilePath 534 # 535 # �T�v 536 # | 537 # 538 # �Q�Ƃ��Ă���O���[�o���ϐ� 539 # �Ȃ� 540 #------------------------------------------------------- 541 getMapfilePath(name) = 542 return $(getBinaryPath $(name), $(EXT_MAP)) 543 544 #------------------------------------------------------- 545 # getLdscriptTemplatePath 546 # 547 # �T�v 548 # | 549 # 550 # �Q�Ƃ��Ă���O���[�o���ϐ� 551 # �Ȃ� 552 #------------------------------------------------------- 553 getLdscriptTemplatePath() = 554 private.base = $(ROOT_BUILD)$(DIRSEP)linker$(DIRSEP)$(platform).$(systemname).$(processor) 555 if $(and $(equal $(processor), ARM946ES) $(equal $(hardware), CTR-CTTS)) 556 return $(file $(base).Legacy.ldscript.template) 557 else 558 return $(file $(base).ldscript.template) 559 560 #------------------------------------------------------- 561 # getFeedBackPath 562 # 563 # �T�v 564 # | 565 # 566 # �Q�Ƃ��Ă���O���[�o���ϐ� 567 # �Ȃ� 568 #------------------------------------------------------- 569 getFeedBackPath() = 570 return $(file $(getImageDirectory false)$(DIRSEP)$(getOutputFilename feedback, .dat)) 571 572 #------------------------------------------------------- 573 # getBinaryPath 574 # 575 # �T�v 576 # | 577 # 578 # �Q�Ƃ��Ă���O���[�o���ϐ� 579 # �Ȃ� 580 #------------------------------------------------------- 581 getBinaryPath(name, suffix) = 582 return $(file $(getImageDirectory false)$(DIRSEP)$(getOutputFilename $(name), $(suffix))) 583 584 #------------------------------------------------------- 585 # getBinaryPathOf 586 # 587 # �T�v 588 # | 589 # 590 # �Q�Ƃ��Ă���O���[�o���ϐ� 591 # �Ȃ� 592 #------------------------------------------------------- 593 getBinaryPathOf(target_dir, name, suffix) = 594 private.sub_dir = $(getModuleImageSubDirectoryOf $(target_dir)) 595 private.img_dir = $(dir $(sub_dir)$(DIRSEP)$(getTargetSubDirectory false)) 596 return $(file $(img_dir)$(DIRSEP)$(getOutputFilename $(name), $(suffix))) 597 598 #------------------------------------------------------- 599 # getDefaultDescriptorPath 600 # 601 # �T�v 602 # | 603 # 604 # �Q�Ƃ��Ă���O���[�o���ϐ� 605 # �Ȃ� 606 #------------------------------------------------------- 607 getDefaultDescriptorPath() = 608 return $(file $(ROOT_RESOURCES)$(DIRSEP)specfiles$(DIRSEP)Application.desc) 609 610 #------------------------------------------------------- 611 # getDefaultRomSpecFile 612 # 613 # �T�v 614 # | 615 # 616 # �Q�Ƃ��Ă���O���[�o���ϐ� 617 # TARGET_MANAGER 618 #------------------------------------------------------- 619 getDefaultRomSpecFile() = 620 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 621 return $(file $(ROOT_RESOURCES)$(DIRSEP)specfiles$(DIRSEP)$(spec.getDefaultRomSpecFile $(hardware))) 622 623 #------------------------------------------------------- 624 # getDefaultBannerFile 625 # 626 # �T�v 627 # | 628 # 629 # �Q�Ƃ��Ă���O���[�o���ϐ� 630 # �Ȃ� 631 #------------------------------------------------------- 632 getDefaultBannerFile() = 633 return $(ROOT_RESOURCES)$(DIRSEP)banner$(DIRSEP)Default.bnr 634 635 #------------------------------------------------------- 636 # getDefaultIconFile 637 # 638 # �T�v 639 # | 640 # 641 # �Q�Ƃ��Ă���O���[�o���ϐ� 642 # �Ȃ� 643 #------------------------------------------------------- 644 getDefaultIconFile() = 645 return $(ROOT_RESOURCES)$(DIRSEP)banner$(DIRSEP)Default.icn 646 647 #------------------------------------------------------- 648 # getOutputFilename 649 # 650 # �T�v 651 # | 652 # 653 # �Q�Ƃ��Ă���O���[�o���ϐ� 654 # �Ȃ� 655 #------------------------------------------------------- 656 getOutputFilename(name, suffix) = 657 return $(name)$(suffix) 658 659 #------------------------------------------------------- 660 # getSuitableKernelFilename 661 # 662 # �T�v 663 # | 664 # 665 # �Q�Ƃ��Ă���O���[�o���ϐ� 666 # �Ȃ� 667 #------------------------------------------------------- 668 getSuitableKernelFilename() = 669 return $(HORIZON_ROOT_IMAGES)$(DIRSEP)kernel$(DIRSEP)$(getFullnameWithSystem Kernel)$(DIRSEP)$(buildtype)$(DIRSEP)kernel.axf 670 671 #------------------------------------------------------- 672 # getSystemCCFlags 673 # 674 # �T�v 675 # | 676 # 677 # �Q�Ƃ��Ă���O���[�o���ϐ� 678 # TARGET_MANAGER 679 #------------------------------------------------------- 680 getSystemCCFlags() = 681 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 682 return $(spec.getSystemFlags $(systemname)) 683 684 #------------------------------------------------------- 685 # getMinimumLibraries 686 # 687 # �T�v 688 # | 689 # 690 # �Q�Ƃ��Ă���O���[�o���ϐ� 691 # TARGET_MANAGER 692 #------------------------------------------------------- 693 getMinimumLibraries() = 694 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 695 return $(spec.getMinimumLibraries $(systemname), $(processor)) 696 697 #------------------------------------------------------- 698 # getDefaultLibraries 699 # 700 # �T�v 701 # | 702 # 703 # �Q�Ƃ��Ă���O���[�o���ϐ� 704 # TARGET_MANAGER 705 #------------------------------------------------------- 706 getDefaultLibraries() = 707 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 708 return $(spec.getDefaultLibraries $(systemname), $(processor)) 709 710 #------------------------------------------------------- 711 # getHostIoLibraries 712 # 713 # �T�v 714 # | 715 # 716 # �Q�Ƃ��Ă���O���[�o���ϐ� 717 # TARGET_MANAGER 718 #------------------------------------------------------- 719 getHostIoLibraries() = 720 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 721 return $(spec.getHostIoLibraries $(systemname), $(processor)) 722 723 #------------------------------------------------------- 724 # getMacroFlags 725 # 726 # �T�v 727 # | 728 # 729 # �Q�Ƃ��Ă���O���[�o���ϐ� 730 # TARGET_MANAGER 731 #------------------------------------------------------- 732 getMacroFlags() = 733 private.spec = $(TARGET_MANAGER.getSpecByHardware $(hardware)) 734 return $(spec.getMacroFlags $(systemname), $(processor)) 735 736 #------------------------------------------------------- 737 # matches 738 # 739 # �T�v 740 # | 741 # 742 # �Q�Ƃ��Ă���O���[�o���ϐ� 743 # �Ȃ� 744 #------------------------------------------------------- 745 matches(varvalue, pattern) = 746 private.regex = compileToRegex($(pattern)) 747 match($(varvalue)) 748 case $(pattern) 749 return true 750 default 751 return false 752 753 #------------------------------------------------------- 754 # isHostIoEnable 755 # 756 # �T�v 757 # | 758 # 759 # �Q�Ƃ��Ă���O���[�o���ϐ� 760 # HOST_IO_DEFAULT, HOST_IO 761 #------------------------------------------------------- 762 isHostIoEnable() = 763 if $(equal $(buildtype),Release) 764 HOST_IO_DEFAULT = false 765 export 766 else 767 HOST_IO_DEFAULT = true 768 export 769 770 if $,(HOST_IO) 771 return true 772 else 773 return false 774 775 #------------------------------------------------------- 776 # isFilterMatched 777 # 778 # �T�v 779 # | 780 # 781 # �Q�Ƃ��Ă���O���[�o���ϐ� 782 # �Ȃ� 783 #------------------------------------------------------- 784 isFilterMatched() = 785 return $(matched) 786 787HardwareTargetConfig. = 788 extends $(TargetConfig) 789 class HardwareTargetConfig 790 791 #---------------------------------------------------------------------------- 792 # ����` 793 #---------------------------------------------------------------------------- 794 795 #------------------------------------------------------- 796 # new 797 # 798 # �T�v 799 # | 800 # 801 # �Q�Ƃ��Ă���O���[�o���ϐ� 802 # �Ȃ� 803 #------------------------------------------------------- 804 new() = 805 return $(this) 806 807 #------------------------------------------------------- 808 # getFullname 809 # 810 # �T�v 811 # | 812 # 813 # �Q�Ƃ��Ă���O���[�o���ϐ� 814 # �Ȃ� 815 #------------------------------------------------------- 816 getFullname() = 817 return $(hardware).$(effort) 818 819 #------------------------------------------------------- 820 # getFullnameDetailed 821 # 822 # �T�v 823 # | 824 # 825 # �Q�Ƃ��Ă���O���[�o���ϐ� 826 # �Ȃ� 827 #------------------------------------------------------- 828 getFullnameDetailed(altsystemname, altprocessor) = 829 return $(hardware).$(altsystemname).$(altprocessor).$(effort) 830 831 #------------------------------------------------------- 832 # getTargetSubDirectory 833 # 834 # �T�v 835 # | 836 # 837 # �Q�Ƃ��Ă���O���[�o���ϐ� 838 # �Ȃ� 839 #------------------------------------------------------- 840 getTargetSubDirectory(isLibrary) = 841 if $(isLibrary) 842 return $(hardware)$(DIRSEP)$(getOptimizeType) 843 else 844 return $(hardware).$(effort)$(DIRSEP)$(buildtype) 845 846TargetManager. = 847 class TargetManager 848 849 #---------------------------------------------------------------------------- 850 # �ϐ���` 851 #---------------------------------------------------------------------------- 852 853 this.tmap = $(EMPTY) 854 855 856 857 #---------------------------------------------------------------------------- 858 # ����` 859 #---------------------------------------------------------------------------- 860 861 #------------------------------------------------------- 862 # new 863 # 864 # �T�v 865 # | 866 # 867 # �Q�Ƃ��Ă���O���[�o���ϐ� 868 # �Ȃ� 869 #------------------------------------------------------- 870 new() = 871 this.tmap = $(Map) 872 return $(this) 873 874 #------------------------------------------------------- 875 # register 876 # 877 # �T�v 878 # | 879 # 880 # �Q�Ƃ��Ă���O���[�o���ϐ� 881 # �Ȃ� 882 #------------------------------------------------------- 883 register(target) = 884 tmap = $(tmap.add $(target.hardware), $(target)) 885 return $(this) 886 887 #------------------------------------------------------- 888 # dump 889 # 890 # �T�v 891 # | 892 # 893 # �Q�Ƃ��Ă���O���[�o���ϐ� 894 # �Ȃ� 895 #------------------------------------------------------- 896 dump() = 897 tmap.foreach(k, v) 898 v.dump() 899 900 #------------------------------------------------------- 901 # getProcessors 902 # 903 # �T�v 904 # | 905 # 906 # �Q�Ƃ��Ă���O���[�o���ϐ� 907 # �Ȃ� 908 #------------------------------------------------------- 909 getProcessors(hardware) = 910 spec = $(getSpecByHardware $(hardware)) 911 return $(spec.processors) 912 913 #------------------------------------------------------- 914 # getHardwares 915 # 916 # �T�v 917 # | 918 # 919 # �Q�Ƃ��Ă���O���[�o���ϐ� 920 # �Ȃ� 921 #------------------------------------------------------- 922 getHardwares() = 923 return $(tmap.keys) 924 925 #------------------------------------------------------- 926 # getPlatform 927 # 928 # �T�v 929 # | 930 # 931 # �Q�Ƃ��Ă���O���[�o���ϐ� 932 # �Ȃ� 933 #------------------------------------------------------- 934 getPlatform(hardware) = 935 private.spec = $(getSpecByHardware $(hardware)) 936 return $(spec.platform) 937 938 #------------------------------------------------------- 939 # getSpecByHardware 940 # 941 # �T�v 942 # | 943 # 944 # �Q�Ƃ��Ă���O���[�o���ϐ� 945 # �Ȃ� 946 #------------------------------------------------------- 947 getSpecByHardware(hardware) = 948 return $(tmap.find $(hardware)) 949 950 #------------------------------------------------------- 951 # collectTargetValues 952 # 953 # �T�v 954 # | 955 # 956 # �Q�Ƃ��Ă���O���[�o���ϐ� 957 # �Ȃ� 958 #------------------------------------------------------- 959 collectTargetValues(getter) = 960 private.values = $(tmap.map $(fun k,V,$(apply $(getter), $(V)))) 961 return $(set $(values)) 962 963 #------------------------------------------------------- 964 # enumerateTargets 965 # 966 # �T�v 967 # | 968 # 969 # �Q�Ƃ��Ă���O���[�o���ϐ� 970 # TARGET_FILTER, TARGETS_LIST, TARGET_BUILDTYPES 971 # MATCHED_FAST 972 #------------------------------------------------------- 973 enumerateTargets(filterstrings, ignoreFastSmall, system_list) = 974 private.regex = $(compileToRegex $(filterstrings)) 975 private.regex_global = $(compileToRegex $(TARGET_FILTER)) 976 private.hardwares = $(getHardwares) 977 TARGETS_LIST = $(EMPTY) 978 979 foreach(buildtype, $(TARGET_BUILDTYPES)) 980 export TARGETS_LIST 981 982 foreach(hardware, $(hardwares)) 983 foreach(systemname, $(system_list)) 984 foreach(processor, $(getProcessors $(hardware))) 985 MATCHED_FAST = false 986 export MATCHED_FAST 987 988 foreach(effort, fast small) 989 private.full_name = $"$(hardware).$(systemname).$(processor).$(effort)" 990 991 if $(and $(isFilterMatch $(regex), $(full_name)), $(isFilterMatch $(regex_global), $(full_name))) 992 private.tgt = $(TargetConfig.new) 993 tgt.platform = $(getPlatform $(hardware)) 994 tgt.hardware = $(hardware) 995 tgt.systemname = $(systemname) 996 tgt.processor = $(processor) 997 tgt.effort = $(effort) 998 tgt.buildtype = $(buildtype) 999 1000 TARGETS_LIST += $(tgt) 1001 1002 if $(equal $(effort), fast) 1003 MATCHED_FAST = true 1004 elseif $(and $(not $(MATCHED_FAST)), $(ignoreFastSmall)) 1005 tgt.effort = fast 1006 tgt.matched = false 1007 1008 TARGETS_LIST += $(tgt) 1009 1010 elseif $(and $(MATCHED_FAST), $(ignoreFastSmall)) 1011 private.tgt = $(TargetConfig.new) 1012 tgt.platform = $(getPlatform $(hardware)) 1013 tgt.hardware = $(hardware) 1014 tgt.systemname = $(systemname) 1015 tgt.processor = $(processor) 1016 tgt.effort = small 1017 tgt.buildtype = $(buildtype) 1018 tgt.matched = false 1019 1020 TARGETS_LIST += $(tgt) 1021 return $(TARGETS_LIST) 1022 1023 #------------------------------------------------------- 1024 # enumerateHardwareTargets 1025 # 1026 # �T�v 1027 # | 1028 # 1029 # �Q�Ƃ��Ă���O���[�o���ϐ� 1030 # TARGETS_LIST 1031 #------------------------------------------------------- 1032 enumerateHardwareTargets(filterstrings) = 1033 private.regex = $(compileToRegex $(filterstrings)) 1034 private.regex_global = $(compileToRegex $(TARGET_FILTER)) 1035 private.hardwares = $(getHardwares) 1036 TARGETS_LIST = $(EMPTY) 1037 1038 foreach(buildtype, $(TARGET_BUILDTYPES)) 1039 export TARGETS_LIST 1040 1041 foreach(hardware, $(hardwares)) 1042 foreach(effort, fast small) 1043 private.full_name = $"$(hardware).$(effort)" 1044 1045 if $(and $(isFilterMatch $(regex), $(full_name)), $(isFilterMatch $(regex_global), $(full_name))) 1046 private.tgt = $(HardwareTargetConfig.new) 1047 tgt.platform = $(getPlatform $(hardware)) 1048 tgt.hardware = $(hardware) 1049 tgt.effort = $(effort) 1050 tgt.buildtype = $(buildtype) 1051 1052 TARGETS_LIST += $(tgt) 1053 1054 return $(TARGETS_LIST) 1055 1056 #------------------------------------------------------- 1057 # isFilterMatch 1058 # 1059 # �T�v 1060 # | 1061 # 1062 # �Q�Ƃ��Ă���O���[�o���ϐ� 1063 # �Ȃ� 1064 #------------------------------------------------------- 1065 isFilterMatch(regex, full_name) = 1066 match $(full_name) 1067 case $(regex) 1068 return true 1069 default 1070 return false 1071 1072Builder. = 1073 class Builder 1074 1075 #---------------------------------------------------------------------------- 1076 # �ϐ���` 1077 #---------------------------------------------------------------------------- 1078 1079 this.manager = $(EMPTY) 1080 1081 1082 1083 #---------------------------------------------------------------------------- 1084 # ����` 1085 #---------------------------------------------------------------------------- 1086 1087 #------------------------------------------------------- 1088 # new 1089 # 1090 # �T�v 1091 # | 1092 # 1093 # �Q�Ƃ��Ă���O���[�o���ϐ� 1094 # �Ȃ� 1095 #------------------------------------------------------- 1096 new(manager) = 1097 this.manager = $(manager) 1098 return $(this) 1099 1100 #------------------------------------------------------- 1101 # getTargets 1102 # 1103 # �T�v 1104 # | 1105 # 1106 # �Q�Ƃ��Ă���O���[�o���ϐ� 1107 # �Ȃ� 1108 #------------------------------------------------------- 1109 getTargets(targetfilters) = 1110 return $(manager.enumerateTargets $(targetfilters), false, Kernel Process) 1111 1112 #------------------------------------------------------- 1113 # getLibraryTargets 1114 # 1115 # �T�v 1116 # | 1117 # 1118 # �Q�Ƃ��Ă���O���[�o���ϐ� 1119 # �Ȃ� 1120 #------------------------------------------------------- 1121 getLibraryTargets(targetfilters) = 1122 return $(manager.enumerateTargets $(targetfilters), true, Kernel Process) 1123 1124 #------------------------------------------------------- 1125 # getHardwareTargets 1126 # 1127 # �T�v 1128 # | 1129 # 1130 # �Q�Ƃ��Ă���O���[�o���ϐ� 1131 # �Ȃ� 1132 #------------------------------------------------------- 1133 getHardwareTargets(targetfilters) = 1134 return $(manager.enumerateHardwareTargets $(targetfilters)) 1135 1136 #------------------------------------------------------- 1137 # getToolTargets 1138 # 1139 # �T�v 1140 # | 1141 # 1142 # �Q�Ƃ��Ă���O���[�o���ϐ� 1143 # TARGET_FILTER 1144 #------------------------------------------------------- 1145 getToolTargets(targetfilters) = 1146 TARGET_FILTER = WIN-IA32.* 1147 SYSTEM_LIST = Tool 1148 return $(manager.enumerateTargets *) 1149 1150 #------------------------------------------------------- 1151 # go 1152 # 1153 # �T�v 1154 # | 1155 # 1156 # �Q�Ƃ��Ă���O���[�o���ϐ� 1157 # TARGET 1158 #------------------------------------------------------- 1159 go(targetfilters, verb) = 1160 result = 1161 configs = $(getTargets $(targetfilters)) 1162 foreach(TARGET, $(configs)) 1163 result += $,(verb)) 1164 export 1165 return $(result) 1166 1167 #------------------------------------------------------- 1168 # dumpConfigList 1169 # 1170 # �T�v 1171 # | 1172 # 1173 # �Q�Ƃ��Ă���O���[�o���ϐ� 1174 # �Ȃ� 1175 #------------------------------------------------------- 1176 dumpConfigList(configs) = 1177 foreach(config, $(configs)) 1178 config.dump() 1179 1180 1181 1182#---------------------------------------------------------------------------- 1183# �ϐ���` 1184#---------------------------------------------------------------------------- 1185 1186global.TARGET_MANAGER = $(TargetManager.new) 1187 1188 1189 1190#---------------------------------------------------------------------------- 1191# �^�[�Q�b�g��`�ǂݍ��� 1192#---------------------------------------------------------------------------- 1193 1194# �ŏ��ɖ����ǂݍ��� 1195foreach(om,$(ls $(ROOT_OMAKE)/platforms/$(TARGET_PLATFORM.Name)/$(TARGET_PLATFORM.Name).targetdefs.om)) 1196 include $(removesuffix $(om)) 1197 export 1198 1199# ���ɃI�v�V������ǂݍ��� 1200foreach(om,$(ls i,$(ROOT_OMAKE)/platforms/$(TARGET_PLATFORM.Name)/$(TARGET_PLATFORM.Name).targetdefs.*.om)) 1201 include $(removesuffix $(om)) 1202 export 1203 1204global.BUILDER = $(Builder.new $(TARGET_MANAGER)) 1205 1206