111838SLiane.Praza@Sun.COM# 211838SLiane.Praza@Sun.COM# CDDL HEADER START 311838SLiane.Praza@Sun.COM# 411838SLiane.Praza@Sun.COM# The contents of this file are subject to the terms of the 511838SLiane.Praza@Sun.COM# Common Development and Distribution License (the "License"). 611838SLiane.Praza@Sun.COM# You may not use this file except in compliance with the License. 711838SLiane.Praza@Sun.COM# 811838SLiane.Praza@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 911838SLiane.Praza@Sun.COM# or http://www.opensolaris.org/os/licensing. 1011838SLiane.Praza@Sun.COM# See the License for the specific language governing permissions 1111838SLiane.Praza@Sun.COM# and limitations under the License. 1211838SLiane.Praza@Sun.COM# 1311838SLiane.Praza@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each 1411838SLiane.Praza@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1511838SLiane.Praza@Sun.COM# If applicable, add the following below this CDDL HEADER, with the 1611838SLiane.Praza@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying 1711838SLiane.Praza@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner] 1811838SLiane.Praza@Sun.COM# 1911838SLiane.Praza@Sun.COM# CDDL HEADER END 2011838SLiane.Praza@Sun.COM# 2111838SLiane.Praza@Sun.COM 2211838SLiane.Praza@Sun.COM# 2312200SMark.J.Nelson@Oracle.COM# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 2411838SLiane.Praza@Sun.COM# 2511838SLiane.Praza@Sun.COM 2611838SLiane.Praza@Sun.COMinclude $(SRC)/Makefile.master 2711838SLiane.Praza@Sun.COMinclude $(SRC)/Makefile.buildnum 2811838SLiane.Praza@Sun.COM 2911838SLiane.Praza@Sun.COM# 3011838SLiane.Praza@Sun.COM# Make sure we're getting a consistent execution environment for the 3111838SLiane.Praza@Sun.COM# embedded scripts. 3211838SLiane.Praza@Sun.COM# 3311838SLiane.Praza@Sun.COMSHELL= /usr/bin/ksh93 3411838SLiane.Praza@Sun.COM 3511838SLiane.Praza@Sun.COM# 3611838SLiane.Praza@Sun.COM# To suppress package dependency generation on any system, regardless 3711838SLiane.Praza@Sun.COM# of how it was installed, set SUPPRESSPKGDEP=true in the build 3811838SLiane.Praza@Sun.COM# environment. 3911838SLiane.Praza@Sun.COM# 4012349SMark.J.Nelson@Oracle.COMSUPPRESSPKGDEP= false 4111838SLiane.Praza@Sun.COM 4211838SLiane.Praza@Sun.COM# 4311838SLiane.Praza@Sun.COM# Comment this line out or set "PKGDEBUG=" in your build environment 4411838SLiane.Praza@Sun.COM# to get more verbose output from the make processes in usr/src/pkg 4511838SLiane.Praza@Sun.COM# 4611838SLiane.Praza@Sun.COMPKGDEBUG= @ 4711838SLiane.Praza@Sun.COM 4811838SLiane.Praza@Sun.COM# 4911838SLiane.Praza@Sun.COM# Cross platform packaging notes 5011838SLiane.Praza@Sun.COM# 5111838SLiane.Praza@Sun.COM# By default, we package the proto area from the same architecture as 5211838SLiane.Praza@Sun.COM# the packaging build. In other words, if you're running nightly or 5311838SLiane.Praza@Sun.COM# bldenv on an x86 platform, it will take objects from the x86 proto 5411838SLiane.Praza@Sun.COM# area and use them to create x86 repositories. 5511838SLiane.Praza@Sun.COM# 5611838SLiane.Praza@Sun.COM# If you want to create repositories for an architecture that's 5711838SLiane.Praza@Sun.COM# different from $(uname -p), you do so by setting PKGMACH in your 5811838SLiane.Praza@Sun.COM# build environment. 5911838SLiane.Praza@Sun.COM# 6011838SLiane.Praza@Sun.COM# For this to work correctly, the following must all happen: 6111838SLiane.Praza@Sun.COM# 6211838SLiane.Praza@Sun.COM# 1. You need the desired proto area, which you can get either by 6311838SLiane.Praza@Sun.COM# doing a gatekeeper-style build with the -U option to 6411838SLiane.Praza@Sun.COM# nightly(1), or by using rsync. If you don't do this, you will 6511838SLiane.Praza@Sun.COM# get packaging failures building all packages, because pkgsend 6611838SLiane.Praza@Sun.COM# is unable to find the required binaries. 6711838SLiane.Praza@Sun.COM# 2. You need the desired tools proto area, which you can get in the 6811838SLiane.Praza@Sun.COM# same ways as the normal proto area. If you don't do this, you 6912998SMark.J.Nelson@Oracle.COM# will get packaging failures building onbld, because pkgsend is 7011838SLiane.Praza@Sun.COM# unable to find the tools binaries. 7112998SMark.J.Nelson@Oracle.COM# 3. The remainder of this Makefile should never refer directly to 7211838SLiane.Praza@Sun.COM# $(MACH). Instead, $(PKGMACH) should be used whenever an 7311838SLiane.Praza@Sun.COM# architecture-specific path or token is needed. If this is done 7411838SLiane.Praza@Sun.COM# incorrectly, then packaging will fail, and you will see the 7511838SLiane.Praza@Sun.COM# value of $(uname -p) instead of the value of $(PKGMACH) in the 7611838SLiane.Praza@Sun.COM# commands that fail. 7712998SMark.J.Nelson@Oracle.COM# 4. Each time a rule in this Makefile invokes $(MAKE), it should 7811838SLiane.Praza@Sun.COM# pass PKGMACH=$(PKGMACH) explicitly on the command line. If 7911838SLiane.Praza@Sun.COM# this is done incorrectly, then packaging will fail, and you 8011838SLiane.Praza@Sun.COM# will see the value of $(uname -p) instead of the value of 8111838SLiane.Praza@Sun.COM# $(PKGMACH) in the commands that fail. 8211838SLiane.Praza@Sun.COM# 8311838SLiane.Praza@Sun.COM# Refer also to the convenience targets defined later in this 8411838SLiane.Praza@Sun.COM# Makefile. 8511838SLiane.Praza@Sun.COM# 8611838SLiane.Praza@Sun.COMPKGMACH= $(MACH) 8711838SLiane.Praza@Sun.COM 8811838SLiane.Praza@Sun.COM# 8911838SLiane.Praza@Sun.COM# ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or 9011838SLiane.Praza@Sun.COM# bldenv. These macros translate them into terms of $PKGMACH, instead 9111838SLiane.Praza@Sun.COM# of $ARCH. 9211838SLiane.Praza@Sun.COM# 9311838SLiane.Praza@Sun.COMPKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH): 9411838SLiane.Praza@Sun.COMPKGROOT= $(PKGROOT.cmd:sh) 9511838SLiane.Praza@Sun.COMTOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH): 9611838SLiane.Praza@Sun.COMTOOLSROOT= $(TOOLSROOT.cmd:sh) 9711838SLiane.Praza@Sun.COMPKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/: 9811838SLiane.Praza@Sun.COMPKGDEST= $(PKGDEST.cmd:sh) 9911838SLiane.Praza@Sun.COM 10011838SLiane.Praza@Sun.COM# 10111838SLiane.Praza@Sun.COM# The publish transforms, EXCEPTIONS list, and some manifests need to 10211838SLiane.Praza@Sun.COM# know when we're building open-only and when we're using internal 10311838SLiane.Praza@Sun.COM# crypto bits. 10411838SLiane.Praza@Sun.COM# 10511838SLiane.Praza@Sun.COM# We only use internal crypto when we're doing a closed build, the 10611838SLiane.Praza@Sun.COM# CODESIGN_USER env variable is not set, and ON_CRYPTO_BINS is not set. 10711838SLiane.Praza@Sun.COM# This matches the conditions under which the internal key and cert 10811838SLiane.Praza@Sun.COM# are needed for the packaged objects. 10911838SLiane.Praza@Sun.COM# 11011838SLiane.Praza@Sun.COM# We use X_FLAG, as exported by nightly and bldenv, to decide when we 11111838SLiane.Praza@Sun.COM# need IHV-related exceptions for protocmp. 11211838SLiane.Praza@Sun.COM# 11311838SLiane.Praza@Sun.COM$(CLOSED_BUILD)OPEN_ONLY_BUILD= $(POUND_SIGN) 11411838SLiane.Praza@Sun.COM 11511838SLiane.Praza@Sun.COMUSE_INTERNAL_CRYPTO= $(POUND_SIGN) 11611838SLiane.Praza@Sun.COMUI1= $(CODESIGN_USER:%=$(POUND_SIGN)) 11711838SLiane.Praza@Sun.COM$(UI1)UI2= $(ON_CRYPTO_BINS:%=$(POUND_SIGN)) 11811838SLiane.Praza@Sun.COM$(CLOSED_BUILD)USE_INTERNAL_CRYPTO= $(UI1)$(UI2) 11911838SLiane.Praza@Sun.COMUSE_SIGNED_CRYPTO= 12011838SLiane.Praza@Sun.COM$(USE_INTERNAL_CRYPTO)USE_SIGNED_CRYPTO= $(POUND_SIGN) 12111838SLiane.Praza@Sun.COM 12211838SLiane.Praza@Sun.COMX_FLAG= n 12311838SLiane.Praza@Sun.COMIHV_COPY_BUILD1= $(X_FLAG:n%=$(POUND_SIGN)%) 12411838SLiane.Praza@Sun.COMIHV_COPY_BUILD= $(IHV_COPY_BUILD1:y%=%) 12511838SLiane.Praza@Sun.COM 12611838SLiane.Praza@Sun.COM 12711838SLiane.Praza@Sun.COMEXCEPTIONS= packaging 12811838SLiane.Praza@Sun.COM$(CLOSED_BUILD)EXCEPTIONS += packaging.closed 12911838SLiane.Praza@Sun.COM$(OPEN_ONLY_BUILD)EXCEPTIONS += packaging.open 13011838SLiane.Praza@Sun.COM$(IHV_COPY_BUILD)EXCEPTIONS += packaging.ihv 13111838SLiane.Praza@Sun.COM 13211838SLiane.Praza@Sun.COMPKGMOGRIFY= pkgmogrify 13311838SLiane.Praza@Sun.COM 13411838SLiane.Praza@Sun.COM# 13511838SLiane.Praza@Sun.COM# Always build the redistributable repository, but only build the 13611838SLiane.Praza@Sun.COM# nonredistributable bits if we have access to closed source. 13711838SLiane.Praza@Sun.COM# 13811838SLiane.Praza@Sun.COM# Some objects that result from the closed build are still 13911838SLiane.Praza@Sun.COM# redistributable, and should be packaged as part of an open-only 14011838SLiane.Praza@Sun.COM# build. Access to those objects is provided via the closed-bins 14111838SLiane.Praza@Sun.COM# tarball. See usr/src/tools/scripts/bindrop.sh for details. 14211838SLiane.Praza@Sun.COM# 14311838SLiane.Praza@Sun.COMREPOS= redist 14411838SLiane.Praza@Sun.COM$(CLOSED_BUILD)REPOS += extra 14511838SLiane.Praza@Sun.COM 14611838SLiane.Praza@Sun.COM# 14711838SLiane.Praza@Sun.COM# The packages directory will contain the processed manifests as 14811838SLiane.Praza@Sun.COM# direct build targets and subdirectories for package metadata extracted 14911838SLiane.Praza@Sun.COM# incidentally during manifest processing. 15011838SLiane.Praza@Sun.COM# 15111838SLiane.Praza@Sun.COM# Nothing underneath $(PDIR) should ever be managed by SCM. 15211838SLiane.Praza@Sun.COM# 15311838SLiane.Praza@Sun.COMPDIR= packages.$(PKGMACH) 15411838SLiane.Praza@Sun.COM 15511838SLiane.Praza@Sun.COM# 15611838SLiane.Praza@Sun.COM# The tools proto must be specified for dependency generation. 15711838SLiane.Praza@Sun.COM# Publication from the tools proto area is managed in the 15811838SLiane.Praza@Sun.COM# publication rule. 15911838SLiane.Praza@Sun.COM# 16012403SMark.J.Nelson@Oracle.COM$(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT) 16111838SLiane.Praza@Sun.COM 16211838SLiane.Praza@Sun.COMPKGPUBLISHER= $(PKGPUBLISHER_REDIST) 16311838SLiane.Praza@Sun.COM$(PKGDEST)/repo.extra:= PKGPUBLISHER= $(PKGPUBLISHER_NONREDIST) 16411838SLiane.Praza@Sun.COM 16511838SLiane.Praza@Sun.COM# 16611838SLiane.Praza@Sun.COM# To get these defaults, manifests should simply refer to $(PKGVERS). 16711838SLiane.Praza@Sun.COM# 16811838SLiane.Praza@Sun.COMPKGVERS_COMPONENT= 0.$(RELEASE) 16911838SLiane.Praza@Sun.COMPKGVERS_BUILTON= $(RELEASE) 17011838SLiane.Praza@Sun.COMPKGVERS_BRANCH= 0.$(ONNV_BUILDNUM) 17111838SLiane.Praza@Sun.COMPKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH) 17211838SLiane.Praza@Sun.COM 17311838SLiane.Praza@Sun.COM# 17411838SLiane.Praza@Sun.COM# The ARCH32 and ARCH64 macros are used in the manifests to express 17511838SLiane.Praza@Sun.COM# architecture-specific subdirectories in the installation paths 17611838SLiane.Praza@Sun.COM# for isaexec'd commands. 17711838SLiane.Praza@Sun.COM# 17811838SLiane.Praza@Sun.COM# We can't simply use $(MACH32) and $(MACH64) here, because they're 17911838SLiane.Praza@Sun.COM# only defined for the build architecture. To do cross-platform 18011838SLiane.Praza@Sun.COM# packaging, we need both values. 18111838SLiane.Praza@Sun.COM# 18211838SLiane.Praza@Sun.COMi386_ARCH32= i86 18311838SLiane.Praza@Sun.COMsparc_ARCH32= sparcv7 18411838SLiane.Praza@Sun.COMi386_ARCH64= amd64 18511838SLiane.Praza@Sun.COMsparc_ARCH64= sparcv9 18611838SLiane.Praza@Sun.COM 18711838SLiane.Praza@Sun.COM# 18811838SLiane.Praza@Sun.COM# macros and transforms needed by pkgmogrify 18911838SLiane.Praza@Sun.COM# 19011838SLiane.Praza@Sun.COM# If you append to this list using target-specific assignments (:=), 19111838SLiane.Praza@Sun.COM# be very careful that the targets are of the form $(PDIR)/pkgname. If 19211838SLiane.Praza@Sun.COM# you use a higher level target, or a package list, you'll trigger a 19311838SLiane.Praza@Sun.COM# complete reprocessing of all manifests because they'll fail command 19411838SLiane.Praza@Sun.COM# dependency checking. 19511838SLiane.Praza@Sun.COM# 19612616Sdp@eng.sun.comPM_TRANSFORMS= common_actions publish restart_fmri defaults extract_metadata 19711838SLiane.Praza@Sun.COMPM_INC= transforms 19811838SLiane.Praza@Sun.COM 19911838SLiane.Praza@Sun.COMPKGMOG_DEFINES= \ 20011838SLiane.Praza@Sun.COM i386_ONLY=$(POUND_SIGN) \ 20111838SLiane.Praza@Sun.COM sparc_ONLY=$(POUND_SIGN) \ 20211838SLiane.Praza@Sun.COM $(PKGMACH)_ONLY= \ 20311838SLiane.Praza@Sun.COM ARCH=$(PKGMACH) \ 20411838SLiane.Praza@Sun.COM ARCH32=$($(PKGMACH)_ARCH32) \ 20511838SLiane.Praza@Sun.COM ARCH64=$($(PKGMACH)_ARCH64) \ 20611838SLiane.Praza@Sun.COM PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \ 20711838SLiane.Praza@Sun.COM PKGVERS_BUILTON=$(PKGVERS_BUILTON) \ 20811838SLiane.Praza@Sun.COM PKGVERS_BRANCH=$(PKGVERS_BRANCH) \ 20911838SLiane.Praza@Sun.COM PKGVERS=$(PKGVERS) \ 21011838SLiane.Praza@Sun.COM CLOSED_BUILD=$(CLOSED_BUILD) \ 21111838SLiane.Praza@Sun.COM OPEN_BUILD=$(OPEN_ONLY_BUILD) \ 21211838SLiane.Praza@Sun.COM USE_INTERNAL_CRYPTO=$(USE_INTERNAL_CRYPTO) \ 21311838SLiane.Praza@Sun.COM USE_SIGNED_CRYPTO=$(USE_SIGNED_CRYPTO) 21411838SLiane.Praza@Sun.COM 21511838SLiane.Praza@Sun.COMPKGDEP_TOKENS_i386= \ 21611838SLiane.Praza@Sun.COM 'PLATFORM=i86hvm' \ 21711838SLiane.Praza@Sun.COM 'PLATFORM=i86pc' \ 21811838SLiane.Praza@Sun.COM 'PLATFORM=i86xpv' \ 21911838SLiane.Praza@Sun.COM 'ISALIST=amd64' \ 22011838SLiane.Praza@Sun.COM 'ISALIST=i386' 22111838SLiane.Praza@Sun.COMPKGDEP_TOKENS_sparc= \ 22211838SLiane.Praza@Sun.COM 'PLATFORM=sun4u' \ 22311838SLiane.Praza@Sun.COM 'PLATFORM=sun4v' \ 22411838SLiane.Praza@Sun.COM 'ISALIST=sparcv9' \ 22511838SLiane.Praza@Sun.COM 'ISALIST=sparc' 22611838SLiane.Praza@Sun.COMPKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH)) 22711838SLiane.Praza@Sun.COM 22811838SLiane.Praza@Sun.COM# 22911838SLiane.Praza@Sun.COM# The package lists are generated with $(PKGDEP_TYPE) as their 23011838SLiane.Praza@Sun.COM# dependency types, so that they can be included by either an 23111838SLiane.Praza@Sun.COM# incorporation or a group package. 23211838SLiane.Praza@Sun.COM# 23311838SLiane.Praza@Sun.COM$(PDIR)/osnet-redist.mog $(PDIR)/osnet-extra.mog:= PKGDEP_TYPE= require 23411838SLiane.Praza@Sun.COM$(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate 23511838SLiane.Praza@Sun.COM 23611838SLiane.Praza@Sun.COMPKGDEP_INCORP= \ 23711838SLiane.Praza@Sun.COM depend fmri=consolidation/osnet/osnet-incorporation type=require 23811838SLiane.Praza@Sun.COM 23911838SLiane.Praza@Sun.COM# 24011838SLiane.Praza@Sun.COM# All packaging build products should go into $(PDIR), so they don't 24111838SLiane.Praza@Sun.COM# need to be included separately in CLOBBERFILES. 24211838SLiane.Praza@Sun.COM# 24311838SLiane.Praza@Sun.COMCLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) 24411838SLiane.Praza@Sun.COM 24511838SLiane.Praza@Sun.COM# 24611838SLiane.Praza@Sun.COM# By default, PKGS will list all manifests. To build and/or publish a 24711838SLiane.Praza@Sun.COM# subset of packages, override this on the command line or in the 24811838SLiane.Praza@Sun.COM# build environment and then reference (implicitly or explicitly) the all 24911838SLiane.Praza@Sun.COM# or install targets. 25011838SLiane.Praza@Sun.COM# 25111838SLiane.Praza@Sun.COMMANIFESTS :sh= (cd manifests; print *.mf) 25211838SLiane.Praza@Sun.COMPKGS= $(MANIFESTS:%.mf=%) 25311838SLiane.Praza@Sun.COMDEP_PKGS= $(PKGS:%=$(PDIR)/%.dep) 25411838SLiane.Praza@Sun.COMPROC_PKGS= $(PKGS:%=$(PDIR)/%.mog) 25511838SLiane.Praza@Sun.COM 25611838SLiane.Praza@Sun.COM# 25711838SLiane.Praza@Sun.COM# Track the synthetic manifests separately so we can properly express 25811838SLiane.Praza@Sun.COM# build rules and dependencies. The synthetic and real packages use 25911838SLiane.Praza@Sun.COM# different sets of transforms and macros for pkgmogrify. 26011838SLiane.Praza@Sun.COM# 26111838SLiane.Praza@Sun.COMSYNTH_PKGS= osnet-incorporation osnet-redist 26211838SLiane.Praza@Sun.COM$(CLOSED_BUILD)SYNTH_PKGS += osnet-extra 26311838SLiane.Praza@Sun.COMDEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep) 26411838SLiane.Praza@Sun.COMPROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog) 26511838SLiane.Praza@Sun.COM 26611838SLiane.Praza@Sun.COM# 26711838SLiane.Praza@Sun.COM# For each package, we determine the target repository based on 26811838SLiane.Praza@Sun.COM# manifest-embedded metadata. Because we make that determination on 26911838SLiane.Praza@Sun.COM# the fly, the publication target cannot be expressed as a 27011838SLiane.Praza@Sun.COM# subdirectory inside the unknown-by-the-makefile target repository. 27111838SLiane.Praza@Sun.COM# 27211838SLiane.Praza@Sun.COM# In order to limit the target set to real files in known locations, 27311838SLiane.Praza@Sun.COM# we use a ".pub" file in $(PDIR) for each processed manifest, regardless 27411838SLiane.Praza@Sun.COM# of content or target repository. 27511838SLiane.Praza@Sun.COM# 27611838SLiane.Praza@Sun.COMPUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub) 27711838SLiane.Praza@Sun.COM 27811838SLiane.Praza@Sun.COM# 27911838SLiane.Praza@Sun.COM# Any given repository- and status-specific package list may be empty, 28011838SLiane.Praza@Sun.COM# but we can only determine that dynamically, so we always generate all 28111838SLiane.Praza@Sun.COM# lists for each repository we're building. 28211838SLiane.Praza@Sun.COM# 28311838SLiane.Praza@Sun.COM# The meanings of each package status are as follows: 28411838SLiane.Praza@Sun.COM# 28511838SLiane.Praza@Sun.COM# PKGSTAT meaning 28611838SLiane.Praza@Sun.COM# ---------- ---------------------------------------------------- 28711838SLiane.Praza@Sun.COM# noincorp Do not include in incorporation or group package 28811838SLiane.Praza@Sun.COM# obsolete Include in incorporation, but not group package 28911927SLiane.Praza@Sun.COM# renamed Include in incorporation, but not group package 29011838SLiane.Praza@Sun.COM# current Include in incorporation and group package 29111838SLiane.Praza@Sun.COM# 29211838SLiane.Praza@Sun.COM# Since the semantics of the "noincorp" package status dictate that 29311838SLiane.Praza@Sun.COM# such packages are not included in the incorporation or group packages, 29411838SLiane.Praza@Sun.COM# there is no need to build noincorp package lists. 29511838SLiane.Praza@Sun.COM# 29611838SLiane.Praza@Sun.COMPKGLISTS= \ 29711838SLiane.Praza@Sun.COM $(REPOS:%=$(PDIR)/packages.%.current) \ 29811838SLiane.Praza@Sun.COM $(REPOS:%=$(PDIR)/packages.%.renamed) \ 29911838SLiane.Praza@Sun.COM $(REPOS:%=$(PDIR)/packages.%.obsolete) 30011838SLiane.Praza@Sun.COM 30111838SLiane.Praza@Sun.COM.KEEP_STATE: 30211838SLiane.Praza@Sun.COM 30311838SLiane.Praza@Sun.COM.PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \ 30412349SMark.J.Nelson@Oracle.COM $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS) 30511838SLiane.Praza@Sun.COM 30611838SLiane.Praza@Sun.COM# 30711838SLiane.Praza@Sun.COM# For a single manifest, the dependency chain looks like this: 30811838SLiane.Praza@Sun.COM# 30911838SLiane.Praza@Sun.COM# raw manifest (mypkg.mf) 31011838SLiane.Praza@Sun.COM# | 31111838SLiane.Praza@Sun.COM# | use pkgmogrify to process raw manifest 31211838SLiane.Praza@Sun.COM# | 31311838SLiane.Praza@Sun.COM# processed manifest (mypkg.mog) 31411838SLiane.Praza@Sun.COM# | 31511838SLiane.Praza@Sun.COM# * | use pkgdepend generate to generate dependencies 31611838SLiane.Praza@Sun.COM# | 31711838SLiane.Praza@Sun.COM# manifest with TBD dependencies (mypkg.dep) 31811838SLiane.Praza@Sun.COM# | 31911838SLiane.Praza@Sun.COM# % | use pkgdepend resolve to resolve dependencies 32011838SLiane.Praza@Sun.COM# | 32111838SLiane.Praza@Sun.COM# manifest with dependencies resolved (mypkg.res) 32211838SLiane.Praza@Sun.COM# | 32311838SLiane.Praza@Sun.COM# | use pkgsend to publish the package 32411838SLiane.Praza@Sun.COM# | 32511838SLiane.Praza@Sun.COM# placeholder to indicate successful publication (mypkg.pub) 32611838SLiane.Praza@Sun.COM# 32711838SLiane.Praza@Sun.COM# * This may be suppressed via SUPPRESSPKGDEP. The resulting 32811838SLiane.Praza@Sun.COM# packages will install correctly, but care must be taken to 32911838SLiane.Praza@Sun.COM# install all dependencies, because pkg will not have the input 33011838SLiane.Praza@Sun.COM# it needs to determine this automatically. 33111838SLiane.Praza@Sun.COM# 33211838SLiane.Praza@Sun.COM# % This is included in this diagram to make the picture complete, but 33311838SLiane.Praza@Sun.COM# this is a point of synchronization in the build process. 33411838SLiane.Praza@Sun.COM# Dependency resolution is actually done once on the entire set of 33511838SLiane.Praza@Sun.COM# manifests, not on a per-package basis. 33611838SLiane.Praza@Sun.COM# 33711838SLiane.Praza@Sun.COM# The full dependency chain for generating everything that needs to be 33811838SLiane.Praza@Sun.COM# published, without actually publishing it, looks like this: 33911838SLiane.Praza@Sun.COM# 34011838SLiane.Praza@Sun.COM# processed synthetic packages 34111838SLiane.Praza@Sun.COM# | | 34211838SLiane.Praza@Sun.COM# package lists synthetic package manifests 34311838SLiane.Praza@Sun.COM# | 34411838SLiane.Praza@Sun.COM# processed real packages 34511838SLiane.Praza@Sun.COM# | | 34611838SLiane.Praza@Sun.COM# package dir real package manifests 34711838SLiane.Praza@Sun.COM# 34811838SLiane.Praza@Sun.COM# Here, each item is a set of real or synthetic packages. For this 34911838SLiane.Praza@Sun.COM# portion of the build, no reference is made to the proto area. It is 35011838SLiane.Praza@Sun.COM# therefore suitable for the "all" target, as opposed to "install." 35111838SLiane.Praza@Sun.COM# 35211838SLiane.Praza@Sun.COM# Since each of these steps is expressed explicitly, "all" need only 35311838SLiane.Praza@Sun.COM# depend on the head of the chain. 35411838SLiane.Praza@Sun.COM# 35511838SLiane.Praza@Sun.COM# From the end of manifest processing, the publication dependency 35611838SLiane.Praza@Sun.COM# chain looks like this: 35711838SLiane.Praza@Sun.COM# 35811838SLiane.Praza@Sun.COM# repository metadata (catalogs and search indices) 35911838SLiane.Praza@Sun.COM# | 36011838SLiane.Praza@Sun.COM# | pkg.depotd 36111838SLiane.Praza@Sun.COM# | 36211838SLiane.Praza@Sun.COM# published packages 36311838SLiane.Praza@Sun.COM# | | 36411838SLiane.Praza@Sun.COM# | | pkgsend publish 36511838SLiane.Praza@Sun.COM# | | 36611838SLiane.Praza@Sun.COM# repositories resolved dependencies 36711838SLiane.Praza@Sun.COM# | | 36811838SLiane.Praza@Sun.COM# pkgsend | | pkgdepend resolve 36911838SLiane.Praza@Sun.COM# create-repository | 37011838SLiane.Praza@Sun.COM# | generated dependencies 37111838SLiane.Praza@Sun.COM# repo directories | 37211838SLiane.Praza@Sun.COM# | pkgdepend 37311838SLiane.Praza@Sun.COM# | 37411838SLiane.Praza@Sun.COM# processed manifests 37511838SLiane.Praza@Sun.COM# 37612998SMark.J.Nelson@Oracle.COM 37712846SMark.J.Nelson@Oracle.COMALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH) 37812846SMark.J.Nelson@Oracle.COM 37912846SMark.J.Nelson@Oracle.COMall: $(ALL_TARGETS) 38011838SLiane.Praza@Sun.COM 38111838SLiane.Praza@Sun.COM# 38211838SLiane.Praza@Sun.COM# This will build the directory to contain the processed manifests 38311838SLiane.Praza@Sun.COM# and the metadata symlinks. 38411838SLiane.Praza@Sun.COM# 38511838SLiane.Praza@Sun.COM$(PDIR): 38611838SLiane.Praza@Sun.COM @print "Creating $(@)" 38711838SLiane.Praza@Sun.COM $(PKGDEBUG)$(INS.dir) 38811838SLiane.Praza@Sun.COM 38911838SLiane.Praza@Sun.COM# 39011838SLiane.Praza@Sun.COM# This rule resolves dependencies across all published manifests. 39111838SLiane.Praza@Sun.COM# 39212995SMark.J.Nelson@Oracle.COM# We shouldn't have to ignore the error from pkgdepend, but until 39312995SMark.J.Nelson@Oracle.COM# 16012 and its dependencies are resolved, pkgdepend will always exit 39412995SMark.J.Nelson@Oracle.COM# with an error. 39511838SLiane.Praza@Sun.COM# 39611838SLiane.Praza@Sun.COM$(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS) 39711838SLiane.Praza@Sun.COM -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \ 39811838SLiane.Praza@Sun.COM print "Suppressing dependency resolution"; \ 39911838SLiane.Praza@Sun.COM for p in $(DEP_PKGS:%.dep=%); do \ 40011838SLiane.Praza@Sun.COM $(CP) $$p.dep $$p.res; \ 40111838SLiane.Praza@Sun.COM done; \ 40211838SLiane.Praza@Sun.COM else \ 40311838SLiane.Praza@Sun.COM print "Resolving dependencies"; \ 40412995SMark.J.Nelson@Oracle.COM pkgdepend resolve -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \ 405*13011SMark.J.Nelson@Oracle.COM for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \ 40612403SMark.J.Nelson@Oracle.COM if [ "$$(print $$p.metadata.*)" = \ 40712403SMark.J.Nelson@Oracle.COM "$$(print $$p.metadata.noincorp.*)" ]; \ 40812403SMark.J.Nelson@Oracle.COM then \ 40912403SMark.J.Nelson@Oracle.COM print "Removing dependency versions from $$p"; \ 41012403SMark.J.Nelson@Oracle.COM $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \ 41112403SMark.J.Nelson@Oracle.COM -O $$p.res -I transforms \ 41212403SMark.J.Nelson@Oracle.COM strip_versions $$p.dep.res; \ 41312403SMark.J.Nelson@Oracle.COM $(RM) $$p.dep.res; \ 41412403SMark.J.Nelson@Oracle.COM else \ 41512403SMark.J.Nelson@Oracle.COM $(MV) $$p.dep.res $$p.res; \ 41612403SMark.J.Nelson@Oracle.COM fi; \ 41711838SLiane.Praza@Sun.COM done; \ 41811838SLiane.Praza@Sun.COM fi 41911838SLiane.Praza@Sun.COM $(PKGDEBUG)$(TOUCH) $(@) 42011838SLiane.Praza@Sun.COM 42112846SMark.J.Nelson@Oracle.COMinstall: $(ALL_TARGETS) repository-metadata 42211838SLiane.Praza@Sun.COM 42311838SLiane.Praza@Sun.COMrepository-metadata: publish_pkgs 42411838SLiane.Praza@Sun.COM @print "Creating repository metadata" 42511838SLiane.Praza@Sun.COM $(PKGDEBUG)for r in $(REPOS); do \ 42611838SLiane.Praza@Sun.COM /usr/lib/pkg.depotd -d $(PKGDEST)/repo.$$r \ 42711838SLiane.Praza@Sun.COM --add-content --exit-ready; \ 42811838SLiane.Praza@Sun.COM done 42911838SLiane.Praza@Sun.COM 43011838SLiane.Praza@Sun.COM# 43111838SLiane.Praza@Sun.COM# Since we create zero-length processed manifests for a graceful abort 43211838SLiane.Praza@Sun.COM# from pkgmogrify, we need to detect that here and make no effort to 43311838SLiane.Praza@Sun.COM# publish the package. 43411838SLiane.Praza@Sun.COM# 43511838SLiane.Praza@Sun.COM# For all other packages, we publish them regardless of status. We 43611838SLiane.Praza@Sun.COM# derive the target repository as a component of the metadata-derived 43711838SLiane.Praza@Sun.COM# symlink for each package. 43811838SLiane.Praza@Sun.COM# 43911838SLiane.Praza@Sun.COMpublish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS) 44011838SLiane.Praza@Sun.COM 44112998SMark.J.Nelson@Oracle.COM# 44212998SMark.J.Nelson@Oracle.COM# Before publishing, we want to pull the license files from $CODEMGR_WS 44312998SMark.J.Nelson@Oracle.COM# into the proto area. This allows us to NOT pass $SRC (or 44412998SMark.J.Nelson@Oracle.COM# $CODEMGR_WS) as a basedir for publication. 44512998SMark.J.Nelson@Oracle.COM# 44612998SMark.J.Nelson@Oracle.COM$(PUB_PKGS): stage-licenses 44711838SLiane.Praza@Sun.COM 44811838SLiane.Praza@Sun.COM# 44911838SLiane.Praza@Sun.COM# Initialize the empty on-disk repositories 45011838SLiane.Praza@Sun.COM# 45111838SLiane.Praza@Sun.COM$(REPOS:%=$(PKGDEST)/repo.%): 45211838SLiane.Praza@Sun.COM @print "Initializing $(@F)" 45311838SLiane.Praza@Sun.COM $(PKGDEBUG)$(INS.dir) 45411838SLiane.Praza@Sun.COM $(PKGDEBUG)pkgsend -s file://$(@) create-repository \ 45511838SLiane.Praza@Sun.COM --set-property publisher.prefix=$(PKGPUBLISHER) 45611838SLiane.Praza@Sun.COM 45711838SLiane.Praza@Sun.COM# 45811838SLiane.Praza@Sun.COM# rule to process real manifests 45911838SLiane.Praza@Sun.COM# 46011838SLiane.Praza@Sun.COM# To allow redistributability and package status to change, we must 46111838SLiane.Praza@Sun.COM# remove not only the actual build target (the processed manifest), but 46211838SLiane.Praza@Sun.COM# also the incidental ones (the metadata-derived symlinks). 46311838SLiane.Praza@Sun.COM# 46411838SLiane.Praza@Sun.COM# If pkgmogrify exits cleanly but fails to create the specified output 46511838SLiane.Praza@Sun.COM# file, it means that it encountered an abort directive. That means 46611838SLiane.Praza@Sun.COM# that this package should not be published for this particular build 46711838SLiane.Praza@Sun.COM# environment. Since we can't prune such packages from $(PKGS) 46811838SLiane.Praza@Sun.COM# retroactively, we need to create an empty target file to keep make 46911838SLiane.Praza@Sun.COM# from trying to rebuild it every time. For these empty targets, we 47011838SLiane.Praza@Sun.COM# do not create metadata symlinks. 47111838SLiane.Praza@Sun.COM# 47211838SLiane.Praza@Sun.COM# Automatic dependency resolution to files is also done at this phase of 47311838SLiane.Praza@Sun.COM# processing. The skipped packages are skipped due to existing bugs 47411838SLiane.Praza@Sun.COM# in pkgdepend. 47511838SLiane.Praza@Sun.COM# 47611838SLiane.Praza@Sun.COM# The incorporation dependency is tricky: it needs to go into all 47711838SLiane.Praza@Sun.COM# current and renamed manifests (ie all incorporated packages), but we 47811838SLiane.Praza@Sun.COM# don't know which those are until after we run pkgmogrify. So 47911838SLiane.Praza@Sun.COM# instead of expressing it as a transform, we tack it on ex post facto. 48011838SLiane.Praza@Sun.COM# 48111838SLiane.Praza@Sun.COM# Implementation notes: 48211838SLiane.Praza@Sun.COM# 48311838SLiane.Praza@Sun.COM# - The first $(RM) must not match other manifests, or we'll run into 48411838SLiane.Praza@Sun.COM# race conditions with parallel manifest processing. 48511838SLiane.Praza@Sun.COM# 48611838SLiane.Praza@Sun.COM# - The make macros [ie $(MACRO)] are evaluated when the makefile is 48711838SLiane.Praza@Sun.COM# read in, and will result in a fixed, macro-expanded rule for each 48811838SLiane.Praza@Sun.COM# target enumerated in $(PROC_PKGS). 48911838SLiane.Praza@Sun.COM# 49011838SLiane.Praza@Sun.COM# - The shell variables (ie $$VAR) are assigned on the fly, as the rule 49111838SLiane.Praza@Sun.COM# is executed. The results may only be referenced in the shell in 49211838SLiane.Praza@Sun.COM# which they are assigned, so from the perspective of make, all code 49311838SLiane.Praza@Sun.COM# that needs these variables needs to be part of the same line of 49411838SLiane.Praza@Sun.COM# code. Hence the use of command separators and line continuation 49511838SLiane.Praza@Sun.COM# characters. 49611838SLiane.Praza@Sun.COM# 49711838SLiane.Praza@Sun.COM# - The extract_metadata transforms are designed to spit out shell 49812616Sdp@eng.sun.com# variable assignments to stdout. Those are published to the 49912616Sdp@eng.sun.com# .vars temporary files, and then used as input to the eval 50012616Sdp@eng.sun.com# statement. This is done in stages specifically so that pkgmogrify 50112616Sdp@eng.sun.com# can signal failure if the manifest has a syntactic or other error. 50212616Sdp@eng.sun.com# The eval statement should begin with the default values, and the 50312616Sdp@eng.sun.com# output from pkgmogrify (if any) should be in the form of a 50412616Sdp@eng.sun.com# variable assignment to override those defaults. 50511838SLiane.Praza@Sun.COM# 50611838SLiane.Praza@Sun.COM# - When this rule completes execution, it must leave an updated 50711838SLiane.Praza@Sun.COM# target file ($@) in place, or make will reprocess the package 50811838SLiane.Praza@Sun.COM# every time it encounters it as a dependency. Hence the "touch" 50911838SLiane.Praza@Sun.COM# statement to ensure that the target is created, even when 51011838SLiane.Praza@Sun.COM# pkgmogrify encounters an abort in the publish transforms. This 51111838SLiane.Praza@Sun.COM# will not cause publication failures when switching build 51211838SLiane.Praza@Sun.COM# environments, because $(CLOSED_BUILD) and $(OPEN_ONLY) are 51311838SLiane.Praza@Sun.COM# referenced in $(PKGMOG_DEFINES), and changes will therefore 51411838SLiane.Praza@Sun.COM# trigger a rebuild for command dependency failure. (Command 51511838SLiane.Praza@Sun.COM# dependency checking is turned on by .KEEP_STATE: above.) 51611838SLiane.Praza@Sun.COM# 51711838SLiane.Praza@Sun.COM 51811838SLiane.Praza@Sun.COM.SUFFIXES: .mf .mog .dep .res .pub 51911838SLiane.Praza@Sun.COM 52011838SLiane.Praza@Sun.COM$(PDIR)/%.mog: manifests/%.mf 52111838SLiane.Praza@Sun.COM @print "Processing manifest $(<F)" 52212994SMark.J.Nelson@Oracle.COM @pkgfmt -c $< 52311838SLiane.Praza@Sun.COM $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \ 52412998SMark.J.Nelson@Oracle.COM $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars 52512616Sdp@eng.sun.com $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \ 52612616Sdp@eng.sun.com $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \ 52712616Sdp@eng.sun.com $(<) $(PM_TRANSFORMS) 52812616Sdp@eng.sun.com $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \ 52912616Sdp@eng.sun.com `$(CAT) -s $(@).vars`; \ 53011838SLiane.Praza@Sun.COM if [ -f $(@) ]; then \ 53112403SMark.J.Nelson@Oracle.COM if [ "$$NODEPEND" != "false" ]; then \ 53211838SLiane.Praza@Sun.COM $(TOUCH) $(@:%.mog=%.nodepend); \ 53311838SLiane.Praza@Sun.COM fi; \ 53411838SLiane.Praza@Sun.COM $(LN) -s $(@F) \ 53511838SLiane.Praza@Sun.COM $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \ 53611838SLiane.Praza@Sun.COM if [ \( "$$PKGSTAT" = "current" \) -o \ 53711838SLiane.Praza@Sun.COM \( "$$PKGSTAT" = "renamed" \) ]; \ 53811838SLiane.Praza@Sun.COM then print $(PKGDEP_INCORP) >> $(@); \ 53911838SLiane.Praza@Sun.COM fi; \ 54012998SMark.J.Nelson@Oracle.COM print $$LICS > $(@:%.mog=%.lics); \ 54111838SLiane.Praza@Sun.COM else \ 54212998SMark.J.Nelson@Oracle.COM $(TOUCH) $(@) $(@:%.mog=%.lics); \ 54311838SLiane.Praza@Sun.COM fi 54412616Sdp@eng.sun.com $(PKGDEBUG)$(RM) $(@).vars 54511838SLiane.Praza@Sun.COM 54611838SLiane.Praza@Sun.COM$(PDIR)/%.dep: $(PDIR)/%.mog 54711838SLiane.Praza@Sun.COM @print "Generating dependencies for $(<F)" 54811838SLiane.Praza@Sun.COM $(PKGDEBUG)$(RM) $(@) 54911838SLiane.Praza@Sun.COM $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \ 55011838SLiane.Praza@Sun.COM pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \ 55111838SLiane.Praza@Sun.COM $(PKGROOT) > $(@); \ 55211838SLiane.Praza@Sun.COM else \ 55311838SLiane.Praza@Sun.COM $(CP) $(<) $(@); \ 55411838SLiane.Praza@Sun.COM fi 55511838SLiane.Praza@Sun.COM 55611838SLiane.Praza@Sun.COM# 55711838SLiane.Praza@Sun.COM# The full chain implies that there should be a .dep.res suffix rule, 55811838SLiane.Praza@Sun.COM# but dependency generation is done on a set of manifests, rather than 55911838SLiane.Praza@Sun.COM# on a per-manifest basis. Instead, see the gendeps rule above. 56011838SLiane.Praza@Sun.COM# 56111838SLiane.Praza@Sun.COM 56211838SLiane.Praza@Sun.COM$(PDIR)/%.pub: $(PDIR)/%.res 56311838SLiane.Praza@Sun.COM $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \ 56411838SLiane.Praza@Sun.COM r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \ 56511838SLiane.Praza@Sun.COM if [ -s $(<) ]; then \ 56611838SLiane.Praza@Sun.COM print "Publishing $(@F:%.pub=%) to $$r repository"; \ 56711838SLiane.Praza@Sun.COM pkgsend -s file://$(PKGDEST)/repo.$$r publish \ 56812998SMark.J.Nelson@Oracle.COM -d $(PKGROOT) -d $(TOOLSROOT) \ 56912998SMark.J.Nelson@Oracle.COM -d license_files -d $(PKGROOT)/licenses \ 57012998SMark.J.Nelson@Oracle.COM --fmri-in-manifest --no-index --no-catalog $(<) \ 57111838SLiane.Praza@Sun.COM > /dev/null; \ 57211838SLiane.Praza@Sun.COM fi; \ 57311838SLiane.Praza@Sun.COM $(TOUCH) $(@); 57411838SLiane.Praza@Sun.COM 57511838SLiane.Praza@Sun.COM# 57611838SLiane.Praza@Sun.COM# rule to build the synthetic manifests 57711838SLiane.Praza@Sun.COM# 57811838SLiane.Praza@Sun.COM# This rule necessarily has PKGDEP_TYPE that changes according to 57911838SLiane.Praza@Sun.COM# the specific synthetic manifest. Rather than escape command 58011838SLiane.Praza@Sun.COM# dependency checking for the real manifest processing, or failing to 58111838SLiane.Praza@Sun.COM# express the (indirect) dependency of synthetic manifests on real 58211838SLiane.Praza@Sun.COM# manifests, we simply split this rule out from the one above. 58311838SLiane.Praza@Sun.COM# 58411838SLiane.Praza@Sun.COM# The implementation notes from the previous rule are applicable 58511838SLiane.Praza@Sun.COM# here, too. 58611838SLiane.Praza@Sun.COM# 58711838SLiane.Praza@Sun.COM$(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf) 58811838SLiane.Praza@Sun.COM @print "Processing synthetic manifest $(@F:%.mog=%.mf)" 58912616Sdp@eng.sun.com $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars 59012616Sdp@eng.sun.com $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \ 59111838SLiane.Praza@Sun.COM $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \ 59212616Sdp@eng.sun.com -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \ 59312616Sdp@eng.sun.com $(PM_TRANSFORMS) synthetic 59412616Sdp@eng.sun.com $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \ 59511838SLiane.Praza@Sun.COM if [ -f $(@) ]; then \ 59611838SLiane.Praza@Sun.COM $(LN) -s $(@F) \ 59711838SLiane.Praza@Sun.COM $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \ 59811838SLiane.Praza@Sun.COM else \ 59911838SLiane.Praza@Sun.COM $(TOUCH) $(@); \ 60011838SLiane.Praza@Sun.COM fi 60112616Sdp@eng.sun.com $(PKGDEBUG)$(RM) $(@).vars 60211838SLiane.Praza@Sun.COM 60311838SLiane.Praza@Sun.COM$(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog) 60411838SLiane.Praza@Sun.COM @print "Skipping dependency generation for $(@F:%.dep=%)" 60511838SLiane.Praza@Sun.COM $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@) 60611838SLiane.Praza@Sun.COM 60711838SLiane.Praza@Sun.COMclean: 60811838SLiane.Praza@Sun.COM 60911838SLiane.Praza@Sun.COMclobber: clean 61011838SLiane.Praza@Sun.COM $(RM) -r $(CLOBBERFILES) 61111838SLiane.Praza@Sun.COM 61211838SLiane.Praza@Sun.COM# 61311838SLiane.Praza@Sun.COM# This rule assumes that all links in the $PKGSTAT directories 61411838SLiane.Praza@Sun.COM# point to valid manifests, and will fail the make run if one 61511838SLiane.Praza@Sun.COM# does not contain an fmri. 61611838SLiane.Praza@Sun.COM# 61711838SLiane.Praza@Sun.COM# We do this in the BEGIN action instead of using pattern matching 61811838SLiane.Praza@Sun.COM# because we expect the fmri to be at or near the first line of each input 61911838SLiane.Praza@Sun.COM# file, and this way lets us avoid reading the rest of the file after we 62011838SLiane.Praza@Sun.COM# find what we need. 62111838SLiane.Praza@Sun.COM# 62211838SLiane.Praza@Sun.COM# We keep track of a failure to locate an fmri, so we can fail the 62311838SLiane.Praza@Sun.COM# make run, but we still attempt to process each package in the 62411838SLiane.Praza@Sun.COM# repo/pkgstat-specific subdir, in hopes of maybe giving some 62511838SLiane.Praza@Sun.COM# additional useful info. 62611838SLiane.Praza@Sun.COM# 62711838SLiane.Praza@Sun.COM# The protolist is used for bfu archive creation, which may be invoked 62811838SLiane.Praza@Sun.COM# interactively by the user. Both protolist and PKGLISTS targets 62911838SLiane.Praza@Sun.COM# depend on $(PROC_PKGS), but protolist builds them recursively. 63011838SLiane.Praza@Sun.COM# To avoid collisions, we insert protolist into the dependency chain 63111838SLiane.Praza@Sun.COM# here. This has two somewhat subtle benefits: it allows bfu archive 63211838SLiane.Praza@Sun.COM# creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS, 63311838SLiane.Praza@Sun.COM# and it ensures that a protolist file here will always correspond to the 63411838SLiane.Praza@Sun.COM# contents of the processed manifests, which can vary depending on build 63511838SLiane.Praza@Sun.COM# environment. 63611838SLiane.Praza@Sun.COM# 63711838SLiane.Praza@Sun.COM$(PKGLISTS): $(PROC_PKGS) 63811838SLiane.Praza@Sun.COM $(PKGDEBUG)sdotr=$(@F:packages.%=%); \ 63911838SLiane.Praza@Sun.COM r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \ 64011838SLiane.Praza@Sun.COM print "Generating $$r $$s package list"; \ 64111838SLiane.Praza@Sun.COM $(RM) $(@); $(TOUCH) $(@); \ 64211838SLiane.Praza@Sun.COM $(NAWK) 'BEGIN { \ 64311838SLiane.Praza@Sun.COM if (ARGC < 2) { \ 64411838SLiane.Praza@Sun.COM exit; \ 64511838SLiane.Praza@Sun.COM } \ 64611838SLiane.Praza@Sun.COM retcode = 0; \ 64711838SLiane.Praza@Sun.COM for (i = 1; i < ARGC; i++) { \ 64811838SLiane.Praza@Sun.COM do { \ 64911838SLiane.Praza@Sun.COM e = getline f < ARGV[i]; \ 65011838SLiane.Praza@Sun.COM } while ((e == 1) && (f !~ /name=pkg.fmri/)); \ 65111838SLiane.Praza@Sun.COM close(ARGV[i]); \ 65211838SLiane.Praza@Sun.COM if (e == 1) { \ 65311838SLiane.Praza@Sun.COM l = split(f, a, "="); \ 65411838SLiane.Praza@Sun.COM print "depend fmri=" a[l], \ 65511838SLiane.Praza@Sun.COM "type=$$(PKGDEP_TYPE)"; \ 65611838SLiane.Praza@Sun.COM } else { \ 65711838SLiane.Praza@Sun.COM print "no fmri in " ARGV[i] >> "/dev/stderr"; \ 65811838SLiane.Praza@Sun.COM retcode = 2; \ 65911838SLiane.Praza@Sun.COM } \ 66011838SLiane.Praza@Sun.COM } \ 66111838SLiane.Praza@Sun.COM exit retcode; \ 66211838SLiane.Praza@Sun.COM }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \ 66311838SLiane.Praza@Sun.COM -name NOSUCHFILE \)` >> $(@) 66411838SLiane.Praza@Sun.COM 66511838SLiane.Praza@Sun.COM# 66611838SLiane.Praza@Sun.COM# rules to validate proto area against manifests, check for safe 66711838SLiane.Praza@Sun.COM# file permission modes, and generate a faux proto list 66811838SLiane.Praza@Sun.COM# 66911838SLiane.Praza@Sun.COM# For the check targets, the dependencies on $(PROC_PKGS) is specified 67011838SLiane.Praza@Sun.COM# as a subordinate make process in order to suppress output. 67111838SLiane.Praza@Sun.COM# 67211838SLiane.Praza@Sun.COMmakesilent: 67311838SLiane.Praza@Sun.COM @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \ 67411838SLiane.Praza@Sun.COM SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null 67511838SLiane.Praza@Sun.COM 67612998SMark.J.Nelson@Oracle.COM# 67712998SMark.J.Nelson@Oracle.COM# The .lics files were created during pkgmogrification, and list the 67812998SMark.J.Nelson@Oracle.COM# set of licenses to pull from $SRC for each package. Because 67912998SMark.J.Nelson@Oracle.COM# licenses may be duplicated between packages, we uniquify them as 68012998SMark.J.Nelson@Oracle.COM# well as aggregating them here. 68112998SMark.J.Nelson@Oracle.COM# 68212998SMark.J.Nelson@Oracle.COMlicense-list: makesilent 68312998SMark.J.Nelson@Oracle.COM $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \ 68412998SMark.J.Nelson@Oracle.COM do print $$l; done ) | sort -u > $@ 68512998SMark.J.Nelson@Oracle.COM 68612998SMark.J.Nelson@Oracle.COM# 68712998SMark.J.Nelson@Oracle.COM# Staging the license and description files in the proto area allows 68812998SMark.J.Nelson@Oracle.COM# us to do proper unreferenced file checking of both license and 68912998SMark.J.Nelson@Oracle.COM# description files without blanket exceptions, and to pull license 69012998SMark.J.Nelson@Oracle.COM# content without reference to $CODEMGR_WS during publication. 69112998SMark.J.Nelson@Oracle.COM# 69212998SMark.J.Nelson@Oracle.COMstage-licenses: license-list FRC 69312998SMark.J.Nelson@Oracle.COM $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \ 69412998SMark.J.Nelson@Oracle.COM PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \ 69512998SMark.J.Nelson@Oracle.COM `$(NAWK) '{ \ 69612998SMark.J.Nelson@Oracle.COM print "$(PKGROOT)/licenses/" $$0; \ 69712998SMark.J.Nelson@Oracle.COM print "$(PKGROOT)/licenses/" $$0 ".descrip"; \ 69812998SMark.J.Nelson@Oracle.COM }' license-list` > /dev/null; 69912998SMark.J.Nelson@Oracle.COM 70011838SLiane.Praza@Sun.COMprotocmp: makesilent 70111838SLiane.Praza@Sun.COM @validate_pkg -a $(PKGMACH) -v \ 70211838SLiane.Praza@Sun.COM $(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \ 70311838SLiane.Praza@Sun.COM -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT) 70411838SLiane.Praza@Sun.COM 70511838SLiane.Praza@Sun.COMpmodes: makesilent 70611838SLiane.Praza@Sun.COM @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \ 70711838SLiane.Praza@Sun.COM -e $(CODEMGR_WS)/exception_lists/pmodes 70811838SLiane.Praza@Sun.COM 70911838SLiane.Praza@Sun.COMcheck: protocmp pmodes 71011838SLiane.Praza@Sun.COM 71111838SLiane.Praza@Sun.COMprotolist: proto_list_$(PKGMACH) 71211838SLiane.Praza@Sun.COM 71311838SLiane.Praza@Sun.COMproto_list_$(PKGMACH): $(PROC_PKGS) 71411838SLiane.Praza@Sun.COM @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@) 71511838SLiane.Praza@Sun.COM 71611838SLiane.Praza@Sun.COM$(PROC_PKGS): $(PDIR) 71711838SLiane.Praza@Sun.COM 71811838SLiane.Praza@Sun.COM# 71911838SLiane.Praza@Sun.COM# This is a convenience target to allow package names to function as 72011838SLiane.Praza@Sun.COM# build targets. Generally, using it is only useful when iterating on 72111838SLiane.Praza@Sun.COM# development of a manifest. 72211838SLiane.Praza@Sun.COM# 72311838SLiane.Praza@Sun.COM# When processing a manifest, use the basename (without extension) of 72411838SLiane.Praza@Sun.COM# the package. When publishing, use the basename with a ".pub" 72511838SLiane.Praza@Sun.COM# extension. 72611838SLiane.Praza@Sun.COM# 72711838SLiane.Praza@Sun.COM# Other than during manifest development, the preferred usage is to 72811838SLiane.Praza@Sun.COM# avoid these targets and override PKGS on the make command line and 72911838SLiane.Praza@Sun.COM# use the provided all and install targets. 73011838SLiane.Praza@Sun.COM# 73111838SLiane.Praza@Sun.COM$(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog) 73211838SLiane.Praza@Sun.COM 73311838SLiane.Praza@Sun.COM$(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@) 73411838SLiane.Praza@Sun.COM 73511838SLiane.Praza@Sun.COM# 73611838SLiane.Praza@Sun.COM# This is a convenience target to resolve dependencies without publishing 73711838SLiane.Praza@Sun.COM# packages. 73811838SLiane.Praza@Sun.COM# 73911838SLiane.Praza@Sun.COMgendeps: $(PDIR)/gendeps 74011838SLiane.Praza@Sun.COM 74111838SLiane.Praza@Sun.COM# 74211838SLiane.Praza@Sun.COM# These are convenience targets for cross-platform packaging. If you 74311838SLiane.Praza@Sun.COM# want to build any of "the normal" targets for a different 74411838SLiane.Praza@Sun.COM# architecture, simply use "arch/target" as your build target. 74511838SLiane.Praza@Sun.COM# 74611838SLiane.Praza@Sun.COM# Since the most common use case for this is "install," the architecture 74711838SLiane.Praza@Sun.COM# specific install targets have been further abbreviated to elide "/install." 74811838SLiane.Praza@Sun.COM# 74911838SLiane.Praza@Sun.COMi386/% sparc/%: 75011838SLiane.Praza@Sun.COM $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) 75111838SLiane.Praza@Sun.COM 75211838SLiane.Praza@Sun.COMi386 sparc: $$(@)/install 75311838SLiane.Praza@Sun.COM 75411838SLiane.Praza@Sun.COMFRC: 75511838SLiane.Praza@Sun.COM 75611838SLiane.Praza@Sun.COM# EXPORT DELETE START 75711838SLiane.Praza@Sun.COMXMOD_PKGS= \ 75811838SLiane.Praza@Sun.COM BRCMbnx \ 75911838SLiane.Praza@Sun.COM BRCMbnxe \ 76011838SLiane.Praza@Sun.COM SUNWadpu320 \ 76111838SLiane.Praza@Sun.COM SUNWcryptoint \ 76211838SLiane.Praza@Sun.COM SUNWibsdpib \ 76311838SLiane.Praza@Sun.COM SUNWkdc \ 76411838SLiane.Praza@Sun.COM SUNWlsimega \ 76511838SLiane.Praza@Sun.COM SUNWsvvs \ 76611838SLiane.Praza@Sun.COM SUNWwbint \ 76711838SLiane.Praza@Sun.COM SUNWwbsup 76811838SLiane.Praza@Sun.COM 76911838SLiane.Praza@Sun.COMEXPORT_SRC: CRYPT_SRC 77011838SLiane.Praza@Sun.COM $(RM) $(XMOD_PKGS:%=manifests/%.mf) 77111838SLiane.Praza@Sun.COM $(RM) Makefile+ 77211838SLiane.Praza@Sun.COM $(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \ 77311838SLiane.Praza@Sun.COM < Makefile > Makefile+ 77411838SLiane.Praza@Sun.COM $(MV) -f Makefile+ Makefile 77511838SLiane.Praza@Sun.COM $(CHMOD) 444 Makefile 77611838SLiane.Praza@Sun.COM 77711838SLiane.Praza@Sun.COMCRYPT_SRC: 77811838SLiane.Praza@Sun.COM $(RM) manifests/SUNWcryptoint.mf+ 77911838SLiane.Praza@Sun.COM $(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d" \ 78011838SLiane.Praza@Sun.COM < manifests/SUNWcryptoint.mf > manifests/SUNWcryptoint.mf+ 78111838SLiane.Praza@Sun.COM $(MV) manifests/SUNWcryptoint.mf+ manifests/SUNWcryptoint.mf 78211838SLiane.Praza@Sun.COM $(CHMOD) 444 manifests/SUNWcryptoint.mf 78311838SLiane.Praza@Sun.COM 78411838SLiane.Praza@Sun.COM# EXPORT DELETE END 785