Makefile revision 6033
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# CDDL HEADER START
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
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#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# or http://www.opensolaris.org/os/licensing.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# See the License for the specific language governing permissions
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# and limitations under the License.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
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#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# CDDL HEADER END
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesinclude ../make-rules/shared-macros.mk
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
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
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
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes-include $(WS_MACH)/components.mk
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# depends.mk is auto-generated by concatenating 'depend.mk' files in each
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# component directory.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_MACH)/depends.mk: $(WS_MACH)/components.mk
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 2>/dev/null
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes-include $(WS_MACH)/depends.mk
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes#
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#
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_MACH)/requires.mk: $(WS_MACH)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating list of required packages to build consolidation..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(GMAKE) component-hook \
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 sort -u >$(@)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholessystem-check:: $(WS_MACH)/requires.mk
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-check
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholessystem-prep:: $(WS_MACH)/requires.mk
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Installing any missing packages..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-prep
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesdownload: TARGET = download
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesprep: TARGET = prep
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesbuild: TARGET = build
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesinstall: TARGET = install
bb2b38cd44b032118359afbc743efbea12f48e61bnicholespublish: TARGET = publish
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesclean: TARGET = clean
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesclobber: TARGET = clobber
bb2b38cd44b032118359afbc743efbea12f48e61bnicholestest: TARGET = test
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeszone-build: TARGET = component-zone-build
bb2b38cd44b032118359afbc743efbea12f48e61bnicholescomponent-hook: TARGET = component-hook
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeszone-build prep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# turn off pkglint for the individual component builds.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesifeq ($(strip $(PKGLINT_COMPONENT)),)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholespublish: MAKEFLAGS += PKGLINT=/bin/true
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesendif
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
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
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes.DEFAULT: publish
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeszone-build build install publish test: $(COMPONENT_DIRS)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesdownload:: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesprep: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholescomponent-environment-check:: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholescomponent-hook: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesclean: $(COMPONENT_DIRS.nosetup)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(RM) $(WS_MACH)/components.mk $(WS_MACH)/depends.mk \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(WS_MACH)/requires.mk $(WS_MACH)/*.p5m
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesclobber: $(COMPONENT_DIRS.nosetup) clean
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(shell find . -name 'manifest-*.published')
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholessetup: $(WS_MACH) $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_MACH) $(WS_LOGS):
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(MKDIR) $@
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_REPO):
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) create $(PKG_REPO)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG += "set pkg.summary=dummy\n"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(WS_LINT_CACHE): $(WS_LOGS) tools
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesifdef CANONICAL_REPO
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @(echo $(DUMMYPKG) | $(PKGLINT) \
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 exit 1 ) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes )
bb2b38cd44b032118359afbc743efbea12f48e61bnicholeselse
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(MKDIR) $(WS_LINT_CACHE)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesendif
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholestools:
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd $@ && echo "$(TARGET) $@" && \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(BASS_O_MATIC) $(@:%=--component %) --make $(TARGET) $(LOG)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# Turn userland-incorporator warnings into build failures
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesINCORPORATE_WERROR ?= --Werror
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesincorporation:
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGREPO) refresh -s $(PKG_REPO)
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)
405f61494d3ed3ca9c054dacc05a53513e172145bnicholes for incorporation in $(WS_MACH)/*.p5m ; do \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $${incorporation} ; \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes done
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholespublish:
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesifneq ($(BUILD_TYPE), evaluation)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes # evaluation packages don't need to be incorporated
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(MAKE) incorporation
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesendif
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes# pkglint all of the published manifests in one batch.
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesifdef CANONICAL_REPO
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @echo 'pkglinting all package manifests...'
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @$(ENV) PYTHONPATH=$(WS_TOOLS)/python \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes SOLARIS_VERSION=$(SOLARIS_VERSION) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(PKGLINT) \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(shell find . -name 'manifest-*.published')
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesendif
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes $(BASS_O_MATIC) $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes
bb2b38cd44b032118359afbc743efbea12f48e61bnicholesFORCE:
bb2b38cd44b032118359afbc743efbea12f48e61bnicholes