Makefile revision 4561
0N/A#
2362N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License (the "License").
0N/A# You may not use this file except in compliance with the License.
2362N/A#
0N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2362N/A# or http://www.opensolaris.org/os/licensing.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
0N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
2362N/A# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
2362N/A#
2362N/A
0N/Ainclude ../make-rules/shared-macros.mk
0N/A
0N/A# for now, the assumption is we build any directory with a Makefile. This may
0N/A# not always be the case. If we build a new make-like tool to drive the upper
0N/A# level build, it may make different decisions and will need to include
0N/A# appropriate dependency information.
0N/A
0N/A# components.mk is auto-generated by the build tools. It populates the
0N/A# COMPONENT_DIRS macro with a list of all directories in the workspace that
0N/A# contain a component.
0N/A$(WS_MACH)/components.mk: $(WS_MACH) # Makefile # $(WS_TOP)/components
0N/A @echo "Generating component list..."
0N/A @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
0N/A | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
0N/A
0N/A-include $(WS_MACH)/components.mk
0N/A
0N/A# depends.mk is auto-generated by concatenating 'depend.mk' files in each
0N/A# component directory.
0N/A$(WS_MACH)/depends.mk: $(WS_MACH)/components.mk
955N/A @echo "Generating component dependencies..."
3259N/A @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
3259N/A | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
955N/A 2>/dev/null
955N/A
0N/A-include $(WS_MACH)/depends.mk
2157N/A
2157N/A#
0N/A# Walk through all of the components echoing the REQUIRED_PACKAGES for each one.
0N/A# Pass all output through sed to drop lines with whitespace between words,
0N/A# remove whitespace from lines, drop empty lines, and REQUIRED_PACKAGES +=
0N/A# to the lines. Pass that through sort -u
0N/A#
0N/A$(WS_MACH)/requires.mk: $(WS_MACH)
0N/A @echo "Generating list of required packages to build consolidation..."
0N/A @$(GMAKE) component-hook \
0N/A COMPONENT_HOOK='@echo $$(REQUIRED_PACKAGES:%="%\\n")' | \
0N/A $(GSED) -e '/\S\s\S/d' -e 's/^ //g' -e '/^\s*$$/d' \
0N/A -e 's/^/REQUIRED_PACKAGES += /' | \
0N/A sort -u >$(@)
0N/A
0N/Asystem-check:: $(WS_MACH)/requires.mk
0N/A @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-check
0N/A
0N/Asystem-prep:: $(WS_MACH)/requires.mk
0N/A @echo "Installing any missing packages..."
0N/A @$(GMAKE) -f $(WS_MAKE_RULES)/environment.mk -f $< component-environment-prep
0N/A
0N/Adownload: TARGET = download
0N/Aprep: TARGET = prep
0N/Abuild: TARGET = build
0N/Ainstall: TARGET = install
0N/Apublish: TARGET = publish
0N/Aclean: TARGET = clean
0N/Aclobber: TARGET = clobber
0N/Atest: TARGET = test
0N/Azone-build: TARGET = component-zone-build
0N/Acomponent-hook: TARGET = component-hook
0N/Azone-build prep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
0N/A
0N/A# turn off pkglint for the individual component builds.
0N/Aifeq ($(strip $(PKGLINT_COMPONENT)),)
0N/Apublish: MAKEFLAGS += PKGLINT=/bin/true
0N/Aendif
0N/A
0N/A# In order to work around an IPS simultaneous publication issue and to improve
0N/A# top level build performance, we postpone catalog and index updates until the
0N/A# end of the build. Individual component builds postpone the updates until
0N/A# they have published all of their packages.
0N/Apublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
0N/A
0N/A
0N/A.DEFAULT: publish
0N/A
0N/Azone-build build install publish test: $(COMPONENT_DIRS)
0N/A
0N/ACOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
0N/A
0N/Adownload:: $(COMPONENT_DIRS.nosetup)
0N/Aprep: $(COMPONENT_DIRS.nosetup)
0N/Acomponent-environment-check:: $(COMPONENT_DIRS.nosetup)
0N/Acomponent-hook: $(COMPONENT_DIRS.nosetup)
0N/A
0N/Aclean: $(COMPONENT_DIRS.nosetup)
0N/A $(RM) $(WS_MACH)/components.mk $(WS_MACH)/depends.mk \
0N/A $(WS_MACH)/requires.mk $(WS_MACH)/*.p5m
0N/A
0N/Aclobber: $(COMPONENT_DIRS.nosetup) clean
0N/A @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
0N/A $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE) \
0N/A $(shell find . -name 'manifest-*.published')
0N/A
0N/A
0N/Asetup: $(WS_MACH) $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
0N/A
0N/A$(WS_MACH) $(WS_LOGS):
0N/A $(MKDIR) $@
0N/A
0N/A$(WS_REPO):
0N/A $(PKGREPO) create $(PKG_REPO)
0N/A $(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:
ifneq ($(BUILD_TYPE), evaluation)
# evaluation packages don't need to be incorporated
$(MAKE) incorporation
endif
# 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: