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