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