Makefile revision 2157
259N/A#
259N/A# CDDL HEADER START
259N/A#
259N/A# The contents of this file are subject to the terms of the
259N/A# Common Development and Distribution License (the "License").
259N/A# You may not use this file except in compliance with the License.
259N/A#
259N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
259N/A# or http://www.opensolaris.org/os/licensing.
259N/A# See the License for the specific language governing permissions
259N/A# and limitations under the License.
259N/A#
259N/A# When distributing Covered Code, include this CDDL HEADER in each
259N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
259N/A# If applicable, add the following below this CDDL HEADER, with the
259N/A# fields enclosed by brackets "[]" replaced with your own identifying
259N/A# information: Portions Copyright [yyyy] [name of copyright owner]
259N/A#
259N/A# CDDL HEADER END
259N/A#
817N/A# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
259N/A#
259N/A
259N/Ainclude ../make-rules/shared-macros.mk
259N/A
259N/A# for now, the assumption is we build any directory with a Makefile. This may
259N/A# not always be the case. If we build a new make-like tool to drive the upper
259N/A# level build, it may make different decisions and will need to include
259N/A# appropriate dependency information.
618N/A
817N/A# components.mk is auto-generated by the build tools. It populates the
817N/A# COMPONENT_DIRS macro with a list of all directories in the workspace that
618N/A# contain a component.
259N/Acomponents.mk: # Makefile # $(WS_TOP)/components
259N/A @echo "Generating component list..."
259N/A @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
259N/A | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
259N/A
259N/A-include components.mk
259N/A
259N/A# depends.mk is auto-generated by concatenating 'depend.mk' files in each
259N/A# component directory.
259N/Adepends.mk: components.mk
259N/A @echo "Generating component dependencies..."
259N/A @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
259N/A | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
259N/A 2>/dev/null
259N/A
259N/A-include depends.mk
259N/A
259N/A
259N/Adownload: TARGET = download
259N/Aprep: TARGET = prep
259N/Abuild: TARGET = build
259N/Ainstall: TARGET = install
259N/Apublish: TARGET = publish
259N/Aclean: TARGET = clean
259N/Aclobber: TARGET = clobber
259N/Atest: TARGET = test
259N/Acomponent-hook: TARGET = component-hook
259N/Aprep build install publish test: TEMPLATE_ZONE=$(ZONE)
259N/Aprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
259N/A
259N/A# turn off pkglint for the individual component builds.
259N/Aifeq ($(strip $(PKGLINT_COMPONENT)),)
259N/Apublish: MAKEFLAGS += PKGLINT=/bin/true
259N/Aendif
259N/A
259N/A# In order to work around an IPS simultaneous publication issue and to improve
259N/A# top level build performance, we postpone catalog and index updates until the
259N/A# end of the build. Individual component builds postpone the updates until
259N/A# they have published all of their packages.
259N/Apublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
259N/A
259N/A
259N/A.DEFAULT: publish
259N/A
259N/Abuild install publish test: $(COMPONENT_DIRS)
259N/A
259N/ACOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
259N/A
259N/Adownload prep: $(COMPONENT_DIRS.nosetup)
259N/A
259N/Acomponent-hook: $(COMPONENT_DIRS.nosetup)
259N/A
259N/Aclean: $(COMPONENT_DIRS.nosetup)
259N/A $(RM) components.mk depends.mk .profile
259N/A
259N/Aclobber: $(COMPONENT_DIRS.nosetup) clean
259N/A @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
$(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
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)
publish:
$(PKGREPO) refresh -s $(PKG_REPO)
$(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
-p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
-s "$(CONSOLIDATION) consolidation incorporation" \
-d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
-c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
$(PKGREPO) refresh -s $(PKG_REPO)
# pkglint all of the published manifests in one batch.
ifdef CANONICAL_REPO
@echo 'pkglinting all package manifests...'
@$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(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: