make-rules/ips.mk
author Norm Jacobs <Norm.Jacobs@Sun.COM>
Fri, 15 Oct 2010 16:15:38 -0500
changeset 38 cd00ea74156e
parent 32 280a7444e782
child 46 d4d60962c33f
permissions -rw-r--r--
package audits should pass pkglint incrementals should work better
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     1
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     2
# CDDL HEADER START
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     3
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     7
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    11
# and limitations under the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    12
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    18
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    19
# CDDL HEADER END
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    20
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    21
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    22
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    23
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    24
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    25
# Rules and Macros for generating an IPS package manifest and publishing an
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    26
# IPS package to a pkg depot.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    27
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    28
# To use these rules, include ../make-rules/ips.mk in your Makefile
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    29
# and define an "install" target appropriate to building your component.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    30
# Ex:
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    31
#
12
41aeb1fd8c2d Fix MACH32/MACH64 so more than one architecture can build in the same workspace
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 7
diff changeset
    32
#	install:	$(COMPONENT_SRC)/build-$(MACH32)/.installed \
41aeb1fd8c2d Fix MACH32/MACH64 so more than one architecture can build in the same workspace
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 7
diff changeset
    33
#	 		$(COMPONENT_SRC)/build-$(MACH64)/.installed
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    34
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    35
# This set of rules makes the "publish" target the default target for make(1)
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    36
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    37
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    38
PKGDEPEND =	/usr/bin/pkgdepend
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    39
PKGFMT =	/usr/bin/pkgfmt
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    40
PKGMOGRIFY =	/usr/bin/pkgmogrify
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    41
PKGSEND =	/usr/bin/pkgsend
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    42
PKGLINT =	/usr/bin/pkglint
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    43
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    44
# Package headers should all pretty much follow the same format
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    45
METADATA_TEMPLATE =		$(WS_TOP)/transforms/manifest-metadata-template
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    46
COPYRIGHT_TEMPLATE =		$(WS_TOP)/transforms/copyright-template
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    47
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    48
# order is important
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    49
GENERATE_TRANSFORMS +=		$(WS_TOP)/transforms/generate-cleanup
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    50
GENERATE_TRANSFORMS +=		$(WS_TOP)/transforms/variant.arch
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    51
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    52
COMPARISON_TRANSFORMS +=	$(WS_TOP)/transforms/comparison-cleanup
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    53
COMPARISON_TRANSFORMS +=	$(PKGMOGRIFY_TRANSFORMS)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    54
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    55
# order is important
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    56
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/defaults
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    57
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/actuators
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    58
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/devel
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    59
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/docs
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    60
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/locale
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    61
PUBLISH_TRANSFORMS +=	$(PKGMOGRIFY_TRANSFORMS)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    62
PUBLISH_TRANSFORMS +=	$(WS_TOP)/transforms/publish-cleanup
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    63
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    64
PKG_MACROS +=		MACH=$(MACH)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    65
PKG_MACROS +=		ARCH=$(MACH)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    66
PKG_MACROS +=		MACH32=$(MACH32)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    67
PKG_MACROS +=		MACH64=$(MACH64)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    68
PKG_MACROS +=		IPS_PKG_NAME=$(IPS_PKG_NAME)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    69
PKG_MACROS +=		PUBLISHER=$(PUBLISHER)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    70
PKG_MACROS +=		CONSOLIDATION=$(CONSOLIDATION)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    71
PKG_MACROS +=		BUILD_VERSION=$(BUILD_VERSION)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    72
PKG_MACROS +=		SOLARIS_VERSION=$(SOLARIS_VERSION)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    73
PKG_MACROS +=		OS_VERSION=$(OS_VERSION)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    74
PKG_MACROS +=		IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    75
PKG_MACROS +=		COMPONENT_PROJECT_URL=$(COMPONENT_PROJECT_URL)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    76
PKG_MACROS +=		COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    77
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    78
PKG_OPTIONS +=		$(PKG_MACROS:%=-D %)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    79
# multi-word macros get broken up, so we handle them "specially"
27
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    80
PKG_OPTIONS +=		-D COMPONENT_SUMMARY=$(COMPONENT_SUMMARY)
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    81
PKG_OPTIONS +=		-D COMPONENT_DESCRIPTION=$(COMPONENT_DESCRIPTION)
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    82
PKG_OPTIONS +=		-D COMPONENT_CLASSIFICATION=$(COMPONENT_CLASSIFICATION)
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    83
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    84
MANIFEST_BASE =		$(COMPONENT_SRC)/manifest-$(MACH)
12
41aeb1fd8c2d Fix MACH32/MACH64 so more than one architecture can build in the same workspace
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 7
diff changeset
    85
30
440b6ca0641d Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents: 27
diff changeset
    86
CANONICAL_MANIFESTS =	$(wildcard *.p5m)
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    87
GENERATED =		$(MANIFEST_BASE)-generated
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    88
COMBINED =		$(MANIFEST_BASE)-combined
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    89
MANIFESTS =		$(CANONICAL_MANIFESTS:%=$(MANIFEST_BASE)-%)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    90
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    91
30
440b6ca0641d Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents: 27
diff changeset
    92
MOGRIFIED=$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.resolved)
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
    93
PUBLISHED=$(MOGRIFIED:%.resolved=%.published)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    94
7
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    95
COPYRIGHT_FILE =	$(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
27
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    96
ifeq	($(IPS_PKG_NAME),)
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    97
	IPS_PKG_NAME =	$(COMPONENT_NAME)
4daa72fdac4c work around "Bug 16570 - pkgmogrify(1) drops quoting"
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 26
diff changeset
    98
endif
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    99
ifeq	($(COMPONENT_SUMMARY),)
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   100
	COMPONENT_SUMMARY =	$(COMPONENT_DESCRIPTION)
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   101
endif
21
e651c453e960 forgot a couple of changes while breaking up bits
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 12
diff changeset
   102
IPS_COMPONENT_VERSION =	$(COMPONENT_VERSION)
7
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
   103
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   104
.DEFAULT:		publish
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   105
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   106
.SECONDARY:
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   107
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   108
publish:		install $(COMPONENT_SRC)/.published
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   109
30
440b6ca0641d Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents: 27
diff changeset
   110
sample-manifest:	$(GENERATED).p5m
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   111
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   112
#
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   113
# Rules for generating a manifest automatically.  Generated manifests will
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   114
# contain the following:
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   115
#    copyright - template copyright information
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   116
#    metadata  - mogrified template metadata
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   117
#    actions   - "normalized" actions for the paths to be installed.
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   118
#    depends   - automatically generated dependencies
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   119
#
7
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
   120
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   121
# transform template metadata into slightly more package specific metadata.
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   122
$(GENERATED).metadata:	$(METADATA_TEMPLATE) install
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   123
	$(PKGMOGRIFY) -D IPS_PKG_NAME=$(IPS_PKG_NAME) $< | \
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   124
		sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   125
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   126
# generate actions from the proto dir
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   127
$(GENERATED).generate:	install
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   128
	$(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   129
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   130
# convert actions to a "normalized" format
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   131
$(GENERATED).actions:	$(GENERATED).generate
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   132
	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(GENERATE_TRANSFORMS) | \
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   133
		sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   134
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   135
# generate dependencies
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   136
$(MANIFEST_BASE)-%.fdeps:	$(MANIFEST_BASE)-%.generate
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   137
	$(PKGDEPEND) generate $(PKG_OPTIONS) $< $(PROTO_DIR) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   138
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   139
$(MANIFEST_BASE)-%.depend:	$(MANIFEST_BASE)-%.fdeps
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   140
	$(PKGDEPEND) resolve -o $< | sed -e '1d' >[email protected]
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   141
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   142
# generate a complete manifest from the pieces
30
440b6ca0641d Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents: 27
diff changeset
   143
$(GENERATED).p5m:	$(GENERATED).metadata $(GENERATED).actions \
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   144
			$(GENERATED).depend
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   145
	cat $(COPYRIGHT_TEMPLATE) $(GENERATED).metadata $(GENERATED).actions \
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   146
	    $(GENERATED).depend >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   147
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   148
#
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   149
# Rules to generate a combined manifest from the canonical manifest(s) checked
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   150
# into the workspace.
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   151
#
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   152
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   153
# Combine the canonical manifest(s) for this component and "normalize" them
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   154
# for comparison.
30
440b6ca0641d Removed $(PUBLISHER) from pkg.fmri package attributes. Renamed package
Danek Duvall <danek.duvall@oracle.com>
parents: 27
diff changeset
   155
$(COMBINED).p5m:	canonical-manifests
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   156
	cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   157
 		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   158
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   159
$(MANIFEST_BASE)-%.compare:		$(MANIFEST_BASE)-%.p5m canonical-manifests
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   160
	$(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   161
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   162
manifest-compare:	$(COMBINED).compare $(GENERATED).compare
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   163
	@echo "Manifest comparison"
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   164
	@pkgdiff $(GENERATED).compare $(COMBINED).compare
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   165
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   166
$(MANIFEST_BASE)-%.linted:	$(MANIFEST_BASE)-%.resolved
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   167
	@echo "Linting $(@:$(MANIFEST_BASE)-%.linted=%) manifest"
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   168
	$(PKGLINT) $<
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   169
	$(TOUCH) [email protected]
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   170
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   171
manifest-checks:	manifest-compare $(PUBLISHED:%.published=%.linted)
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   172
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   173
# mogrify the canonical manifest(s) 
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   174
#
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   175
$(MANIFEST_BASE)-%.resolved:	%.p5m canonical-manifests
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   176
	$(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >[email protected]
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   177
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   178
$(MANIFEST_BASE)-%.published:	$(MANIFEST_BASE)-%.resolved manifest-checks
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   179
	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   180
		-d $(PROTO_DIR) -d . $<
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   181
	$(TOUCH) [email protected]
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   182
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   183
$(COMPONENT_SRC)/.published:	$(PUBLISHED)
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   184
	$(TOUCH) [email protected]
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   185
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   186
print-package-names:	canonical-manifests
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   187
	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   188
		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   189
 		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   190
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   191
print-package-paths:	canonical-manifests
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   192
	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   193
		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   194
 		sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   195
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   196
install-packages:	publish
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   197
	@if [ $(IS_GLOBAL_ZONE) = 0 -o x$(ROOT) != x ]; then \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   198
	    cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   199
		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   200
 		sed -e '/^$$/d' -e '/^#.*$$/d' -e 's;/;;' | sort -u | \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   201
		(cd $(PROTO_DIR) ; pfexec /bin/cpio -dump $(ROOT)) ; \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   202
	else ; \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   203
	    echo "unsafe to install package(s) automatically" ; \
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   204
        fi
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   205
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   206
$(MOGRIFIED):	install
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   207
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   208
canonical-manifests:	$(CANONICAL_MANIFESTS) Makefile $(PATCHES)
26
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   209
ifeq	($(strip $(CANONICAL_MANIFESTS)),)
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   210
	# If there were no canonical manifests in the workspace, nothing will
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   211
	# be published and we should fail.  A sample manifest can be generated
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   212
	# with
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   213
	#   $ gmake sample-manifest
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   214
	# Once created, it will need to be reviewed, edited, and added to the
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   215
	# workspace.
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   216
	$(error Missing canonical manifest(s))
8a9f4e791832 packaging changes including canonical manifest support with manifest validation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 22
diff changeset
   217
endif
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   218
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   219
# This converts required paths to containing package names for be able to
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   220
# properly setup the build environment for a component.
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   221
required-pkgs.mk:	Makefile
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   222
	@echo "generating [email protected] from Makefile REQUIRED_* data"
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   223
	@pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   224
		| sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >[email protected]
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   225
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   226
pre-prep:	required-pkgs.mk
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   227
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
   228
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 30
diff changeset
   229
CLEAN_PATHS +=	required-pkgs.mk