Makefile revision 3988
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye#
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# CDDL HEADER START
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner#
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# The contents of this file are subject to the terms of the
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# Common Development and Distribution License (the "License").
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# You may not use this file except in compliance with the License.
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye#
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# or http://www.opensolaris.org/os/licensing.
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# See the License for the specific language governing permissions
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# and limitations under the License.
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye#
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# When distributing Covered Code, include this CDDL HEADER in each
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# If applicable, add the following below this CDDL HEADER, with the
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# fields enclosed by brackets "[]" replaced with your own identifying
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# information: Portions Copyright [yyyy] [name of copyright owner]
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye#
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# CDDL HEADER END
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye#
d7632865cbb23540feb5b66d1c3f8569bbac6c61Knut Anders Hatlen# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner#
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerinclude ../make-rules/shared-macros.mk
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# for now, the assumption is we build any directory with a Makefile. This may
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# not always be the case. If we build a new make-like tool to drive the upper
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# level build, it may make different decisions and will need to include
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# appropriate dependency information.
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# components.mk is auto-generated by the build tools. It populates the
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# COMPONENT_DIRS macro with a list of all directories in the workspace that
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# contain a component.
14a41f02433890d19b2f871156271e3388cd0845Jens Elknercomponents.mk: # Makefile # $(WS_TOP)/components
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner @echo "Generating component list..."
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner-include components.mk
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
832ed3afe9d56def0ba8851d5c9a9b742e619217Trond Norbye# depends.mk is auto-generated by concatenating 'depend.mk' files in each
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# component directory.
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerdepends.mk: components.mk
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner @echo "Generating component dependencies..."
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner 2>/dev/null
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner-include depends.mk
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerdownload: TARGET = download
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerprep: TARGET = prep
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerbuild: TARGET = build
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerinstall: TARGET = install
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerpublish: TARGET = publish
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerclean: TARGET = clean
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerclobber: TARGET = clobber
14a41f02433890d19b2f871156271e3388cd0845Jens Elknertest: TARGET = test
14a41f02433890d19b2f871156271e3388cd0845Jens Elknercomponent-hook: TARGET = component-hook
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerprep build install publish test: TEMPLATE_ZONE=$(ZONE)
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# turn off pkglint for the individual component builds.
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerifeq ($(strip $(PKGLINT_COMPONENT)),)
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerpublish: MAKEFLAGS += PKGLINT=/bin/true
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerendif
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# In order to work around an IPS simultaneous publication issue and to improve
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# top level build performance, we postpone catalog and index updates until the
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# end of the build. Individual component builds postpone the updates until
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner# they have published all of their packages.
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerpublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
.DEFAULT: publish
build install publish test: $(COMPONENT_DIRS)
COMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
download prep: $(COMPONENT_DIRS.nosetup)
component-hook: $(COMPONENT_DIRS.nosetup)
clean: $(COMPONENT_DIRS.nosetup)
$(RM) components.mk depends.mk .profile
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_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
$(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
# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
# to pass a few things on to zone based builds
.profile:
echo "PATH=$(PATH)" >>$@
echo "WS_TOP=$(WS_TOP)" >>$@
echo "export PATH WS_TOP" >>$@
$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
@cd $@ && echo "$(TARGET) $@" && \
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
$(@:%=--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_LOGS) $(INCORPORATE_WERROR)
for incorporation in $(WS_LOGS)/*.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) $(TEMPLATE_ZONE:%=--template-zone %) \
$(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
FORCE: