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