Makefile revision 3468
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami#
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinclude ../make-rules/shared-macros.mk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# for now, the assumption is we build any directory with a Makefile. This may
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# not always be the case. If we build a new make-like tool to drive the upper
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# level build, it may make different decisions and will need to include
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# appropriate dependency information.
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# components.mk is auto-generated by the build tools. It populates the
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# COMPONENT_DIRS macro with a list of all directories in the workspace that
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami# contain a component.
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahramicomponents.mk: # Makefile # $(WS_TOP)/components
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami @echo "Generating component list..."
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
bfed486ad8de8b8ebc6345a8e10accae08bf2f45Ali Bahrami
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami-include components.mk
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami# depends.mk is auto-generated by concatenating 'depend.mk' files in each
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami# component directory.
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing Chinadepends.mk: components.mk
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China @echo "Generating component dependencies..."
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
24d15a9c44ff66447d6bf8c1b90a9f746980de9fyi zhang - Sun Microsystems - Beijing China | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
aff4bce51ecc47df7e5a6351b7cee6bc20408c63yi zhang - Sun Microsystems - Beijing China 2>/dev/null
cd3e933325e68e23516a196a8fea7f49b1e497c3Ali Bahrami
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte-include depends.mk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedownload: TARGET = download
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprep: TARGET = prep
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortebuild: TARGET = build
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinstall: TARGET = install
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepublish: TARGET = publish
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclean: TARGET = clean
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclobber: TARGET = clobber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetest: TARGET = test
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecomponent-hook: TARGET = component-hook
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprep build install publish test: TEMPLATE_ZONE=$(ZONE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# turn off pkglint for the individual component builds.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteifeq ($(strip $(PKGLINT_COMPONENT)),)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepublish: MAKEFLAGS += PKGLINT=/bin/true
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteendif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# In order to work around an IPS simultaneous publication issue and to improve
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# top level build performance, we postpone catalog and index updates until the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# end of the build. Individual component builds postpone the updates until
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# they have published all of their packages.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte.DEFAULT: publish
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortebuild install publish test: $(COMPONENT_DIRS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedownload prep: $(COMPONENT_DIRS.nosetup)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecomponent-hook: $(COMPONENT_DIRS.nosetup)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclean: $(COMPONENT_DIRS.nosetup)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(RM) components.mk depends.mk .profile
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclobber: $(COMPONENT_DIRS.nosetup) clean
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte$(WS_LOGS):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(MKDIR) $@
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte$(WS_REPO):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(PKGREPO) create $(PKG_REPO)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDUMMYPKG += "set pkg.summary=dummy\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte$(WS_LINT_CACHE): $(WS_LOGS) tools
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteifdef CANONICAL_REPO
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @(echo $(DUMMYPKG) | $(PKGLINT) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 || \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ( echo "pkglint(1) failed, please see $(WS_LOGS)/naughty-canonical-repo-actions"; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit 1 ) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte )
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteelse
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(MKDIR) $(WS_LINT_CACHE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteendif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetools:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# to pass a few things on to zone based builds
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte.profile:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "PATH=$(PATH)" >>$@
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "WS_TOP=$(WS_TOP)" >>$@
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte echo "export PATH WS_TOP" >>$@
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @cd $@ && echo "$(TARGET) $@" && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(@:%=--component %) --make $(TARGET) $(LOG)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte# Turn userland-incorporator warnings into build failures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteINCORPORATE_WERROR ?= --Werror
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteincorporation:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(PKGREPO) refresh -s $(PKG_REPO)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte --version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte -c $(CONSOLIDATION) --destdir=$(WS_LOGS) $(INCORPORATE_WERROR)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for incorporation in $(WS_LOGS)/*.p5m ; do \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte $${incorporation} ; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte done
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepublish:
$(MAKE) incorporation
# pkglint all of the published manifests in one batch.
ifdef CANONICAL_REPO
@echo 'pkglinting all package manifests...'
@$(ENV) PYTHONPATH=$(WS_TOOLS)/python \
SOLARIS_VERSION=$(SOLARIS_VERSION) \
$(PKGLINT) \
-c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
$(shell find . -name 'manifest-*.published')
endif
$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
@cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
$(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
FORCE: