Makefile revision 546
4139N/A#
4139N/A# CDDL HEADER START
4139N/A#
4139N/A# The contents of this file are subject to the terms of the
4139N/A# Common Development and Distribution License (the "License").
4139N/A# You may not use this file except in compliance with the License.
4139N/A#
4139N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4139N/A# or http://www.opensolaris.org/os/licensing.
4139N/A# See the License for the specific language governing permissions
4139N/A# and limitations under the License.
4139N/A#
4139N/A# When distributing Covered Code, include this CDDL HEADER in each
4139N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4139N/A# If applicable, add the following below this CDDL HEADER, with the
4139N/A# fields enclosed by brackets "[]" replaced with your own identifying
4139N/A# information: Portions Copyright [yyyy] [name of copyright owner]
4139N/A#
4139N/A# CDDL HEADER END
4139N/A#
4139N/A# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
4139N/A#
4139N/A
4139N/Ainclude ../make-rules/shared-macros.mk
4139N/A
4139N/A# for now, the assumption is we build any directory with a Makefile. This may
4139N/A# not always be the case. If we build a new make-like tool to drive the upper
4139N/A# level build, it may make different decisions and will need to include
4139N/A# appropriate dependency information.
4139N/A
4139N/A# components.mk is auto-generated by the build tools. It populates the
4139N/A# COMPONENT_DIRS macro with a list of all directories in the workspace that
4139N/A# contain a component.
4139N/Acomponents.mk: # Makefile # $(WS_TOP)/components
4139N/A @echo "Generating component list..."
4139N/A @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
4139N/A | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
4139N/A
4139N/A-include components.mk
4139N/A
4139N/A# depends.mk is auto-generated by concatenating 'depend.mk' files in each
4139N/A# component directory.
4139N/Adepends.mk: components.mk
4139N/A @echo "Generating component dependencies..."
4139N/A @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
4139N/A | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
4139N/A 2>/dev/null
4139N/A
4139N/A-include depends.mk
4139N/A
4139N/A
4139N/Adownload: TARGET = download
4139N/Aprep: TARGET = prep
4139N/Abuild: TARGET = build
4139N/Ainstall: TARGET = install
4139N/Apublish: TARGET = publish
4139N/Aclean: TARGET = clean
4139N/Aclobber: TARGET = clobber
4139N/Atest: TARGET = test
4139N/Aprep build install publish test: TEMPLATE_ZONE=$(ZONE)
4139N/Aprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
4139N/A
4139N/A# turn off pkglint for the individual component builds.
4139N/Apublish: MAKEFLAGS += PKGLINT=/bin/true
4139N/A
4139N/A.DEFAULT: publish
4139N/A
4139N/Abuild install publish test: $(COMPONENT_DIRS)
4139N/A
4139N/ACOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
4139N/A
4139N/Adownload prep: $(COMPONENT_DIRS.nosetup)
4139N/A
4139N/Aclean: $(COMPONENT_DIRS.nosetup)
4139N/A $(RM) components.mk depends.mk .profile
4139N/A
4139N/Aclobber: $(COMPONENT_DIRS.nosetup) clean
4139N/A $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
4139N/A
4139N/Asetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
4139N/A
4139N/A$(WS_LOGS):
4139N/A $(MKDIR) $@
4139N/A
4139N/A$(WS_REPO):
4139N/A $(PKGREPO) create $(PKG_REPO)
4139N/A $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
4139N/A
4139N/A$(WS_LINT_CACHE): $(WS_LOGS)
4139N/Aifdef CANONICAL_REPO
4139N/A @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
4139N/A @(echo "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)" | $(PKGLINT) \
4139N/A -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
4139N/A >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
4139N/Aelse
4139N/A $(MKDIR) $(WS_LINT_CACHE)
4139N/Aendif
4139N/A
4139N/Atools:
4139N/A @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
4139N/A
4139N/A# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
4139N/A# to pass a few things on to zone based builds
4139N/A.profile:
4139N/A echo "PATH=$(PATH)" >>$@
4139N/A echo "WS_TOP=$(WS_TOP)" >>$@
4139N/A echo "export PATH WS_TOP" >>$@
4139N/A
4139N/A$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
4139N/A @cd $@ && echo "$(TARGET) $@" && \
4139N/A $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
4139N/A $(@:%=--component %) --make $(TARGET) $(LOG)
4139N/A
4139N/Apublish:
4139N/A $(PKGREPO) rebuild -s $(PKG_REPO)
4139N/A $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
4139N/A -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
4139N/A -s "$(CONSOLIDATION) consolidation incorporation" \
4139N/A -d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
4139N/A -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
4139N/A $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
4139N/A $(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
4139N/A# pkglint all of the published manifests in one batch.
4139N/Aifdef CANONICAL_REPO
4139N/A @echo 'pkglinting all package manifests...'
4139N/A @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
4139N/A -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
4139N/A $(shell find . -name 'manifest-*.published')
4139N/Aendif
4139N/A
4139N/A$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
4139N/A @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
4139N/A $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
4139N/A $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
4139N/A
4139N/AFORCE:
4139N/A