Makefile revision 3953
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# CDDL HEADER START
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# The contents of this file are subject to the terms of the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# Common Development and Distribution License (the "License").
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# You may not use this file except in compliance with the License.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# or http://www.opensolaris.org/os/licensing.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# See the License for the specific language governing permissions
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# and limitations under the License.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# When distributing Covered Code, include this CDDL HEADER in each
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# If applicable, add the following below this CDDL HEADER, with the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# fields enclosed by brackets "[]" replaced with your own identifying
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# information: Portions Copyright [yyyy] [name of copyright owner]
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# CDDL HEADER END
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
3f7d54a6b84904c8f4d8daa4c7b577bede7df8b9Garrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreinclude ../make-rules/shared-macros.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# for now, the assumption is we build any directory with a Makefile. This may
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# not always be the case. If we build a new make-like tool to drive the upper
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# level build, it may make different decisions and will need to include
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# appropriate dependency information.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# components.mk is auto-generated by the build tools. It populates the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# COMPONENT_DIRS macro with a list of all directories in the workspace that
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# contain a component.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore$(WS_MACH)/components.mk: $(WS_MACH) # Makefile # $(WS_TOP)/components
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @echo "Generating component list..."
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore-include $(WS_MACH)/components.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# depends.mk is auto-generated by concatenating 'depend.mk' files in each
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# component directory.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore$(WS_MACH)/depends.mk: $(WS_MACH)/components.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @echo "Generating component dependencies..."
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore 2>/dev/null
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore-include $(WS_MACH)/depends.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# Walk through all of the components echoing the REQUIRED_PACKAGES for each one.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# Pass all output through sed to drop lines with whitespace between words,
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# remove whitespace from lines, drop empty lines, and REQUIRED_PACKAGES +=
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# to the lines. Pass that through sort -u
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore#
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore$(WS_MACH)/requires.mk: $(WS_MACH)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @echo "Generating list of required packages to build consolidation..."
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @$(GMAKE) component-hook \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore COMPONENT_HOOK='@echo $$(REQUIRED_PACKAGES:%="%\\n")' | \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore $(GSED) -e '/\S\s\S/d' -e 's/^ //g' -e '/^\s*$$/d' \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore -e 's/^/REQUIRED_PACKAGES += /' | \
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore sort -u >$(@)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresystem-check:: $(WS_MACH)/requires.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-check
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoresystem-prep:: $(WS_MACH)/requires.mk
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @echo "Installing any missing packages..."
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-prep
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
3f7d54a6b84904c8f4d8daa4c7b577bede7df8b9Garrett D'Amoredownload: TARGET = download
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreprep: TARGET = prep
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorebuild: TARGET = build
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreinstall: TARGET = install
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorepublish: TARGET = publish
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreclean: TARGET = clean
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreclobber: TARGET = clobber
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoretest: TARGET = test
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorezone-build: TARGET = component-zone-build
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorecomponent-hook: TARGET = component-hook
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorezone-build prep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# turn off pkglint for the individual component builds.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreifeq ($(strip $(PKGLINT_COMPONENT)),)
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorepublish: MAKEFLAGS += PKGLINT=/bin/true
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoreendif
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# In order to work around an IPS simultaneous publication issue and to improve
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# top level build performance, we postpone catalog and index updates until the
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# end of the build. Individual component builds postpone the updates until
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# they have published all of their packages.
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorepublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore# For cases in which a component test should be skipped at at the top level
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amoretest: MAKEFLAGS += TOP_LEVEL_TEST=yes
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore.DEFAULT: publish
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amore
4bb7efa72ed531c10f097919636e67724ec4c25aGarrett D'Amorezone-build build install publish test: $(COMPONENT_DIRS)
COMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
download:: $(COMPONENT_DIRS.nosetup)
prep: $(COMPONENT_DIRS.nosetup)
component-environment-check:: $(COMPONENT_DIRS.nosetup)
component-hook: $(COMPONENT_DIRS.nosetup)
clean: $(COMPONENT_DIRS.nosetup)
$(RM) $(WS_MACH)/components.mk $(WS_MACH)/depends.mk \
$(WS_MACH)/requires.mk $(WS_MACH)/*.p5m
clobber: $(COMPONENT_DIRS.nosetup) clean
@cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
$(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE) \
$(shell find . -name 'manifest-*.published')
setup: $(WS_MACH) $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
$(WS_MACH) $(WS_LOGS):
$(MKDIR) $@
$(WS_REPO):
$(PKGREPO) create $(PKG_REPO)
$(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
$(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
DUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
DUMMYPKG += "set pkg.summary=dummy\n"
DUMMYPKG += "set org.opensolaris.consolidation=userland\n"
DUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
$(WS_LINT_CACHE): $(WS_LOGS) tools
ifdef CANONICAL_REPO
@echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
@(echo $(DUMMYPKG) | $(PKGLINT) \
-c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
>$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 || \
( echo "pkglint(1) failed, please see $(WS_LOGS)/naughty-canonical-repo-actions"; \
exit 1 ) \
)
else
$(MKDIR) $(WS_LINT_CACHE)
endif
tools:
@cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
@cd $@ && echo "$(TARGET) $@" && \
$(BASS_O_MATIC) $(@:%=--component %) --make $(TARGET) $(LOG)
# Turn userland-incorporator warnings into build failures
INCORPORATE_WERROR ?= --Werror
incorporation:
$(PKGREPO) refresh -s $(PKG_REPO)
$(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
--version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
-c $(CONSOLIDATION) --destdir=$(WS_MACH) $(INCORPORATE_WERROR)
for incorporation in $(WS_MACH)/*.p5m ; do \
$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
$${incorporation} ; \
done
publish:
$(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) $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
FORCE: