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