1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 24 # 25 26 include $(SRC)/Makefile.master 27 include $(SRC)/Makefile.buildnum 28 29 # 30 # Make sure we're getting a consistent execution environment for the 31 # embedded scripts. 32 # 33 SHELL= /usr/bin/ksh93 34 35 # 36 # To suppress package dependency generation on any system, regardless 37 # of how it was installed, set SUPPRESSPKGDEP=true in the build 38 # environment. 39 # 40 SUPPRESSPKGDEP= false 41 42 # 43 # Comment this line out or set "PKGDEBUG=" in your build environment 44 # to get more verbose output from the make processes in usr/src/pkg 45 # 46 PKGDEBUG= @ 47 48 # 49 # Cross platform packaging notes 50 # 51 # By default, we package the proto area from the same architecture as 52 # the packaging build. In other words, if you're running nightly or 53 # bldenv on an x86 platform, it will take objects from the x86 proto 54 # area and use them to create x86 repositories. 55 # 56 # If you want to create repositories for an architecture that's 57 # different from $(uname -p), you do so by setting PKGMACH in your 58 # build environment. 59 # 60 # For this to work correctly, the following must all happen: 61 # 62 # 1. You need the desired proto area, which you can get either by 63 # doing a gatekeeper-style build with the -U option to 64 # nightly(1), or by using rsync. If you don't do this, you will 65 # get packaging failures building all packages, because pkgsend 66 # is unable to find the required binaries. 67 # 2. You need the desired tools proto area, which you can get in the 68 # same ways as the normal proto area. If you don't do this, you 69 # will get packaging failures building onbld, because pkgsend is 70 # unable to find the tools binaries. 71 # 3. The remainder of this Makefile should never refer directly to 72 # $(MACH). Instead, $(PKGMACH) should be used whenever an 73 # architecture-specific path or token is needed. If this is done 74 # incorrectly, then packaging will fail, and you will see the 75 # value of $(uname -p) instead of the value of $(PKGMACH) in the 76 # commands that fail. 77 # 4. Each time a rule in this Makefile invokes $(MAKE), it should 78 # pass PKGMACH=$(PKGMACH) explicitly on the command line. If 79 # this is done incorrectly, then packaging will fail, and you 80 # will see the value of $(uname -p) instead of the value of 81 # $(PKGMACH) in the commands that fail. 82 # 83 # Refer also to the convenience targets defined later in this 84 # Makefile. 85 # 86 PKGMACH= $(MACH) 87 88 # 89 # ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or 90 # bldenv. These macros translate them into terms of $PKGMACH, instead 91 # of $ARCH. 92 # 93 PKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH): 94 PKGROOT= $(PKGROOT.cmd:sh) 95 TOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH): 96 TOOLSROOT= $(TOOLSROOT.cmd:sh) 97 PKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/: 98 PKGDEST= $(PKGDEST.cmd:sh) 99 100 EXCEPTIONS= packaging 101 102 PKGMOGRIFY= pkgmogrify 103 104 # 105 # Always build the redistributable repository, but only build the 106 # nonredistributable bits if we have access to closed source. 107 # 108 # Some objects that result from the closed build are still 109 # redistributable, and should be packaged as part of an open-only 110 # build. Access to those objects is provided via the closed-bins 111 # tarball. See usr/src/tools/scripts/bindrop.sh for details. 112 # 113 REPOS= redist 114 115 # 116 # The packages directory will contain the processed manifests as 117 # direct build targets and subdirectories for package metadata extracted 118 # incidentally during manifest processing. 119 # 120 # Nothing underneath $(PDIR) should ever be managed by SCM. 121 # 122 PDIR= packages.$(PKGMACH) 123 124 # 125 # The tools proto must be specified for dependency generation. 126 # Publication from the tools proto area is managed in the 127 # publication rule. 128 # 129 $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT) 130 131 PKGPUBLISHER= $(PKGPUBLISHER_REDIST) 132 133 # 134 # To get these defaults, manifests should simply refer to $(PKGVERS). 135 # 136 PKGVERS_COMPONENT= 0.$(RELEASE) 137 PKGVERS_BUILTON= $(RELEASE) 138 PKGVERS_BRANCH= 0.$(ONNV_BUILDNUM) 139 PKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH) 140 141 # 142 # The ARCH32 and ARCH64 macros are used in the manifests to express 143 # architecture-specific subdirectories in the installation paths 144 # for isaexec'd commands. 145 # 146 # We can't simply use $(MACH32) and $(MACH64) here, because they're 147 # only defined for the build architecture. To do cross-platform 148 # packaging, we need both values. 149 # 150 i386_ARCH32= i86 151 sparc_ARCH32= sparcv7 152 i386_ARCH64= amd64 153 sparc_ARCH64= sparcv9 154 155 # The form "MACRO :sh= COMMAND" ensures that the COMMAND is executed only once, 156 # whereas with the form "MACRO = $(COMMAND:sh)" the COMMAND is executed 157 # whenever the reference is evaluated. 158 # 159 # The form "MACRO :sh= COMMAND" does not substitue macros in COMMAND, so macros 160 # defined in Makefile.master is not used here. 161 OPENSSL10_ONLY :sh= /usr/bin/openssl version | \ 162 /usr/bin/nawk '{if($2<1){print "\043";}}' 163 164 # 165 # macros and transforms needed by pkgmogrify 166 # 167 # If you append to this list using target-specific assignments (:=), 168 # be very careful that the targets are of the form $(PDIR)/pkgname. If 169 # you use a higher level target, or a package list, you'll trigger a 170 # complete reprocessing of all manifests because they'll fail command 171 # dependency checking. 172 # 173 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \ 174 extract_metadata 175 PM_INC= transforms manifests 176 177 PKGMOG_DEFINES= \ 178 i386_ONLY=$(POUND_SIGN) \ 179 sparc_ONLY=$(POUND_SIGN) \ 180 OPENSSL10_ONLY=$(OPENSSL10_ONLY) \ 181 $(PKGMACH)_ONLY= \ 182 ARCH=$(PKGMACH) \ 183 ARCH32=$($(PKGMACH)_ARCH32) \ 184 ARCH64=$($(PKGMACH)_ARCH64) \ 185 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \ 186 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \ 187 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \ 188 PKGVERS=$(PKGVERS) 189 190 PKGDEP_TOKENS_i386= \ 191 'PLATFORM=i86hvm' \ 192 'PLATFORM=i86pc' \ 193 'PLATFORM=i86xpv' \ 194 'ISALIST=amd64' \ 195 'ISALIST=i386' 196 PKGDEP_TOKENS_sparc= \ 197 'PLATFORM=sun4u' \ 198 'PLATFORM=sun4v' \ 199 'ISALIST=sparcv9' \ 200 'ISALIST=sparc' 201 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH)) 202 203 # 204 # The package lists are generated with $(PKGDEP_TYPE) as their 205 # dependency types, so that they can be included by either an 206 # incorporation or a group package. 207 # 208 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require 209 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate 210 211 PKGDEP_INCORP= \ 212 depend fmri=consolidation/osnet/osnet-incorporation type=require 213 214 # 215 # All packaging build products should go into $(PDIR), so they don't 216 # need to be included separately in CLOBBERFILES. 217 # 218 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) 219 220 # 221 # By default, PKGS will list all manifests. To build and/or publish a 222 # subset of packages, override this on the command line or in the 223 # build environment and then reference (implicitly or explicitly) the all 224 # or install targets. 225 # 226 MANIFESTS :sh= (cd manifests; print *.mf) 227 PKGS= $(MANIFESTS:%.mf=%) 228 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep) 229 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog) 230 231 # 232 # Track the synthetic manifests separately so we can properly express 233 # build rules and dependencies. The synthetic and real packages use 234 # different sets of transforms and macros for pkgmogrify. 235 # 236 SYNTH_PKGS= osnet-incorporation osnet-redist 237 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep) 238 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog) 239 240 # 241 # Root of pkg image to use for dependency resolution 242 # Normally / on the machine used to build the binaries 243 # 244 PKGDEP_RESOLVE_IMAGE = / 245 246 # 247 # For each package, we determine the target repository based on 248 # manifest-embedded metadata. Because we make that determination on 249 # the fly, the publication target cannot be expressed as a 250 # subdirectory inside the unknown-by-the-makefile target repository. 251 # 252 # In order to limit the target set to real files in known locations, 253 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless 254 # of content or target repository. 255 # 256 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub) 257 258 # 259 # Any given repository- and status-specific package list may be empty, 260 # but we can only determine that dynamically, so we always generate all 261 # lists for each repository we're building. 262 # 263 # The meanings of each package status are as follows: 264 # 265 # PKGSTAT meaning 266 # ---------- ---------------------------------------------------- 267 # noincorp Do not include in incorporation or group package 268 # obsolete Include in incorporation, but not group package 269 # renamed Include in incorporation, but not group package 270 # current Include in incorporation and group package 271 # 272 # Since the semantics of the "noincorp" package status dictate that 273 # such packages are not included in the incorporation or group packages, 274 # there is no need to build noincorp package lists. 275 # 276 PKGLISTS= \ 277 $(REPOS:%=$(PDIR)/packages.%.current) \ 278 $(REPOS:%=$(PDIR)/packages.%.renamed) \ 279 $(REPOS:%=$(PDIR)/packages.%.obsolete) 280 281 .KEEP_STATE: 282 283 .PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \ 284 $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS) 285 286 # 287 # For a single manifest, the dependency chain looks like this: 288 # 289 # raw manifest (mypkg.mf) 290 # | 291 # | use pkgmogrify to process raw manifest 292 # | 293 # processed manifest (mypkg.mog) 294 # | 295 # * | use pkgdepend generate to generate dependencies 296 # | 297 # manifest with TBD dependencies (mypkg.dep) 298 # | 299 # % | use pkgdepend resolve to resolve dependencies 300 # | 301 # manifest with dependencies resolved (mypkg.res) 302 # | 303 # | use pkgsend to publish the package 304 # | 305 # placeholder to indicate successful publication (mypkg.pub) 306 # 307 # * This may be suppressed via SUPPRESSPKGDEP. The resulting 308 # packages will install correctly, but care must be taken to 309 # install all dependencies, because pkg will not have the input 310 # it needs to determine this automatically. 311 # 312 # % This is included in this diagram to make the picture complete, but 313 # this is a point of synchronization in the build process. 314 # Dependency resolution is actually done once on the entire set of 315 # manifests, not on a per-package basis. 316 # 317 # The full dependency chain for generating everything that needs to be 318 # published, without actually publishing it, looks like this: 319 # 320 # processed synthetic packages 321 # | | 322 # package lists synthetic package manifests 323 # | 324 # processed real packages 325 # | | 326 # package dir real package manifests 327 # 328 # Here, each item is a set of real or synthetic packages. For this 329 # portion of the build, no reference is made to the proto area. It is 330 # therefore suitable for the "all" target, as opposed to "install." 331 # 332 # Since each of these steps is expressed explicitly, "all" need only 333 # depend on the head of the chain. 334 # 335 # From the end of manifest processing, the publication dependency 336 # chain looks like this: 337 # 338 # repository metadata (catalogs and search indices) 339 # | 340 # | pkg.depotd 341 # | 342 # published packages 343 # | | 344 # | | pkgsend publish 345 # | | 346 # repositories resolved dependencies 347 # | | 348 # pkgsend | | pkgdepend resolve 349 # create-repository | 350 # | generated dependencies 351 # repo directories | 352 # | pkgdepend 353 # | 354 # processed manifests 355 # 356 357 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH) 358 359 all: $(ALL_TARGETS) 360 361 # 362 # This will build the directory to contain the processed manifests 363 # and the metadata symlinks. 364 # 365 $(PDIR): 366 @print "Creating $(@)" 367 $(PKGDEBUG)$(INS.dir) 368 369 # 370 # This rule resolves dependencies across all published manifests. 371 # 372 # We shouldn't have to ignore the error from pkgdepend, but until 373 # 16012 and its dependencies are resolved, pkgdepend will always exit 374 # with an error. 375 # 376 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS) 377 -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \ 378 print "Suppressing dependency resolution"; \ 379 for p in $(DEP_PKGS:%.dep=%); do \ 380 $(CP) $$p.dep $$p.res; \ 381 done; \ 382 else \ 383 print "Resolving dependencies"; \ 384 pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \ 385 -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \ 386 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \ 387 if [ "$$(print $$p.metadata.*)" = \ 388 "$$(print $$p.metadata.noincorp.*)" ]; \ 389 then \ 390 print "Removing dependency versions from $$p"; \ 391 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \ 392 -O $$p.res -I transforms \ 393 strip_versions $$p.dep.res; \ 394 $(RM) $$p.dep.res; \ 395 else \ 396 $(MV) $$p.dep.res $$p.res; \ 397 fi; \ 398 done; \ 399 fi 400 $(PKGDEBUG)$(TOUCH) $(@) 401 402 install: $(ALL_TARGETS) repository-metadata 403 404 repository-metadata: publish_pkgs 405 @print "Creating repository metadata" 406 $(PKGDEBUG)for r in $(REPOS); do \ 407 /usr/lib/pkg.depotd -d $(PKGDEST)/repo.$$r \ 408 --add-content --exit-ready; \ 409 done 410 411 # 412 # Since we create zero-length processed manifests for a graceful abort 413 # from pkgmogrify, we need to detect that here and make no effort to 414 # publish the package. 415 # 416 # For all other packages, we publish them regardless of status. We 417 # derive the target repository as a component of the metadata-derived 418 # symlink for each package. 419 # 420 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS) 421 422 # 423 # Before publishing, we want to pull the license files from $CODEMGR_WS 424 # into the proto area. This allows us to NOT pass $SRC (or 425 # $CODEMGR_WS) as a basedir for publication. 426 # 427 $(PUB_PKGS): stage-licenses 428 429 # 430 # Initialize the empty on-disk repositories 431 # 432 $(REPOS:%=$(PKGDEST)/repo.%): 433 @print "Initializing $(@F)" 434 $(PKGDEBUG)$(INS.dir) 435 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \ 436 --set-property publisher.prefix=$(PKGPUBLISHER) 437 438 # 439 # rule to process real manifests 440 # 441 # To allow redistributability and package status to change, we must 442 # remove not only the actual build target (the processed manifest), but 443 # also the incidental ones (the metadata-derived symlinks). 444 # 445 # If pkgmogrify exits cleanly but fails to create the specified output 446 # file, it means that it encountered an abort directive. That means 447 # that this package should not be published for this particular build 448 # environment. Since we can't prune such packages from $(PKGS) 449 # retroactively, we need to create an empty target file to keep make 450 # from trying to rebuild it every time. For these empty targets, we 451 # do not create metadata symlinks. 452 # 453 # Automatic dependency resolution to files is also done at this phase of 454 # processing. The skipped packages are skipped due to existing bugs 455 # in pkgdepend. 456 # 457 # The incorporation dependency is tricky: it needs to go into all 458 # current and renamed manifests (ie all incorporated packages), but we 459 # don't know which those are until after we run pkgmogrify. So 460 # instead of expressing it as a transform, we tack it on ex post facto. 461 # 462 # Implementation notes: 463 # 464 # - The first $(RM) must not match other manifests, or we'll run into 465 # race conditions with parallel manifest processing. 466 # 467 # - The make macros [ie $(MACRO)] are evaluated when the makefile is 468 # read in, and will result in a fixed, macro-expanded rule for each 469 # target enumerated in $(PROC_PKGS). 470 # 471 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule 472 # is executed. The results may only be referenced in the shell in 473 # which they are assigned, so from the perspective of make, all code 474 # that needs these variables needs to be part of the same line of 475 # code. Hence the use of command separators and line continuation 476 # characters. 477 # 478 # - The extract_metadata transforms are designed to spit out shell 479 # variable assignments to stdout. Those are published to the 480 # .vars temporary files, and then used as input to the eval 481 # statement. This is done in stages specifically so that pkgmogrify 482 # can signal failure if the manifest has a syntactic or other error. 483 # The eval statement should begin with the default values, and the 484 # output from pkgmogrify (if any) should be in the form of a 485 # variable assignment to override those defaults. 486 # 487 # - When this rule completes execution, it must leave an updated 488 # target file ($@) in place, or make will reprocess the package 489 # every time it encounters it as a dependency. Hence the "touch" 490 # statement to ensure that the target is created, even when 491 # pkgmogrify encounters an abort in the publish transforms. 492 # 493 494 .SUFFIXES: .mf .mog .dep .res .pub 495 496 $(PDIR)/%.mog: manifests/%.mf 497 @print "Processing manifest $(<F)" 498 @env PKGFMT_OUTPUT=v1 pkgfmt -c $< 499 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \ 500 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars 501 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \ 502 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \ 503 $(<) $(PM_TRANSFORMS) 504 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \ 505 `$(CAT) -s $(@).vars`; \ 506 if [ -f $(@) ]; then \ 507 if [ "$$NODEPEND" != "false" ]; then \ 508 $(TOUCH) $(@:%.mog=%.nodepend); \ 509 fi; \ 510 $(LN) -s $(@F) \ 511 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \ 512 if [ \( "$$PKGSTAT" = "current" \) -o \ 513 \( "$$PKGSTAT" = "renamed" \) ]; \ 514 then print $(PKGDEP_INCORP) >> $(@); \ 515 fi; \ 516 print $$LICS > $(@:%.mog=%.lics); \ 517 else \ 518 $(TOUCH) $(@) $(@:%.mog=%.lics); \ 519 fi 520 $(PKGDEBUG)$(RM) $(@).vars 521 522 $(PDIR)/%.dep: $(PDIR)/%.mog 523 @print "Generating dependencies for $(<F)" 524 $(PKGDEBUG)$(RM) $(@) 525 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \ 526 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \ 527 $(PKGROOT) > $(@); \ 528 else \ 529 $(CP) $(<) $(@); \ 530 fi 531 532 # 533 # The full chain implies that there should be a .dep.res suffix rule, 534 # but dependency generation is done on a set of manifests, rather than 535 # on a per-manifest basis. Instead, see the gendeps rule above. 536 # 537 538 $(PDIR)/%.pub: $(PDIR)/%.res 539 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \ 540 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \ 541 if [ -s $(<) ]; then \ 542 print "Publishing $(@F:%.pub=%) to $$r repository"; \ 543 pkgsend -s file://$(PKGDEST)/repo.$$r publish \ 544 -d $(PKGROOT) -d $(TOOLSROOT) \ 545 -d license_files -d $(PKGROOT)/licenses \ 546 --fmri-in-manifest --no-index --no-catalog $(<) \ 547 > /dev/null; \ 548 fi; \ 549 $(TOUCH) $(@); 550 551 # 552 # rule to build the synthetic manifests 553 # 554 # This rule necessarily has PKGDEP_TYPE that changes according to 555 # the specific synthetic manifest. Rather than escape command 556 # dependency checking for the real manifest processing, or failing to 557 # express the (indirect) dependency of synthetic manifests on real 558 # manifests, we simply split this rule out from the one above. 559 # 560 # The implementation notes from the previous rule are applicable 561 # here, too. 562 # 563 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf) 564 @print "Processing synthetic manifest $(@F:%.mog=%.mf)" 565 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars 566 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \ 567 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \ 568 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \ 569 $(PM_TRANSFORMS) synthetic 570 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \ 571 if [ -f $(@) ]; then \ 572 $(LN) -s $(@F) \ 573 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \ 574 else \ 575 $(TOUCH) $(@); \ 576 fi 577 $(PKGDEBUG)$(RM) $(@).vars 578 579 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog) 580 @print "Skipping dependency generation for $(@F:%.dep=%)" 581 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@) 582 583 clean: 584 585 clobber: clean 586 $(RM) -r $(CLOBBERFILES) 587 588 # 589 # This rule assumes that all links in the $PKGSTAT directories 590 # point to valid manifests, and will fail the make run if one 591 # does not contain an fmri. 592 # 593 # We do this in the BEGIN action instead of using pattern matching 594 # because we expect the fmri to be at or near the first line of each input 595 # file, and this way lets us avoid reading the rest of the file after we 596 # find what we need. 597 # 598 # We keep track of a failure to locate an fmri, so we can fail the 599 # make run, but we still attempt to process each package in the 600 # repo/pkgstat-specific subdir, in hopes of maybe giving some 601 # additional useful info. 602 # 603 # The protolist is used for bfu archive creation, which may be invoked 604 # interactively by the user. Both protolist and PKGLISTS targets 605 # depend on $(PROC_PKGS), but protolist builds them recursively. 606 # To avoid collisions, we insert protolist into the dependency chain 607 # here. This has two somewhat subtle benefits: it allows bfu archive 608 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS, 609 # and it ensures that a protolist file here will always correspond to the 610 # contents of the processed manifests, which can vary depending on build 611 # environment. 612 # 613 $(PKGLISTS): $(PROC_PKGS) 614 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \ 615 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \ 616 print "Generating $$r $$s package list"; \ 617 $(RM) $(@); $(TOUCH) $(@); \ 618 $(NAWK) 'BEGIN { \ 619 if (ARGC < 2) { \ 620 exit; \ 621 } \ 622 retcode = 0; \ 623 for (i = 1; i < ARGC; i++) { \ 624 do { \ 625 e = getline f < ARGV[i]; \ 626 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \ 627 close(ARGV[i]); \ 628 if (e == 1) { \ 629 l = split(f, a, "="); \ 630 print "depend fmri=" a[l], \ 631 "type=$$(PKGDEP_TYPE)"; \ 632 } else { \ 633 print "no fmri in " ARGV[i] >> "/dev/stderr"; \ 634 retcode = 2; \ 635 } \ 636 } \ 637 exit retcode; \ 638 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \ 639 -name NOSUCHFILE \)` >> $(@) 640 641 # 642 # rules to validate proto area against manifests, check for safe 643 # file permission modes, and generate a faux proto list 644 # 645 # For the check targets, the dependencies on $(PROC_PKGS) is specified 646 # as a subordinate make process in order to suppress output. 647 # 648 makesilent: 649 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \ 650 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null 651 652 # 653 # The .lics files were created during pkgmogrification, and list the 654 # set of licenses to pull from $SRC for each package. Because 655 # licenses may be duplicated between packages, we uniquify them as 656 # well as aggregating them here. 657 # 658 license-list: makesilent 659 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \ 660 do print $$l; done ) | sort -u > $@ 661 662 # 663 # Staging the license and description files in the proto area allows 664 # us to do proper unreferenced file checking of both license and 665 # description files without blanket exceptions, and to pull license 666 # content without reference to $CODEMGR_WS during publication. 667 # 668 stage-licenses: license-list FRC 669 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \ 670 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \ 671 `$(NAWK) '{ \ 672 print "$(PKGROOT)/licenses/" $$0; \ 673 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \ 674 }' license-list` > /dev/null; 675 676 protocmp: makesilent 677 @validate_pkg -a $(PKGMACH) -v \ 678 $(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \ 679 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT) 680 681 pmodes: makesilent 682 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \ 683 -e $(CODEMGR_WS)/exception_lists/pmodes 684 685 check: protocmp pmodes 686 687 protolist: proto_list_$(PKGMACH) 688 689 proto_list_$(PKGMACH): $(PROC_PKGS) 690 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@) 691 692 $(PROC_PKGS): $(PDIR) 693 694 # 695 # This is a convenience target to allow package names to function as 696 # build targets. Generally, using it is only useful when iterating on 697 # development of a manifest. 698 # 699 # When processing a manifest, use the basename (without extension) of 700 # the package. When publishing, use the basename with a ".pub" 701 # extension. 702 # 703 # Other than during manifest development, the preferred usage is to 704 # avoid these targets and override PKGS on the make command line and 705 # use the provided all and install targets. 706 # 707 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog) 708 709 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@) 710 711 # 712 # This is a convenience target to resolve dependencies without publishing 713 # packages. 714 # 715 gendeps: $(PDIR)/gendeps 716 717 # 718 # These are convenience targets for cross-platform packaging. If you 719 # want to build any of "the normal" targets for a different 720 # architecture, simply use "arch/target" as your build target. 721 # 722 # Since the most common use case for this is "install," the architecture 723 # specific install targets have been further abbreviated to elide "/install." 724 # 725 i386/% sparc/%: 726 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) 727 728 i386 sparc: $$(@)/install 729 730 FRC: 731 732 # EXPORT DELETE START 733 XMOD_PKGS= \ 734 BRCMbnx \ 735 BRCMbnxe \ 736 SUNWadpu320 \ 737 SUNWibsdpib \ 738 SUNWkdc \ 739 SUNWlsimega \ 740 SUNWwbint \ 741 SUNWwbsup 742 743 EXPORT_SRC: CRYPT_SRC 744 $(RM) $(XMOD_PKGS:%=manifests/%.mf) 745 $(RM) Makefile+ 746 $(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \ 747 < Makefile > Makefile+ 748 $(MV) -f Makefile+ Makefile 749 $(CHMOD) 444 Makefile 750 # EXPORT DELETE END