1rule FSameTargetWithPrependedGrist 2{ 3 # SameTargetWithPrependedGrist <target> : <grist to prepend> ; 4 # 5 local target = $(1) ; 6 local gristToPrepend = $(2) ; 7 local grist = $(target:G) ; 8 9 if $(grist) { 10 grist = $(gristToPrepend)!$(grist) ; 11 } else { 12 grist = $(gristToPrepend) ; 13 } 14 15 return $(target:G=$(grist)) ; 16} 17 18rule InitScript 19{ 20 # Note: The script must have been LOCATEd before. 21 local script = $(1) ; 22 local initScript 23 = [ FSameTargetWithPrependedGrist $(script) : init-script ] ; 24 25 if ! [ on $(script) return $(__is_initialized) ] { 26 __is_initialized on $(script) = true ; 27 28 MakeLocate $(initScript) : [ on $(script) return $(LOCATE) ] ; 29 Always $(initScript) ; 30 Depends $(script) : $(initScript) ; 31 32 InitScript1 $(initScript) ; 33 } 34 35 return $(initScript) ; 36} 37 38actions InitScript1 39{ 40 rm -f $(1) 41 echo -n > $(1) 42} 43 44rule AddVariableToScript script : variable : value 45{ 46 # AddVariableToScript <script> : <variable> : <value> ; 47 48 # interpret an empty variable value as empty string 49 if ! $(value) { 50 value = "" ; 51 } 52 53 InitScript $(script) ; 54 55 VARIABLE_DEFS on $(script) += "echo $(variable)=\\\"$(value[1])\\\" >> " ; 56 57 # if the value is an array, add the other array elements 58 value = $(value[2-]) ; 59 while $(value) { 60 VARIABLE_DEFS on $(script) 61 += "echo $(variable)+=\\\" $(value[1])\\\" >> " ; 62 value = $(value[2-]) ; 63 } 64 65 AddVariableToScript1 $(script) ; 66} 67 68actions together AddVariableToScript1 69{ 70 $(VARIABLE_DEFS)$(1); 71} 72 73rule AddTargetVariableToScript 74{ 75 # AddTargetVariableToScript <script> : <target> [ : <variable> ] ; 76 # 77 local script = $(1) ; 78 local target = $(2) ; 79 local variable = $(3:E=$(target:BS)) ; 80 81 InitScript $(script) ; 82 83 # That's not completely save, if one has more than on target with the 84 # same base name. A unique pseudo target would have to be introduced 85 # to do it more correctly. 86 VARIABLE_NAME($(target:BS)) on $(script) = $(variable) ; 87 88 Depends $(script) : $(target) ; 89 AddTargetVariableToScript1 $(script) : $(target) ; 90} 91 92actions AddTargetVariableToScript1 93{ 94 echo "$(VARIABLE_NAME($(2:BS)))=\"$(2)\"" >> $(1) 95} 96 97 98#pragma mark - 99 100rule AddDirectoryToContainer container : directoryTokens 101{ 102 # AddDirectoryToContainer <container> : <directoryTokens> 103 104 local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ; 105 local directory = [ FDirName $(directoryTokens) ] ; 106 directory = $(directory:G=$(containerGrist)) ; 107 108 if ! [ on $(directory) return $(__is_on_image) ] { 109 HAIKU_INSTALL_DIRECTORIES on $(container) += $(directory) ; 110 __is_on_image on $(directory) = true ; 111 DIRECTORY_TOKENS on $(directory) = $(directoryTokens) ; 112 NotFile $(directory) ; 113 114 # mark the parent dir as not to be created 115 local parent = [ FReverse $(directoryTokens) ] ; 116 parent = [ FReverse $(parent[2-]) ] ; 117 if $(parent) { 118 parent = [ FDirName $(parent) ] ; 119 parent = $(parent:G=$(containerGrist)) ; 120 DONT_CREATE on $(parent) = true ; 121 } 122 } 123 124 return $(directory) ; 125} 126 127rule FilterContainerUpdateTargets targets : filterVariable 128{ 129 # FilterContainerUpdateTargets targets : filterVariable 130 131 local filteredTargets ; 132 local target ; 133 for target in $(targets) { 134 if [ on $(target) return $($(filterVariable)) ] { 135 filteredTargets += $(target) ; 136 } 137 } 138 return $(filteredTargets) ; 139} 140 141rule AddFilesToContainer container : directoryTokens : targets : destName 142{ 143 # AddFilesToContainer <container> : <directoryTokens> : <targets> 144 # [ : dest name ] 145 # 146 local directory = [ AddDirectoryToContainer $(container) 147 : $(directoryTokens) ] ; 148 local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ; 149 150 # If the image shall only be updated, we filter out all targets not marked 151 # accordingly. 152 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] { 153 local filterVar 154 = [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ; 155 if $(filterVar) { 156 targets = [ FilterContainerUpdateTargets $(targets) 157 : $(filterVar) ] ; 158 } 159 } 160 161 # We create a unique dummy target per target to install. 162 local installTargetsVar 163 = [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ; 164 local target ; 165 for target in $(targets) { 166 local name ; 167 if $(destName) { 168 name = $(destName) ; 169 } else { 170 name = $(target:G=:D=) ; 171 } 172 173 local destTarget = $(name:G=$(containerGrist)__$(directory:G=)) ; 174 TARGET on $(destTarget) = $(target) ; 175 INSTALL_DIR on $(destTarget) = $(directory) ; 176 $(installTargetsVar) on $(target) += $(destTarget) ; 177 TARGETS_TO_INSTALL on $(directory) += $(destTarget) ; 178 } 179} 180 181rule AddSymlinkToContainer container : directoryTokens : linkTarget : linkName 182{ 183 # AddSymlinkToContainer <container> : <directory> : <link target> 184 # [ : <link name> ] ; 185 # 186 187 # If the image shall only be updated, we don't add any symlinks. 188 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] { 189 return ; 190 } 191 192 local directory = [ AddDirectoryToContainer $(container) 193 : $(directoryTokens) ] ; 194 195 if ! $(linkName) { 196 local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ; 197 linkName = $(path[1]) ; 198 } 199 200 local link = $(directory)/$(linkName) ; 201 SYMLINK_TARGET on $(link) = $(linkTarget) ; 202 SYMLINKS_TO_INSTALL on $(directory) += $(link) ; 203} 204 205rule UnzipArchiveToContainer container : directoryTokens : zipFile 206{ 207 # UnzipArchiveToContainer <container> : <directory> : <zipFile> ] ; 208 # 209 210 local directory = [ AddDirectoryToContainer $(container) 211 : $(directoryTokens) ] ; 212 213 ZIP_FILES_TO_INSTALL on $(directory) += $(zipFile) ; 214} 215 216rule AddDriversToContainer container : relativeDirectoryTokens : targets 217{ 218 # AddDriversToContainer <container> : <relative directory> : <targets> ; 219 # 220 local directoryTokens = beos system add-ons kernel drivers dev 221 $(relativeDirectoryTokens) ; 222 223 AddFilesToContainer $(container) : beos system add-ons kernel drivers bin 224 : $(targets) ; 225 226 # If the image shall only be updated, we don't add any symlinks. 227 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] { 228 return ; 229 } 230 231 # get the relative symlink path prefix 232 local linkPrefix = ; 233 for i in $(relativeDirectoryTokens) { 234 linkPrefix += .. ; 235 } 236 linkPrefix += .. bin ; 237 238 # add the symlinks 239 local name ; 240 for name in $(targets:BS) { 241 AddSymlinkToContainer $(container) : $(directoryTokens) 242 : [ FDirName $(linkPrefix) $(name) ] : $(name) ; 243 } 244} 245 246rule AddDriverRegistrationToContainer container : relativeDirectoryTokens 247 : target : links 248{ 249 # AddDriverRegistrationToContainer <container> : <directory> 250 # : <link target> : <link names> ] ; 251 # 252 local directoryTokens = beos system add-ons kernel registration 253 $(relativeDirectoryTokens) ; 254 255 # get the relative symlink path prefix 256 local linkPrefix = ; 257 for i in $(relativeDirectoryTokens) { 258 linkPrefix += .. ; 259 } 260 linkPrefix += .. drivers bin ; 261 262 # add the symlink 263 AddSymlinkToContainer $(container) : $(directoryTokens) 264 : [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ; 265} 266 267rule AddBootModuleSymlinksToContainer container : targets 268{ 269 # AddBootModuleSymlinksToContainer <container> : <targets> ; 270 # 271 272 # If the image shall only be updated, we don't add any symlinks. 273 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] { 274 return ; 275 } 276 277 # add the symlinks 278 local installTargetsVar 279 = [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ; 280 local target ; 281 for target in $(targets) { 282 # Symlink to the first place where the target has been installed. 283 local destTarget = [ on $(target) return $($(installTargetsVar)[1]) ] ; 284 local installDir = [ on $(destTarget) return $(INSTALL_DIR) ] ; 285 286 if ! $(installDir) { 287 Echo "ERROR: AddBootModuleSymlinksToContainer: Can't create a " 288 "symlink to target" \"$(target)"\"." ; 289 Exit "ERROR: Add*ToContainer has not been invoked for it yet." ; 290 } 291 292 local name = $(target:BS) ; 293 local linkTarget = [ FDirName /boot $(installDir:G=) $(name) ] ; 294 295 AddSymlinkToContainer $(container) : beos system add-ons kernel boot 296 : $(linkTarget) : $(name) ; 297 } 298} 299 300 301rule CreateContainerMakeDirectoriesScript container : script 302{ 303 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 304 Always $(script) ; 305 306 local initScript = [ InitScript $(script) ] ; 307 308 local scriptBody 309 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 310 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 311 Depends $(scriptBody) : $(initScript) ; 312 Depends $(script) : $(scriptBody) ; 313 314 # collect the directories to create 315 local dirsToCreate ; 316 local directories = [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] ; 317 local dir ; 318 for dir in $(directories) { 319 if ! [ on $(dir) return $(DONT_CREATE) ] { 320 dirsToCreate += $(dir) ; 321 } 322 } 323 324 # If the image shall only be updated, we don't create directories. 325 if $(dirsToCreate) 326 && ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] { 327 Depends $(scriptBody) : $(dirsToCreate) ; 328 CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ; 329 330 # For directories with attributes, we convert those the specified 331 # resource files to files with attributes and add commands to the script 332 # adding the attributes to the directories. 333 for dir in $(directories) { 334 local resourceFiles = [ on $(dir) return $(ATTRIBUTE_FILES) ] ; 335 if $(resourceFiles) { 336 local dirTokens = [ on $(dir) return $(DIRECTORY_TOKENS) ] ; 337 338 # translate resources file to file with attributes 339 local attributeFile = $(script)-attributes-$(dirTokens:J=-) ; 340 ResAttr $(attributeFile) : $(resourceFiles) ; 341 342 # use a unique dummy target for this file, on which we 343 # can define the TARGET_DIR variable 344 local dummyTarget = $(script)-attributes-dummy-$(dir:G=) ; 345 NotFile $(dummyTarget) ; 346 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 347 348 Depends $(dummyTarget) : $(initScript) $(attributeFile) ; 349 Depends $(script) : $(dummyTarget) ; 350 351 AppendToContainerMakeDirectoriesScriptAttributes $(dummyTarget) 352 : $(initScript) $(attributeFile) ; 353 } 354 } 355 } 356} 357 358actions piecemeal CreateContainerMakeDirectoriesScript1 359{ 360 echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1) 361} 362 363actions AppendToContainerMakeDirectoriesScriptAttributes 364{ 365 echo \$copyAttrs "\"\${sPrefix}$(2[2])\"" \ 366 "\"\${tPrefix}$(TARGET_DIR)\"" >> $(2[1]) 367} 368 369rule CreateContainerCopyFilesScript container : script 370{ 371 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 372 Always $(script) ; 373 374 local initScript = [ InitScript $(script) ] ; 375 376 local scriptBody 377 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 378 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 379 Depends $(scriptBody) : $(initScript) ; 380 Depends $(script) : $(scriptBody) ; 381 382 local dir ; 383 for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] { 384 # filter the targets that shall be renamed; they have to be copied 385 # individually 386 local destTargets = [ on $(dir) return $(TARGETS_TO_INSTALL) ] ; 387 local remainingTargets ; 388 local destTarget ; 389 for destTarget in $(destTargets) { 390 local target = [ on $(destTarget) return $(TARGET) ] ; 391 local name = $(destTarget:BS) ; 392 if $(name) != $(target:BS) { 393 # use a unique dummy target for this file, on which we 394 # can define the TARGET_DIR variable 395 local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ; 396 NotFile $(dummyTarget) ; 397 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 398 INSTALL_TARGET_NAME on $(dummyTarget) = $(name) ; 399 400 Depends $(dummyTarget) : $(initScript) $(target) ; 401 Depends $(script) : $(dummyTarget) ; 402 403 AppendToContainerCopyFilesScriptSingleFile $(dummyTarget) 404 : $(initScript) $(target) ; 405 } else { 406 remainingTargets += $(target) ; 407 } 408 } 409 targets = $(remainingTargets) ; 410 411 if $(targets) { 412 # use a unique dummy target for this directory, on which we 413 # can define the TARGET_DIR variable 414 local dummyTarget = $(script)-dummy-$(dir:G=) ; 415 NotFile $(dummyTarget) ; 416 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 417 418 Depends $(dummyTarget) : $(initScript) $(targets) ; 419 Depends $(script) : $(dummyTarget) ; 420 421 OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ; 422 AppendToContainerCopyFilesScript $(dummyTarget) : $(targets) ; 423 } 424 425 local symlinks = [ on $(dir) return $(SYMLINKS_TO_INSTALL) ] ; 426 local symlink ; 427 for symlink in $(symlinks) { 428 NotFile $(symlink) ; 429 430 Depends $(script) : $(symlink) ; 431 Depends $(symlink) : $(initScript) ; 432 433 AddSymlinkToContainerCopyFilesScript $(symlink) : $(initScript) ; 434 } 435 } 436} 437 438actions piecemeal AppendToContainerCopyFilesScript bind OUTPUT_SCRIPT 439{ 440 echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" >> $(OUTPUT_SCRIPT) 441} 442 443actions AppendToContainerCopyFilesScriptSingleFile 444{ 445 echo \$cp "\"\${sPrefix}$(2[2])\"" \ 446 "\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1]) 447} 448 449actions AddSymlinkToContainerCopyFilesScript 450{ 451 echo \$ln -sfn "\"$(SYMLINK_TARGET)\"" "\"\${tPrefix}$(1:G=)\"" >> $(2[1]) 452} 453 454 455rule CreateContainerUnzipFilesScript container : script 456{ 457 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 458 Always $(script) ; 459 460 local initScript = [ InitScript $(script) ] ; 461 462 local scriptBody 463 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 464 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 465 Depends $(scriptBody) : $(initScript) ; 466 Depends $(script) : $(scriptBody) ; 467 468 local dir ; 469 for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] { 470 local zipFiles = [ on $(dir) return $(ZIP_FILES_TO_INSTALL) ] ; 471 local zipFile ; 472 for zipFile in $(zipFiles) { 473 # use a unique dummy target for this file, on which we 474 # can define the TARGET_DIR variable 475 local dummyTarget = $(script)-dummy-$(dir:G=)-$(zipFile) ; 476 NotFile $(dummyTarget) ; 477 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 478 479 Depends $(dummyTarget) : $(initScript) $(zipFile) ; 480 Depends $(script) : $(dummyTarget) ; 481 482 AddUnzipFileToContainerUnzipFilesScript $(dummyTarget) 483 : $(initScript) $(zipFile) ; 484 } 485 } 486} 487 488actions AddUnzipFileToContainerUnzipFilesScript 489{ 490 echo unzipFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" >> $(2[1]) 491} 492 493 494#pragma mark - Haiku Image rules 495 496rule SetUpdateHaikuImageOnly flag 497{ 498 HAIKU_CONTAINER_UPDATE_ONLY on $(HAIKU_IMAGE_CONTAINER_NAME) = $(flag) ; 499} 500 501rule IsUpdateHaikuImageOnly 502{ 503 on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_CONTAINER_UPDATE_ONLY) ; 504} 505 506rule AddDirectoryToHaikuImage directoryTokens : attributeFiles 507{ 508 # AddDirectoryToHaikuImage <directoryTokens> 509 510 local dir = [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 511 : $(directoryTokens) ] ; 512 513 if $(attributeFiles) { 514 SEARCH on $(attributeFiles) 515 += [ FDirName $(HAIKU_TOP) data image_directories ] ; 516 ATTRIBUTE_FILES on $(dir) += $(attributeFiles) ; 517 } 518 519 return $(dir) ; 520} 521 522rule AddFilesToHaikuImage directory : targets : destName 523{ 524 # AddFilesToHaikuImage <directory> : <targets> [ : dest name ] 525 526 AddFilesToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directory) 527 : $(targets) : $(destName) ; 528} 529 530rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName 531{ 532 # AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ; 533 534 AddSymlinkToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens) 535 : $(linkTarget) : $(linkName) ; 536} 537 538rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate 539{ 540 # AddSourceDirectoryToHaikuImage <dirTokens> : <alwaysUpdate> ; 541 542 # If the image shall only be updated, we update sources only, if explicitely 543 # requested. 544 if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) { 545 HAIKU_INSTALL_SOURCE_DIRS += [ FDirName $(HAIKU_TOP) $(dirTokens) ] ; 546 } 547} 548 549rule UnzipArchiveToHaikuImage dirTokens : zipFile : alwaysUpdate 550{ 551 # UnzipArchiveToHaikuImage <dirTokens> : <zipFile> : <alwaysUpdate> ; 552 553 # If the image shall only be updated, we unzip only, if explicitely 554 # requested. 555 if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) { 556 UnzipArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens) 557 : $(zipFile) ; 558 } 559} 560 561rule AddDriversToHaikuImage relativeDirectoryTokens : targets 562{ 563 # AddDriversToHaikuImage <relative directory> : <targets> ; 564 565 AddDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 566 : $(relativeDirectoryTokens) : $(targets) ; 567} 568 569rule AddDriverRegistrationToHaikuImage relativeDirectoryTokens : target : links 570{ 571 # AddDriverRegistrationToHaikuImage <directory> : <link target> : <link names> ] ; 572 573 AddDriverRegistrationToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 574 : $(relativeDirectoryTokens) : $(target) : $(links) ; 575} 576 577rule AddBootModuleSymlinksToHaikuImage targets 578{ 579 # AddBootModuleSymlinksToHaikuImage <targets> ; 580 581 AddBootModuleSymlinksToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 582 : $(targets) ; 583} 584 585rule AddOptionalHaikuImagePackages packages 586{ 587 HAIKU_OPTIONAL_PACKAGE_ADDED on $(packages) = 1 ; 588} 589 590rule IsOptionalHaikuImagePackageAdded package 591{ 592 if [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] { 593 return 1 ; 594 } 595 596 return $(HAIKU_ADD_ALL_OPTIONAL_PACKAGES) ; 597} 598 599rule InstallOptionalHaikuImagePackage package : url : dirTokens 600{ 601 # download zip file 602 local zipFile = $(package:S=.zip:G=download) ; 603 MakeLocate $(zipFile) : $(HAIKU_DOWNLOAD_DIR) ; 604 DownloadFile $(zipFile) : $(url) ; 605 606 # unzip onto image 607 UnzipArchiveToHaikuImage $(dirTokens) : $(zipFile) ; 608} 609 610 611rule CreateHaikuImageMakeDirectoriesScript script 612{ 613 CreateContainerMakeDirectoriesScript $(HAIKU_IMAGE_CONTAINER_NAME) 614 : $(script) ; 615} 616 617rule CreateHaikuImageCopyFilesScript script 618{ 619 CreateContainerCopyFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ; 620} 621 622rule CreateHaikuImageUnzipFilesScript script 623{ 624 CreateContainerUnzipFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ; 625} 626 627rule BuildHaikuImage haikuImage : scripts : isImage 628{ 629 # BuildHaikuImage <haiku image> : <scripts> : <is image> ; 630 631 if $(isImage) = 1 || $(isImage) = true { 632 IS_IMAGE on $(haikuImage) = 1 ; 633 } else { 634 IS_IMAGE on $(haikuImage) = "" ; 635 } 636 637 local mainScript = build_haiku_image ; 638 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 639 640 Depends $(haikuImage) : $(mainScript) $(scripts) ; 641 BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ; 642} 643 644actions BuildHaikuImage1 645{ 646 export isImage="$(IS_IMAGE)" 647 $(2[1]) $(2[2-]) 648} 649 650rule BuildVMWareImage vmwareImage : plainImage : imageSize 651{ 652 # BuildVMWareImage <vmware image> : <plain image> : <image size in MB> 653 654 IMAGE_SIZE on $(vmwareImage) = $(imageSize) ; 655 656 Depends $(vmwareImage) : <build>vmdkheader $(plainImage) ; 657 BuildVMWareImage1 $(vmwareImage) : <build>vmdkheader $(plainImage) ; 658} 659 660actions BuildVMWareImage1 661{ 662 rm -f $(1) 663 $(2[1]) -h 64k -i$(IMAGE_SIZE)M $(1) && 664 cat $(2[2]) >> $(1) 665} 666 667 668#pragma mark - Network Boot Archive rules 669 670rule AddDirectoryToNetBootArchive directoryTokens 671{ 672 # AddDirectoryToNetBootArchive <directoryTokens> 673 674 return [ AddDirectoryToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 675 : $(directoryTokens) ] ; 676} 677 678rule AddFilesToNetBootArchive directory : targets : destName 679{ 680 # AddFilesToNetBootArchive <directory> : <targets> [ : dest name ] 681 682 AddFilesToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(directory) 683 : $(targets) : $(destName) ; 684} 685 686rule AddSymlinkToNetBootArchive directoryTokens : linkTarget : linkName 687{ 688 # AddSymlinkToNetBootArchive <directory> : <link target> [ : <link name> ] ; 689 690 AddSymlinkToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 691 : $(directoryTokens) : $(linkTarget) : $(linkName) ; 692} 693 694rule AddDriversToNetBootArchive relativeDirectoryTokens : targets 695{ 696 # AddDriversToNetBootArchive <relative directory> : <targets> ; 697 698 AddDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 699 : $(relativeDirectoryTokens) : $(targets) ; 700} 701 702rule AddDriverRegistrationToNetBootArchive relativeDirectoryTokens : target 703 : links 704{ 705 # AddDriverRegistrationToNetBootArchive <directory> : <link target> 706 # : <link names> ] ; 707 708 AddDriverRegistrationToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 709 : $(relativeDirectoryTokens) : $(target) : $(links) ; 710} 711 712rule AddBootModuleSymlinksToNetBootArchive targets 713{ 714 # AddBootModuleSymlinksToNetBootArchive <targets> ; 715 716 AddBootModuleSymlinksToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 717 : $(targets) ; 718} 719 720rule CreateNetBootArchiveMakeDirectoriesScript script 721{ 722 CreateContainerMakeDirectoriesScript 723 $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(script) ; 724} 725 726rule CreateNetBootArchiveCopyFilesScript script 727{ 728 CreateContainerCopyFilesScript $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 729 : $(script) ; 730} 731 732rule BuildNetBootArchive archive : scripts 733{ 734 # BuildHNetBootArchive <archive> : <scripts> ; 735 736 local mainScript = build_tgz_archive ; 737 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 738 739 Depends $(archive) : $(mainScript) $(scripts) ; 740 BuildNetBootArchive1 $(archive) : $(mainScript) $(scripts) ; 741} 742 743actions BuildNetBootArchive1 744{ 745 $(2[1]) $(1) $(2[2-]) 746} 747