2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A# Copyright (c) 2010, Oracle
and/or it's affiliates. All rights reserved.
2N/A# Rules and Macros for generating an IPS package manifest and publishing an
2N/A# IPS package to a pkg depot.
2N/A# and define an "install" target appropriate to building your component.
12N/A# install: $(COMPONENT_SRC)/build-$(MACH32)/.installed \
12N/A# $(COMPONENT_SRC)/build-$(MACH64)/.installed
2N/A# This set of rules makes the "publish" target the default target for make(1)
26N/A# Package headers should all pretty much follow the same format
26N/A# order is important
26N/ACOMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
26N/A# order is important
26N/APUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
26N/APKG_MACROS += MACH=$(MACH)
26N/APKG_MACROS += ARCH=$(MACH)
26N/APKG_MACROS += MACH32=$(MACH32)
26N/APKG_MACROS += MACH64=$(MACH64)
26N/APKG_MACROS += IPS_PKG_NAME=$(IPS_PKG_NAME)
26N/APKG_MACROS += PUBLISHER=$(PUBLISHER)
26N/APKG_MACROS += CONSOLIDATION=$(CONSOLIDATION)
26N/APKG_MACROS += BUILD_VERSION=$(BUILD_VERSION)
26N/APKG_MACROS += SOLARIS_VERSION=$(SOLARIS_VERSION)
26N/APKG_MACROS += OS_VERSION=$(OS_VERSION)
26N/APKG_MACROS += IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION)
26N/APKG_MACROS += COMPONENT_PROJECT_URL=$(COMPONENT_PROJECT_URL)
26N/APKG_MACROS += COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL)
26N/APKG_OPTIONS += $(PKG_MACROS:%=-D %)
26N/A# multi-word macros get broken up, so we handle them "specially"
27N/APKG_OPTIONS += -D COMPONENT_SUMMARY=$(COMPONENT_SUMMARY)
27N/APKG_OPTIONS += -D COMPONENT_DESCRIPTION=$(COMPONENT_DESCRIPTION)
27N/APKG_OPTIONS += -D COMPONENT_CLASSIFICATION=$(COMPONENT_CLASSIFICATION)
26N/AMANIFEST_BASE = $(COMPONENT_SRC)/manifest-$(MACH)
26N/ACANONICAL_MANIFESTS = $(wildcard *.ips)
26N/AGENERATED = $(MANIFEST_BASE)-generated
26N/ACOMBINED = $(MANIFEST_BASE)-combined
26N/AMANIFESTS = $(CANONICAL_MANIFESTS:%=$(MANIFEST_BASE)-%)
26N/AMOGRIFIED=$(CANONICAL_MANIFESTS:%.ips=$(MANIFEST_BASE)-%.resolved)
26N/APUBLISHED=$(MOGRIFIED:%.resolved=%.published)
7N/ACOPYRIGHT_FILE = $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
27N/Aifeq ($(IPS_PKG_NAME),)
27N/A IPS_PKG_NAME = $(COMPONENT_NAME)
21N/AIPS_COMPONENT_VERSION = $(COMPONENT_VERSION)
26N/A.SECONDARY: $(GENERATED).fdeps
26N/Apublish: install $(COMPONENT_SRC)/.published
26N/Asample-manifest: $(GENERATED).ips
26N/A# Rules for generating a manifest automatically. Generated manifests will
26N/A# contain the following:
26N/A# copyright - template copyright information
26N/A# metadata - mogrified template metadata
26N/A# actions - "normalized" actions for the paths to be installed.
26N/A# depends - automatically generated dependencies
26N/A# transform template metadata into slightly more package specific metadata.
26N/A$(GENERATED).metadata: $(METADATA_TEMPLATE) install
26N/A $(PKGMOGRIFY) -D IPS_PKG_NAME=$(IPS_PKG_NAME) $< | \
26N/A sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@
26N/A# generate actions from the proto dir
26N/A$(GENERATED).generate: install
26N/A $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) >$@
26N/A# convert actions to a "normalized" format
26N/A$(GENERATED).actions: $(GENERATED).generate
26N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(GENERATE_TRANSFORMS) | \
26N/A sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@
26N/A# generate dependencies
26N/A$(MANIFEST_BASE)-%.fdeps: $(MANIFEST_BASE)-%.generate
26N/A $(PKGDEPEND) generate $(PKG_OPTIONS) $< $(PROTO_DIR) >$@
26N/A$(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.fdeps
26N/A $(PKGDEPEND) resolve -o $< | sed -e '1d' >$@
26N/A# generate a complete manifest from the pieces
26N/A$(GENERATED).ips: $(GENERATED).metadata $(GENERATED).actions \
26N/A $(GENERATED).depend
26N/A cat $(COPYRIGHT_TEMPLATE) $(GENERATED).metadata $(GENERATED).actions \
26N/A $(GENERATED).depend >$@
26N/A# Rules to generate a combined manifest from the canonical manifest(s) checked
26N/A# into the workspace.
26N/A# Combine the canonical manifest(s) for this component and "normalize" them
26N/A$(COMBINED).ips: canonical-manifests
26N/A cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS)
/dev/fd/0 | \
26N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >$@
26N/A$(MANIFEST_BASE)-%.compare: $(MANIFEST_BASE)-%.ips
26N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >$@
26N/Amanifest-compare: $(COMBINED).compare $(GENERATED).compare
26N/A @echo "Manifest comparison"
26N/A @pkgdiff $(GENERATED).compare $(COMBINED).compare
26N/A# mogrify the canonical manifest(s)
26N/A$(MANIFEST_BASE)-%.resolved: %.ips manifest-compare
26N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >$@
26N/A$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.resolved
26N/A $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
26N/A -d $(PROTO_DIR) -d . $<
26N/A$(COMPONENT_SRC)/.published: manifest-compare $(PUBLISHED)
26N/Acanonical-manifests: $(CANONICAL_MANIFESTS)
26N/Aifeq ($(strip $(CANONICAL_MANIFESTS)),)
26N/A # If there were no canonical manifests in the workspace, nothing will
26N/A # be published and we should fail. A sample manifest can be generated
26N/A # $ gmake sample-manifest
26N/A # Once created, it will need to be reviewed, edited, and added to the
26N/A $(error Missing canonical manifest(s))