Makefile revision 6033
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# CDDL HEADER START
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# The contents of this file are subject to the terms of the
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Common Development and Distribution License (the "License").
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# You may not use this file except in compliance with the License.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# See the License for the specific language governing permissions
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# and limitations under the License.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# When distributing Covered Code, include this CDDL HEADER in each
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# If applicable, add the following below this CDDL HEADER, with the
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# fields enclosed by brackets "[]" replaced with your own identifying
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# information: Portions Copyright [yyyy] [name of copyright owner]
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# CDDL HEADER END
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# for now, the assumption is we build any directory with a Makefile. This may
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# not always be the case. If we build a new make-like tool to drive the upper
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# level build, it may make different decisions and will need to include
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# appropriate dependency information.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# components.mk is auto-generated by the build tools. It populates the
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# COMPONENT_DIRS macro with a list of all directories in the workspace that
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# contain a component.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_MACH)/components.mk: $(WS_MACH) # Makefile # $(WS_TOP)/components
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating component list..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# depends.mk is auto-generated by concatenating 'depend.mk' files in each
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# component directory.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating component dependencies..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Walk through all of the components echoing the REQUIRED_PACKAGES for each one.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Pass all output through sed to drop lines with whitespace between words,
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# remove whitespace from lines, drop empty lines, and REQUIRED_PACKAGES +=
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# to the lines. Pass that through sort -u
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating list of required packages to build consolidation..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes COMPONENT_HOOK='@echo $$(REQUIRED_PACKAGES:%="%\\n")' | \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(GSED) -e '/\S\s\S/d' -e 's/^ //g' -e '/^\s*$$/d' \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes -e 's/^/REQUIRED_PACKAGES += /' | \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-check
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Installing any missing packages..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-prep
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeszone-build prep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# turn off pkglint for the individual component builds.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# In order to work around an IPS simultaneous publication issue and to improve
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# top level build performance, we postpone catalog and index updates until the
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# end of the build. Individual component builds postpone the updates until
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# they have published all of their packages.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholespublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeszone-build build install publish test: $(COMPONENT_DIRS)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholescomponent-environment-check:: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(RM) $(WS_MACH)/components.mk $(WS_MACH)/depends.mk \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
bb2b38cd44b032118359afbc743efbea12f48e61bnicholessetup: $(WS_MACH) $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 || \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes ( echo "pkglint(1) failed, please see $(WS_LOGS)/naughty-canonical-repo-actions"; \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(BASS_O_MATIC) $(@:%=--component %) --make $(TARGET) $(LOG)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Turn userland-incorporator warnings into build failures
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes --version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes -c $(CONSOLIDATION) --destdir=$(WS_MACH) $(INCORPORATE_WERROR)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes # evaluation packages don't need to be incorporated
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# pkglint all of the published manifests in one batch.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo 'pkglinting all package manifests...'
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(BASS_O_MATIC) $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)