make-rules/ips.mk
author Norm Jacobs <Norm.Jacobs@Sun.COM>
Wed, 19 May 2010 00:08:03 -0500
changeset 12 41aeb1fd8c2d
parent 7 d42300cb8715
child 21 e651c453e960
permissions -rw-r--r--
Fix MACH32/MACH64 so more than one architecture can build in the same workspace
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
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    38
PKGSEND =	/usr/bin/pkgsend
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    39
PKGMOGRIFY =	/usr/bin/pkgmogrify
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    40
PKGDEPEND =	/usr/bin/pkgdepend
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    41
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    42
# Add some default transforms that should apply to everyone
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    43
PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/defaults
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    44
PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/actuators
4
3d5acfe9dab4 build zone creation rules
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    45
PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/devel
3d5acfe9dab4 build zone creation rules
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    46
PKGMOGRIFY_TRANSFORMS +=	$(WS_TOP)/transforms/docs
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    47
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
    48
MANIFEST =	manifest-$(MACH)
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
    49
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    50
.DEFAULT:	publish
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    51
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    52
publish:	$(COMPONENT_SRC)/.published
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    53
7
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    54
COPYRIGHT_FILE =	$(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    55
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    56
$(PROTO_DIR)/$(COPYRIGHT_FILE):	$(COMPONENT_COPYRIGHT)
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    57
	$(CP) $< $@
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    58
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
    59
$(COMPONENT_SRC)/$(MANIFEST):	install
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    60
	pkgsend generate $(PROTO_DIR) >$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    61
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
    62
$(COMPONENT_SRC)/$(MANIFEST).mog:	$(COMPONENT_SRC)/$(MANIFEST) $(PROTO_DIR)/$(COPYRIGHT_FILE)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    63
	echo "set name=pkg.fmri value=pkg:/$(PUBLISHER)/$(COMPONENT_NAME)@$(COMPONENT_VERSION),$(BUILD_VERSION)" >$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    64
	echo "set name=pkg.description value=\"$(COMPONENT_DESCRIPTION)\"" >>$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    65
	echo "set name=pkg.name value=\"$(COMPONENT_DESCRIPTION)\"" >>$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    66
	echo "set name=org.opensolaris.consolidation value=$(CONSOLIDATION)" >>$@
7
d42300cb8715 add license/copyright info for ips generation
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 4
diff changeset
    67
	echo "license $(COPYRIGHT_FILE) license=$(COPYRIGHT_FILE)" >>$@
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    68
	pkgmogrify $(PKGMOGRIFY_MACROS:%=-D %) $(PKGMOGRIFY_TRANSFORMS) $< >>$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    69
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
    70
$(COMPONENT_SRC)/$(MANIFEST).fdeps:	$(COMPONENT_SRC)/$(MANIFEST).mog
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    71
	pkgdepend generate -m $< $(PROTO_DIR) >$@
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    72
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
    73
$(COMPONENT_SRC)/$(MANIFEST).fdeps.res:	$(COMPONENT_SRC)/$(MANIFEST).fdeps
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    74
	pkgdepend resolve -m $<
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    75
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
    76
$(COMPONENT_SRC)/.published:	$(COMPONENT_SRC)/$(MANIFEST).fdeps.res
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    77
	pkgsend -s $(PKG_REPO) publish --fmri-in-manifest \
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    78
		-d $(PROTO_DIR) $<
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    79
	$(TOUCH) $@