Makefile revision 1900
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# CDDL HEADER START
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# The contents of this file are subject to the terms of the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# Common Development and Distribution License (the "License").
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# You may not use this file except in compliance with the License.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# or http://www.opensolaris.org/os/licensing.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# See the License for the specific language governing permissions
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# and limitations under the License.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# If applicable, add the following below this CDDL HEADER, with the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
af5073d03288a53b646ec3b807ac25ced64d7879Mark Andrews# CDDL HEADER END
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# for now, the assumption is we build any directory with a Makefile. This may
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# not always be the case. If we build a new make-like tool to drive the upper
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# level build, it may make different decisions and will need to include
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# appropriate dependency information.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# components.mk is auto-generated by the build tools. It populates the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# COMPONENT_DIRS macro with a list of all directories in the workspace that
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# contain a component.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewscomponents.mk: # Makefile # $(WS_TOP)/components
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews @echo "Generating component list..."
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
a0624cf8d5711cca4e3907859fbc8062a7e460faMark Andrews# depends.mk is auto-generated by concatenating 'depend.mk' files in each
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# component directory.
a0624cf8d5711cca4e3907859fbc8062a7e460faMark Andrews @echo "Generating component dependencies..."
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewsprep build install publish test: TEMPLATE_ZONE=$(ZONE)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewsprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# turn off pkglint for the individual component builds.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# In order to work around an IPS simultaneous publication issue and to improve
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# top level build performance, we postpone catalog and index updates until the
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# end of the build. Individual component builds postpone the updates until
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews# they have published all of their packages.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewspublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonbuild install publish test: $(COMPONENT_DIRS)
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewssetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
068a66979695c77359e7a9181bb3f831c965b21cMark AndrewsDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
068a66979695c77359e7a9181bb3f831c965b21cMark AndrewsDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
068a66979695c77359e7a9181bb3f831c965b21cMark AndrewsDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# to pass a few things on to zone based builds
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews echo "export PATH WS_TOP" >>$@
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews -s "$(CONSOLIDATION) consolidation incorporation" \
a0624cf8d5711cca4e3907859fbc8062a7e460faMark Andrews -d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
a0624cf8d5711cca4e3907859fbc8062a7e460faMark Andrews -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
a0624cf8d5711cca4e3907859fbc8062a7e460faMark Andrews $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews# pkglint all of the published manifests in one batch.
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews @echo 'pkglinting all package manifests...'
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
75216e007570b8ea36b3ac9cca096bf70c0ca6f6Mark Andrews $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)