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) $(1) 41 touch $(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)=\\\" \\\$$(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 141 142rule IncludeAllTargetsInContainer container 143{ 144 local filterVar 145 = [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ; 146 if $(filterVar) { 147 return $($(filterVar)) ; 148 } 149 150 return ; 151} 152 153 154rule AddFilesToContainer container : directoryTokens : targets : destName 155{ 156 # AddFilesToContainer <container> : <directoryTokens> : <targets> 157 # [ : dest name ] 158 # 159 local directory = [ AddDirectoryToContainer $(container) 160 : $(directoryTokens) ] ; 161 local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ; 162 163 # If the image shall only be updated, we filter out all targets not marked 164 # accordingly. 165 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 166 && ! [ IncludeAllTargetsInContainer $(container) ] { 167 local filterVar 168 = [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ; 169 if $(filterVar) { 170 targets = [ FilterContainerUpdateTargets $(targets) 171 : $(filterVar) ] ; 172 } 173 } 174 175 # We create a unique dummy target per target to install. 176 local installTargetsVar 177 = [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ; 178 local target ; 179 for target in $(targets) { 180 local name ; 181 if $(destName) { 182 name = $(destName) ; 183 } else { 184 name = $(target:G=:D=) ; 185 } 186 187 local destTarget = $(name:G=$(containerGrist)__$(directory:G=)) ; 188 TARGET on $(destTarget) = $(target) ; 189 INSTALL_DIR on $(destTarget) = $(directory) ; 190 $(installTargetsVar) on $(target) += $(destTarget) ; 191 TARGETS_TO_INSTALL on $(directory) += $(destTarget) ; 192 } 193} 194 195rule FFilesInContainerDirectory container : directoryTokens 196{ 197 local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ; 198 local directory = [ FDirName $(directoryTokens) ] ; 199 directory = $(directory:G=$(containerGrist)) ; 200 201 if [ on $(directory) return $(__is_on_image) ] { 202 on $(directory) return $(TARGETS_TO_INSTALL) ; 203 } 204 205 return ; 206} 207 208rule AddSymlinkToContainer container : directoryTokens : linkTarget : linkName 209{ 210 # AddSymlinkToContainer <container> : <directory> : <link target> 211 # [ : <link name> ] ; 212 # 213 214 # If the image shall only be updated, we don't add any symlinks. 215 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 216 && ! [ IncludeAllTargetsInContainer $(container) ] { 217 return ; 218 } 219 220 local directory = [ AddDirectoryToContainer $(container) 221 : $(directoryTokens) ] ; 222 223 if ! $(linkName) { 224 local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ; 225 linkName = $(path[1]) ; 226 } 227 228 local link = $(directory)/$(linkName) ; 229 SYMLINK_TARGET on $(link) = $(linkTarget) ; 230 SYMLINKS_TO_INSTALL on $(directory) += $(link) ; 231} 232 233rule FSymlinksInContainerDirectory container : directoryTokens 234{ 235 local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ; 236 local directory = [ FDirName $(directoryTokens) ] ; 237 directory = $(directory:G=$(containerGrist)) ; 238 239 if [ on $(directory) return $(__is_on_image) ] { 240 on $(directory) return $(SYMLINKS_TO_INSTALL) ; 241 } 242 243 return ; 244} 245 246rule CopyDirectoryToContainer container : directoryTokens : sourceDirectory 247 : targetDirectoryName : excludePatterns : alwaysUpdate 248{ 249 # CopyDirectoryToContainer <container> : <directoryTokens> 250 # : <sourceDirectory> : <targetDirectoryName> : <excludePatterns> 251 # : <alwaysUpdate> ; 252 # 253 254 # If the image shall only be updated, we don't copy any directories 255 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 256 && ! [ IncludeAllTargetsInContainer $(container) ] 257 && ! $(alwaysUpdate) { 258 return ; 259 } 260 261 if ! $(targetDirectoryName) { 262 local path = [ FReverse [ FSplitPath $(sourceDirectory) ] ] ; 263 targetDirectoryName = $(path[1]) ; 264 } 265 266 local directory = [ AddDirectoryToContainer $(container) 267 : $(directoryTokens) $(targetDirectoryName) ] ; 268 269 local targetDir = $(directory)/-/$(sourceDirectory) ; 270 EXCLUDE_PATTERNS on $(targetDir) = $(excludePatterns) ; 271 SOURCE_DIRECTORY on $(targetDir) = $(sourceDirectory) ; 272 TARGET_DIRECTORY on $(targetDir) = $(directory) ; 273 DIRECTORIES_TO_INSTALL on $(directory) += $(targetDir) ; 274} 275 276rule UnzipArchiveToContainer container : directoryTokens : zipFile 277{ 278 # UnzipArchiveToContainer <container> : <directory> : <zipFile> ] ; 279 # 280 281 local directory = [ AddDirectoryToContainer $(container) 282 : $(directoryTokens) ] ; 283 284 ZIP_FILES_TO_INSTALL on $(directory) += $(zipFile) ; 285} 286 287rule AddDriversToContainer container : relativeDirectoryTokens : targets 288{ 289 # AddDriversToContainer <container> : <relative directory> : <targets> ; 290 # 291 local directoryTokens = system add-ons kernel drivers dev 292 $(relativeDirectoryTokens) ; 293 294 AddFilesToContainer $(container) : system add-ons kernel drivers bin 295 : $(targets) ; 296 297 # If the image shall only be updated, we don't add any symlinks. 298 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 299 && ! [ IncludeAllTargetsInContainer $(container) ] { 300 return ; 301 } 302 303 # get the relative symlink path prefix 304 local linkPrefix = ; 305 for i in $(relativeDirectoryTokens) { 306 linkPrefix += .. ; 307 } 308 linkPrefix += .. bin ; 309 310 # add the symlinks 311 local name ; 312 for name in $(targets:BS) { 313 AddSymlinkToContainer $(container) : $(directoryTokens) 314 : [ FDirName $(linkPrefix) $(name) ] : $(name) ; 315 } 316} 317 318rule AddNewDriversToContainer container : relativeDirectoryTokens 319 : targets 320{ 321 # AddNewDriversToContainer <container> : <directory> : <targets> ; 322 # 323 local directoryTokens = system add-ons kernel drivers 324 $(relativeDirectoryTokens) ; 325 326 AddFilesToContainer $(container) : $(directoryTokens) 327 : $(targets) ; 328} 329 330rule AddBootModuleSymlinksToContainer container : targets 331{ 332 # AddBootModuleSymlinksToContainer <container> : <targets> ; 333 # 334 335 # If the image shall only be updated, we don't add any symlinks. 336 if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 337 && ! [ IncludeAllTargetsInContainer $(container) ] { 338 return ; 339 } 340 341 # add the symlinks 342 local installTargetsVar 343 = [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ; 344 local target ; 345 for target in $(targets) { 346 # Symlink to the first place where the target has been installed. 347 local destTarget = [ on $(target) return $($(installTargetsVar)[1]) ] ; 348 local installDir = [ on $(destTarget) return $(INSTALL_DIR) ] ; 349 350 if ! $(installDir) { 351 Echo "ERROR: AddBootModuleSymlinksToContainer: Can't create a " 352 "symlink to target" \"$(target)"\"." ; 353 Exit "ERROR: Add*ToContainer has not been invoked for it yet." ; 354 } 355 356 local name = $(target:BS) ; 357 local linkTarget = [ FDirName /boot $(installDir:G=) $(name) ] ; 358 359 AddSymlinkToContainer $(container) : system add-ons kernel boot 360 : $(linkTarget) : $(name) ; 361 } 362} 363 364 365rule CreateContainerMakeDirectoriesScript container : script 366{ 367 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 368 Always $(script) ; 369 370 local initScript = [ InitScript $(script) ] ; 371 372 local scriptBody 373 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 374 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 375 Depends $(scriptBody) : $(initScript) ; 376 Depends $(script) : $(scriptBody) ; 377 378 # collect the directories to create 379 local dirsToCreate ; 380 local directories = [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] ; 381 local dir ; 382 for dir in $(directories) { 383 if ! [ on $(dir) return $(DONT_CREATE) ] { 384 dirsToCreate += $(dir) ; 385 } 386 } 387 388 # If the image shall only be updated, we don't create directories. 389 if $(dirsToCreate) 390 && ( ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] 391 || [ IncludeAllTargetsInContainer $(container) ] ) { 392 Depends $(scriptBody) : $(dirsToCreate) ; 393 CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ; 394 395 local serializationDependency = $(scriptBody) ; 396 # Used to create a dependency chain between the dummy targets. 397 # This forces jam to build them one after the other, thus preventing 398 # concurrent writes to the script file when building with multiple 399 # jobs. 400 401 # For directories with attributes, we convert those the specified 402 # resource files to files with attributes and add commands to the script 403 # adding the attributes to the directories. 404 for dir in $(directories) { 405 local resourceFiles = [ on $(dir) return $(ATTRIBUTE_FILES) ] ; 406 if $(resourceFiles) { 407 local dirTokens = [ on $(dir) return $(DIRECTORY_TOKENS) ] ; 408 409 # translate resources file to file with attributes 410 local attributeFile = $(script)-attributes-$(dirTokens:J=-) ; 411 ResAttr $(attributeFile) : $(resourceFiles) ; 412 413 # use a unique dummy target for this file, on which we 414 # can define the TARGET_DIR variable 415 local dummyTarget = $(script)-attributes-dummy-$(dir:G=) ; 416 NotFile $(dummyTarget) ; 417 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 418 419 Depends $(dummyTarget) : $(initScript) $(attributeFile) 420 $(serializationDependency) ; 421 Depends $(script) : $(dummyTarget) ; 422 serializationDependency = $(dummyTarget) ; 423 424 AppendToContainerMakeDirectoriesScriptAttributes $(dummyTarget) 425 : $(initScript) $(attributeFile) ; 426 } 427 } 428 } 429} 430 431actions piecemeal CreateContainerMakeDirectoriesScript1 432{ 433 echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1) 434} 435 436actions AppendToContainerMakeDirectoriesScriptAttributes 437{ 438 echo \$copyAttrs "\"\${sPrefix}$(2[2])\"" \ 439 "\"\${tPrefix}$(TARGET_DIR)\"" >> $(2[1]) 440} 441 442rule CreateContainerCopyFilesScript container : script 443{ 444 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 445 Always $(script) ; 446 447 local initScript = [ InitScript $(script) ] ; 448 449 local scriptBody 450 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 451 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 452 Depends $(scriptBody) : $(initScript) ; 453 Depends $(script) : $(scriptBody) ; 454 455 local serializationDependency = $(scriptBody) ; 456 # Used to create a dependency chain between the dummy targets. 457 # This forces jam to build them one after the other, thus preventing 458 # concurrent writes to the script file when building with multiple 459 # jobs. 460 461 local dir ; 462 for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] { 463 # filter the targets that shall be renamed; they have to be copied 464 # individually 465 local destTargets = [ on $(dir) return $(TARGETS_TO_INSTALL) ] ; 466 local remainingTargets ; 467 local destTarget ; 468 for destTarget in $(destTargets) { 469 local target = [ on $(destTarget) return $(TARGET) ] ; 470 local name = $(destTarget:BS) ; 471 if $(name) != $(target:BS) { 472 # use a unique dummy target for this file, on which we 473 # can define the TARGET_DIR variable 474 local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ; 475 NotFile $(dummyTarget) ; 476 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 477 INSTALL_TARGET_NAME on $(dummyTarget) = $(name) ; 478 479 Depends $(dummyTarget) : $(initScript) $(target) 480 $(serializationDependency) ; 481 Depends $(script) : $(dummyTarget) ; 482 serializationDependency = $(dummyTarget) ; 483 484 AppendToContainerCopyFilesScriptSingleFile $(dummyTarget) 485 : $(initScript) $(target) ; 486 } else { 487 remainingTargets += $(target) ; 488 } 489 } 490 targets = $(remainingTargets) ; 491 492 if $(targets) { 493 # use a unique dummy target for this directory, on which we 494 # can define the TARGET_DIR variable 495 local dummyTarget = $(script)-dummy-$(dir:G=) ; 496 NotFile $(dummyTarget) ; 497 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 498 499 Depends $(dummyTarget) : $(initScript) $(targets) 500 $(serializationDependency) ; 501 Depends $(script) : $(dummyTarget) ; 502 serializationDependency = $(dummyTarget) ; 503 504 OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ; 505 AppendToContainerCopyFilesScript $(dummyTarget) : $(targets) ; 506 } 507 508 local symlinks = [ on $(dir) return $(SYMLINKS_TO_INSTALL) ] ; 509 local symlink ; 510 for symlink in $(symlinks) { 511 NotFile $(symlink) ; 512 513 Depends $(script) : $(symlink) ; 514 Depends $(symlink) : $(initScript) $(serializationDependency) ; 515 serializationDependency = $(symlink) ; 516 517 AddSymlinkToContainerCopyFilesScript $(symlink) : $(initScript) ; 518 } 519 520 local targetDirs = [ on $(dir) return $(DIRECTORIES_TO_INSTALL) ] ; 521 local targetDir ; 522 for targetDir in $(targetDirs) { 523 NotFile $(targetDir) ; 524 525 Depends $(script) : $(targetDir) ; 526 Depends $(targetDir) : $(initScript) $(serializationDependency) ; 527 serializationDependency = $(targetDir) ; 528 529 AddDirectoryToContainerCopyFilesScript $(targetDir) 530 : $(initScript) ; 531 } 532 } 533} 534 535 536actions piecemeal AppendToContainerCopyFilesScript bind OUTPUT_SCRIPT 537{ 538 echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" \ 539 >> $(OUTPUT_SCRIPT) 540} 541 542 543actions AppendToContainerCopyFilesScriptSingleFile 544{ 545 echo \$cp "\"\${sPrefix}$(2[2])\"" \ 546 "\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1]) 547} 548 549 550actions AddSymlinkToContainerCopyFilesScript 551{ 552 echo \$ln -sfn "\"$(SYMLINK_TARGET)\"" "\"\${tPrefix}$(1:G=)\"" >> $(2[1]) 553} 554 555 556actions AddDirectoryToContainerCopyFilesScript 557{ 558 echo \$cp -r $(EXCLUDE_PATTERNS) "\"\${sPrefix}$(SOURCE_DIRECTORY)/.\"" \ 559 "\"\${tPrefix}$(TARGET_DIRECTORY:G=)\"" >> $(2[1]) 560} 561 562 563rule CreateContainerUnzipFilesScript container : script 564{ 565 MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ; 566 Always $(script) ; 567 568 local initScript = [ InitScript $(script) ] ; 569 570 local scriptBody 571 = [ FSameTargetWithPrependedGrist $(script) : script-body ] ; 572 LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ; 573 Depends $(scriptBody) : $(initScript) ; 574 Depends $(script) : $(scriptBody) ; 575 576 local serializationDependency = $(scriptBody) ; 577 # Used to create a dependency chain between the dummy targets. 578 # This forces jam to build them one after the other, thus preventing 579 # concurrent writes to the script file when building with multiple 580 # jobs. 581 582 local dir ; 583 for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] { 584 local zipFiles = [ on $(dir) return $(ZIP_FILES_TO_INSTALL) ] ; 585 local zipFile ; 586 for zipFile in $(zipFiles) { 587 # use a unique dummy target for this file, on which we 588 # can define the TARGET_DIR variable 589 local dummyTarget = $(script)-dummy-$(dir:G=)-$(zipFile) ; 590 NotFile $(dummyTarget) ; 591 TARGET_DIR on $(dummyTarget) = $(dir:G=) ; 592 593 Depends $(dummyTarget) : $(initScript) $(zipFile) 594 $(serializationDependency) ; 595 Depends $(script) : $(dummyTarget) ; 596 serializationDependency = $(dummyTarget) ; 597 598 AddUnzipFileToContainerUnzipFilesScript $(dummyTarget) 599 : $(initScript) $(zipFile) ; 600 } 601 } 602} 603 604actions AddUnzipFileToContainerUnzipFilesScript 605{ 606 echo unzipFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" >> $(2[1]) 607} 608 609 610#pragma mark - Haiku Image rules 611 612rule SetUpdateHaikuImageOnly flag 613{ 614 HAIKU_CONTAINER_UPDATE_ONLY on $(HAIKU_IMAGE_CONTAINER_NAME) = $(flag) ; 615} 616 617rule IsUpdateHaikuImageOnly 618{ 619 on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_CONTAINER_UPDATE_ONLY) ; 620} 621 622rule AddDirectoryToHaikuImage directoryTokens : attributeFiles 623{ 624 # AddDirectoryToHaikuImage <directoryTokens> 625 626 local dir = [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 627 : $(directoryTokens) ] ; 628 629 if $(attributeFiles) { 630 SEARCH on $(attributeFiles) 631 += [ FDirName $(HAIKU_TOP) data image_directories ] ; 632 ATTRIBUTE_FILES on $(dir) += $(attributeFiles) ; 633 } 634 635 return $(dir) ; 636} 637 638rule AddFilesToHaikuImage directory : targets : destName 639{ 640 # AddFilesToHaikuImage <directory> : <targets> [ : dest name ] 641 642 AddFilesToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directory) 643 : $(targets) : $(destName) ; 644} 645 646rule FFilesInHaikuImageDirectory directoryTokens 647{ 648 return [ FFilesInContainerDirectory $(HAIKU_IMAGE_CONTAINER_NAME) 649 : $(directoryTokens) ] ; 650} 651 652rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName 653{ 654 # AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ; 655 656 AddSymlinkToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens) 657 : $(linkTarget) : $(linkName) ; 658} 659 660rule FSymlinksInHaikuImageDirectory directoryTokens 661{ 662 return [ FSymlinksInContainerDirectory $(HAIKU_IMAGE_CONTAINER_NAME) 663 : $(directoryTokens) ] ; 664} 665 666rule CopyDirectoryToHaikuImage directoryTokens : sourceDirectory 667 : targetDirectoryName : excludePatterns : alwaysUpdate 668{ 669 CopyDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens) 670 : $(sourceDirectory) : $(targetDirectoryName) : $(excludePatterns) 671 : $(alwaysUpdate) ; 672} 673 674rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate 675{ 676 # AddSourceDirectoryToHaikuImage <dirTokens> : <alwaysUpdate> ; 677 678 CopyDirectoryToHaikuImage home HaikuSources 679 : [ FDirName $(HAIKU_TOP) $(dirTokens) ] 680 : : -x .svn : $(alwaysUpdate) ; 681} 682 683rule AddHeaderDirectoryToHaikuImage dirTokens : dirName : alwaysUpdate 684{ 685 # AddHeaderDirectoryToHaikuImage <dirTokens> : [ <dirName> ] 686 # : <alwaysUpdate> ; 687 688 CopyDirectoryToHaikuImage develop headers 689 : [ FDirName $(HAIKU_TOP) headers $(dirTokens) ] 690 : $(dirName) : -x .svn : $(alwaysUpdate) ; 691} 692 693rule UnzipArchiveToHaikuImage dirTokens : zipFile : alwaysUpdate 694{ 695 # UnzipArchiveToHaikuImage <dirTokens> : <zipFile> : <alwaysUpdate> ; 696 697 # If the image shall only be updated, we unzip only, if explicitely 698 # requested. 699 if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) { 700 UnzipArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens) 701 : $(zipFile) ; 702 } 703} 704 705rule AddDriversToHaikuImage relativeDirectoryTokens : targets 706{ 707 # AddDriversToHaikuImage <relative directory> : <targets> ; 708 709 AddDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 710 : $(relativeDirectoryTokens) : $(targets) ; 711} 712 713rule AddNewDriversToHaikuImage relativeDirectoryTokens : targets 714{ 715 # AddNewDriversToHaikuImage <relative directory> : <targets> ; 716 717 AddNewDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 718 : $(relativeDirectoryTokens) : $(targets) ; 719} 720 721rule AddBootModuleSymlinksToHaikuImage targets 722{ 723 # AddBootModuleSymlinksToHaikuImage <targets> ; 724 725 AddBootModuleSymlinksToContainer $(HAIKU_IMAGE_CONTAINER_NAME) 726 : $(targets) ; 727} 728 729rule AddOptionalHaikuImagePackages packages 730{ 731 local package ; 732 for package in $(packages) { 733 if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] { 734 HAIKU_OPTIONAL_PACKAGE_ADDED on $(package) = 1 ; 735 HAIKU_ADDED_OPTIONAL_PACKAGES += $(package) ; 736 } 737 } 738} 739 740rule IsOptionalHaikuImagePackageAdded package 741{ 742 if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_EXISTS) ] { 743 HAIKU_OPTIONAL_PACKAGE_EXISTS on $(package) = 1 ; 744 HAIKU_EXISTING_OPTIONAL_PACKAGES += $(package) ; 745 } 746 747 if [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] { 748 return 1 ; 749 } 750 751 return ; 752} 753 754rule OptionalPackageDependencies package : dependencies 755{ 756 if [ IsOptionalHaikuImagePackageAdded $(package) ] { 757 AddOptionalHaikuImagePackages $(dependencies) ; 758 } 759} 760 761rule InstallOptionalHaikuImagePackage package : url : dirTokens : isCDPackage 762{ 763 # download zip file 764 local zipFile = [ DownloadOptionalPackage $(package) : $(url) ] ; 765 766 if ( $(isCDPackage) = true || $(isCDPackage) = 1 ) && $(HAIKU_CD_NAME) { 767 # copy onto image 768 AddFilesToHaikuImage _packages_ : $(zipFile) ; 769 } else { 770 # unzip onto image 771 UnzipArchiveToHaikuImage $(dirTokens) : $(zipFile) ; 772 } 773} 774 775rule AddEntryToHaikuImageUserGroupFile file : entry 776{ 777 local allEntries = [ on $(file) return $(HAIKU_IMAGE_USER_GROUP_ENTRIES) ] ; 778 779 if $(allEntries) { 780 allEntries = $(allEntries)|$(entry) ; 781 } else { 782 allEntries = $(entry) ; 783 784 Always $(file) ; 785 MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ; 786 BuildHaikuImageUserGroupFile $(file) ; 787 AddFilesToHaikuImage system etc : $(file) ; 788 } 789 790 HAIKU_IMAGE_USER_GROUP_ENTRIES on $(file) = $(allEntries) ; 791} 792 793actions BuildHaikuImageUserGroupFile 794{ 795 echo "$(HAIKU_IMAGE_USER_GROUP_ENTRIES)" | tr '|' '\n' > $(1) 796} 797 798rule AddUserToHaikuImage user : uid : gid : home : shell : realName 799{ 800 if ! $(user) || ! $(uid) || ! $(gid) || ! $(home) { 801 Exit "Invalid haiku user specification passed to AddUserToHaikuImage." ; 802 } 803 804 local entry 805 = $(user):x:$(uid):$(gid):$(realName:E=$(user)):$(home):$(shell:E="") ; 806 807 AddEntryToHaikuImageUserGroupFile <haiku-image>passwd : $(entry) ; 808} 809 810rule AddGroupToHaikuImage group : gid : members 811{ 812 if ! $(group) || ! $(gid) { 813 Exit "Invalid haiku group specification passed to" 814 "AddGroupToHaikuImage." ; 815 } 816 817 local entry = $(group):x:$(gid):$(members:J=,:E) ; 818 819 AddEntryToHaikuImageUserGroupFile <haiku-image>group : $(entry) ; 820} 821 822rule AddOptionalPackageDescriptionToHaikuImage file : searchPath 823{ 824 if $(searchPath) { 825 SEARCH on $(file) = [ FDirName $(searchPath) ] ; 826 } 827 828 HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS += $(file) ; 829} 830 831rule AddLicenseToHaikuImage file : name : searchPath 832{ 833 if $(searchPath) { 834 SEARCH on $(file) = [ FDirName $(searchPath) ] ; 835 } 836 837 if $(name) && $(file:BS) = $(name) { 838 name = ; 839 } 840 841 AddFilesToHaikuImage system data licenses : $(file) : $(name) ; 842} 843 844 845rule CreateHaikuImageMakeDirectoriesScript script 846{ 847 CreateContainerMakeDirectoriesScript $(HAIKU_IMAGE_CONTAINER_NAME) 848 : $(script) ; 849} 850 851rule CreateHaikuImageCopyFilesScript script 852{ 853 CreateContainerCopyFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ; 854} 855 856rule CreateHaikuImageUnzipFilesScript script 857{ 858 CreateContainerUnzipFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ; 859} 860 861rule BuildHaikuImage haikuImage : scripts : isImage : isVMwareImage 862{ 863 # BuildHaikuImage <haiku image> : <scripts> : <is image> : <isVMwareImage> ; 864 865 if $(isImage) = 1 || $(isImage) = true { 866 IS_IMAGE on $(haikuImage) = 1 ; 867 } else { 868 IS_IMAGE on $(haikuImage) = "" ; 869 } 870 871 if $(isVMwareImage) = 1 || $(isVMwareImage) = true { 872 IS_VMWARE_IMAGE on $(haikuImage) = 1 ; 873 } else { 874 IS_VMWARE_IMAGE on $(haikuImage) = "" ; 875 } 876 877 local mainScript = build_haiku_image ; 878 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 879 880 Depends $(haikuImage) : $(mainScript) $(scripts) ; 881 BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ; 882} 883 884actions BuildHaikuImage1 885{ 886 export imagePath="$(1)" 887 export isImage="$(IS_IMAGE)" 888 export isVMwareImage="$(IS_VMWARE_IMAGE)" 889 $(2[1]) $(2[2-]) 890} 891 892rule BuildVMWareImage vmwareImage : plainImage : imageSize 893{ 894 # BuildVMWareImage <vmware image> : <plain image> : <image size in MB> 895 896 IMAGE_SIZE on $(vmwareImage) = $(imageSize) ; 897 898 Depends $(vmwareImage) : <build>vmdkheader $(plainImage) ; 899 BuildVMWareImage1 $(vmwareImage) : <build>vmdkheader $(plainImage) ; 900} 901 902actions BuildVMWareImage1 903{ 904 $(RM) $(1) 905 $(2[1]) -h 64k -i$(IMAGE_SIZE)M $(1) && 906 cat $(2[2]) >> $(1) 907} 908 909 910#pragma mark - Network Boot Archive rules 911 912rule AddDirectoryToNetBootArchive directoryTokens 913{ 914 # AddDirectoryToNetBootArchive <directoryTokens> 915 916 return [ AddDirectoryToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 917 : $(directoryTokens) ] ; 918} 919 920rule AddFilesToNetBootArchive directory : targets : destName 921{ 922 # AddFilesToNetBootArchive <directory> : <targets> [ : dest name ] 923 924 AddFilesToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(directory) 925 : $(targets) : $(destName) ; 926} 927 928rule AddSymlinkToNetBootArchive directoryTokens : linkTarget : linkName 929{ 930 # AddSymlinkToNetBootArchive <directory> : <link target> [ : <link name> ] ; 931 932 AddSymlinkToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 933 : $(directoryTokens) : $(linkTarget) : $(linkName) ; 934} 935 936rule AddDriversToNetBootArchive relativeDirectoryTokens : targets 937{ 938 # AddDriversToNetBootArchive <relative directory> : <targets> ; 939 940 AddDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 941 : $(relativeDirectoryTokens) : $(targets) ; 942} 943 944rule AddNewDriversToNetBootArchive relativeDirectoryTokens : targets 945{ 946 # AddNewDriversToNetBootArchive <relative directory> : <targets> ; 947 948 AddNewDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 949 : $(relativeDirectoryTokens) : $(targets) ; 950} 951 952rule AddDriverRegistrationToNetBootArchive relativeDirectoryTokens : target 953 : links 954{ 955 # AddDriverRegistrationToNetBootArchive <directory> : <link target> 956 # : <link names> ] ; 957 958 AddDriverRegistrationToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 959 : $(relativeDirectoryTokens) : $(target) : $(links) ; 960} 961 962rule AddBootModuleSymlinksToNetBootArchive targets 963{ 964 # AddBootModuleSymlinksToNetBootArchive <targets> ; 965 966 AddBootModuleSymlinksToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 967 : $(targets) ; 968} 969 970rule CreateNetBootArchiveMakeDirectoriesScript script 971{ 972 CreateContainerMakeDirectoriesScript 973 $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(script) ; 974} 975 976rule CreateNetBootArchiveCopyFilesScript script 977{ 978 CreateContainerCopyFilesScript $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) 979 : $(script) ; 980} 981 982rule BuildNetBootArchive archive : scripts 983{ 984 # BuildNetBootArchive <archive> : <scripts> ; 985 986 local mainScript = build_tgz_archive ; 987 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 988 989 Depends $(archive) : $(mainScript) $(scripts) ; 990 BuildNetBootArchive1 $(archive) : $(mainScript) $(scripts) ; 991} 992 993actions BuildNetBootArchive1 994{ 995 $(2[1]) $(1) $(2[2-]) 996} 997 998 999#pragma mark - Alternative GCC Archive rules 1000 1001 1002rule AddDirectoryToAlternativeGCCArchive directoryTokens 1003{ 1004 # AddDirectoryToAlternativeGCCArchive <directoryTokens> 1005 1006 return [ AddDirectoryToContainer 1007 $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(directoryTokens) ] ; 1008} 1009 1010rule AddFilesToAlternativeGCCArchive directory : targets : destName 1011{ 1012 # AddFilesToAlternativeGCCArchive <directory> : <targets> [ : dest name ] 1013 1014 AddFilesToContainer $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) 1015 : $(directory) : $(targets) : $(destName) ; 1016} 1017 1018rule AddSymlinkToAlternativeGCCArchive directoryTokens : linkTarget : linkName 1019{ 1020 # AddSymlinkToAlternativeGCCArchive <directory> : <link target> 1021 # [ : <link name> ] ; 1022 1023 AddSymlinkToContainer $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) 1024 : $(directoryTokens) : $(linkTarget) : $(linkName) ; 1025} 1026 1027rule CopyDirectoryToAlternativeGCCArchive directoryTokens : sourceDirectory 1028 : targetDirectoryName : excludePatterns : alwaysUpdate 1029{ 1030 CopyDirectoryToContainer $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) 1031 : $(directoryTokens) : $(sourceDirectory) : $(targetDirectoryName) 1032 : $(excludePatterns) : $(alwaysUpdate) ; 1033} 1034 1035rule CreateAlternativeGCCArchiveMakeDirectoriesScript script 1036{ 1037 CreateContainerMakeDirectoriesScript 1038 $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(script) ; 1039} 1040 1041rule CreateAlternativeGCCArchiveCopyFilesScript script 1042{ 1043 CreateContainerCopyFilesScript 1044 $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(script) ; 1045} 1046 1047rule BuildAlternativeGCCArchive archive : scripts 1048{ 1049 # BuildAlternativeGCCArchive <archive> : <scripts> ; 1050 1051 local mainScript = build_zip_archive ; 1052 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 1053 1054 Depends $(archive) : $(mainScript) $(scripts) ; 1055 BuildAlternativeGCCArchive1 $(archive) : $(mainScript) $(scripts) ; 1056} 1057 1058actions BuildAlternativeGCCArchive1 1059{ 1060 $(2[1]) $(1) $(2[2-]) 1061} 1062 1063 1064#pragma mark - Haiku Hybrid Image rules 1065 1066 1067rule AddFilesToHaikuHybridImage directory : targets : destName 1068 : useABISubDir 1069{ 1070 # AddFilesToHaikuHybridImage <directory> : <targets> : <destName> 1071 # : <useABISubDir> 1072 # 1073 # Convenience rule calling both AddFilesToHaikuImage and 1074 # AddFilesToAlternativeGCCArchive. 1075 # 1076 # <useABISubDir> 1077 # if non-empty, specifies that an ABI subdirectory shall be appended to 1078 # <directory> for the alternative GCC archive. 1079 1080 local alternativeSubDir ; 1081 if $(useABISubDir) { 1082 alternativeSubDir = gcc$(HAIKU_GCC_VERSION[1]) ; 1083 } 1084 1085 AddFilesToHaikuImage $(directory) : $(targets) : $(destName) ; 1086 AddFilesToAlternativeGCCArchive $(directory) $(alternativeSubDir) 1087 : $(targets) : $(destName) ; 1088} 1089 1090rule AddSymlinkToHaikuHybridImage directoryTokens : linkTarget : linkName 1091 : useSymlinkTargetABISubDir : useABISubDir 1092{ 1093 # AddFilesToHaikuHybridImage <directoryTokens> : <linkTarget> : <linkName> 1094 # [ : <useSymlinkTargetABISubDir> [ : <useABISubDir> ] ] 1095 # 1096 # Convenience rule calling both AddSymlinkToHaikuImage and 1097 # AddSymlinkToAlternativeGCCArchive. 1098 # 1099 # <linkTarget> 1100 # Can be a list of components that will be joined to path inserting 1101 # "/"s inbetween. 1102 # <useSymlinkTargetABISubDir> 1103 # If non-empty, specifies that an ABI subdirectory shall be inserted 1104 # into <linkTarget> (between the first and second component) for the 1105 # alternative GCC archive. 1106 # <useABISubDir> 1107 # If non-empty, specifies that an ABI subdirectory part shall be appended 1108 # to the directory tokens for the alternative GCC archive. 1109 1110 local alternativeDirTokens = $(directoryTokens) ; 1111 if $(useABISubDir) { 1112 alternativeDirTokens += gcc$(HAIKU_GCC_VERSION[1]) ; 1113 } 1114 1115 local alternativeLinkTarget = $(linkTarget) ; 1116 if $(useSymlinkTargetABISubDir) { 1117 alternativeLinkTarget = $(linkTarget[1]) gcc$(HAIKU_GCC_VERSION[1]) 1118 $(linkTarget[2-]) ; 1119 } 1120 linkTarget = $(linkTarget:J=/) ; 1121 alternativeLinkTarget = $(alternativeLinkTarget:J=/) ; 1122 1123 AddSymlinkToHaikuImage $(directoryTokens) : $(linkTarget) : $(linkName) ; 1124 AddSymlinkToAlternativeGCCArchive $(alternativeDirTokens) 1125 : $(alternativeLinkTarget) : $(linkName) ; 1126} 1127 1128 1129#pragma mark - Floppy Boot Archive rules 1130 1131 1132rule AddDirectoryToFloppyBootArchive directoryTokens 1133{ 1134 # AddDirectoryToFloppyBootArchive <directoryTokens> 1135 1136 return [ AddDirectoryToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1137 : $(directoryTokens) ] ; 1138} 1139 1140rule AddFilesToFloppyBootArchive directory : targets : destName 1141{ 1142 # AddFilesToFloppyBootArchive <directory> : <targets> [ : dest name ] 1143 1144 AddFilesToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) : $(directory) 1145 : $(targets) : $(destName) ; 1146} 1147 1148rule AddSymlinkToFloppyBootArchive directoryTokens : linkTarget : linkName 1149{ 1150 # AddSymlinkToFloppyBootArchive <directory> : <link target> [ : <link name> ] ; 1151 1152 AddSymlinkToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1153 : $(directoryTokens) : $(linkTarget) : $(linkName) ; 1154} 1155 1156rule AddDriversToFloppyBootArchive relativeDirectoryTokens : targets 1157{ 1158 # AddDriversToFloppyBootArchive <relative directory> : <targets> ; 1159 1160 AddDriversToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1161 : $(relativeDirectoryTokens) : $(targets) ; 1162} 1163 1164rule AddNewDriversToFloppyBootArchive relativeDirectoryTokens : targets 1165{ 1166 # AddNewDriversToFloppyBootArchive <relative directory> : <targets> ; 1167 1168 AddNewDriversToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1169 : $(relativeDirectoryTokens) : $(targets) ; 1170} 1171 1172rule AddDriverRegistrationToFloppyBootArchive relativeDirectoryTokens : target 1173 : links 1174{ 1175 # AddDriverRegistrationToFloppyBootArchive <directory> : <link target> 1176 # : <link names> ] ; 1177 1178 AddDriverRegistrationToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1179 : $(relativeDirectoryTokens) : $(target) : $(links) ; 1180} 1181 1182rule AddBootModuleSymlinksToFloppyBootArchive targets 1183{ 1184 # AddBootModuleSymlinksToFloppyBootArchive <targets> ; 1185 1186 AddBootModuleSymlinksToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1187 : $(targets) ; 1188} 1189 1190rule CreateFloppyBootArchiveMakeDirectoriesScript script 1191{ 1192 CreateContainerMakeDirectoriesScript 1193 $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) : $(script) ; 1194} 1195 1196rule CreateFloppyBootArchiveCopyFilesScript script 1197{ 1198 CreateContainerCopyFilesScript $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) 1199 : $(script) ; 1200} 1201 1202rule BuildFloppyBootArchive archive : scripts 1203{ 1204 # BuildHFloppyBootArchive <archive> : <scripts> ; 1205 1206 local mainScript = build_tgz_archive ; 1207 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; 1208 1209 Depends $(archive) : $(mainScript) $(scripts) ; 1210 BuildFloppyBootArchive1 $(archive) : $(mainScript) $(scripts) ; 1211} 1212 1213actions BuildFloppyBootArchive1 1214{ 1215 $(2[1]) $(1) $(2[2-]) 1216} 1217 1218# warning: that is quite x86 dependant... 1219 1220rule BuildFloppyBootImage image : haikuLoader : archive 1221{ 1222 Depends $(image) : $(haikuLoader) ; 1223 Depends $(image) : $(archive) ; 1224 #MakeLocateDebug $(image) ; 1225 FLOPPY_IMAGE_SIZE on $(image) = $(HAIKU_BOOT_FLOPPY_IMAGE_SIZE) ; 1226 ARCHIVE_IMAGE_OFFSET on $(image) = $(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; 1227 BuildFloppyBootImage1 $(image) : $(haikuLoader) $(archive) ; 1228 if $(HAIKU_BOOT_PLATFORM) = atari_m68k { 1229 Depends $(image) : <build>fixup_tos_boot_checksum ; 1230 BuildFloppyBootImageAtariM68K $(image) : <build>fixup_tos_boot_checksum ; 1231 } 1232} 1233 1234actions BuildFloppyBootImage1 1235{ 1236 $(RM) $(<) 1237 # make an empty image 1238 dd if=/dev/zero of=$(<) bs=1k count=$(FLOPPY_IMAGE_SIZE) 1239 # add haiku_loader 1240 dd if=$(>[1]) of=$(<) conv=notrunc 1241 # add the boot drivers tgz archive 1242 dd if=$(>[2]) of=$(<) bs=$(ARCHIVE_IMAGE_OFFSET)k seek=1 conv=notrunc 1243} 1244 1245actions BuildFloppyBootImageAtariM68K 1246{ 1247 # fixup the boot sector checksum 1248 $(>[1]) $(<) 1249} 1250 1251#pragma mark - CD Boot Image rules 1252 1253rule BuildCDBootImage image : bootfloppy : extrafiles 1254{ 1255 Depends $(image) : $(bootfloppy) ; 1256 Depends $(image) : $(extrafiles) ; 1257 BOOTIMG on $(image) = $(bootfloppy) ; 1258 1259 BuildCDBootImage1 $(image) : $(bootfloppy) $(extrafiles) ; 1260} 1261 1262actions BuildCDBootImage1 1263{ 1264 $(RM) $(<) 1265 mkisofs -b $(BOOTIMG) -r -J -V bootimg -o $(<) $(>[1]) $(>[2-]) 1266} 1267 1268 1269#pragma mark - CD Boot PPC Image rules 1270 1271rule BuildCDBootPPCImage image : hfsmaps : elfloader : coffloader : chrpscript : extrafiles 1272{ 1273 Depends $(image) : $(elfloader) ; 1274 Depends $(image) : $(coffloader) ; 1275 Depends $(image) : $(chrpscript) ; 1276 Depends $(image) : $(extrafiles) ; 1277 Depends $(image) : $(hfsmaps) ; 1278 MAPS on $(image) = $(hfsmaps) ; 1279 1280 BuildCDBootPPCImage1 $(image) : $(elfloader) $(coffloader) $(chrpscript) $(extrafiles) ; 1281} 1282 1283actions BuildCDBootPPCImage1 bind MAPS 1284{ 1285 $(RM) $(<) 1286 mkdir -p $(HAIKU_OUTPUT_DIR)/cd/ppc 1287 cp $(>) $(HAIKU_OUTPUT_DIR)/cd/ppc/ 1288 cp $(>[3]) $(HAIKU_OUTPUT_DIR)/cd/ppc/bootinfo.txt 1289 cp $(>[1]) $(HAIKU_OUTPUT_DIR)/cd/ofwboot.elf 1290 cp $(>[2]) $(HAIKU_OUTPUT_DIR)/cd/ofwboot.xcf 1291 #mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) 1292 #mkisofs -hfs -r -U -chrp-boot -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) 1293 #mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -r -o $(<) $(>[1]) $(>[2-]) $(HAIKU_OUTPUT_DIR)/cd 1294 #mkisofs -r -U -chrp-boot -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) 1295 #mkisofs -r -U -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) 1296 # $(HAIKU_OUTPUT_DIR)/cd 1297 # -hfs -hfs-bless . 1298 mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd 1299 #$(RM) -R $(HAIKU_OUTPUT_DIR)/cd 1300} 1301 1302 1303