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