Makefile revision 883
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# CDDL HEADER START
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# The contents of this file are subject to the terms of the
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# Common Development and Distribution License (the "License").
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# You may not use this file except in compliance with the License.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# or http://www.opensolaris.org/os/licensing.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# See the License for the specific language governing permissions
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# and limitations under the License.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# When distributing Covered Code, include this CDDL HEADER in each
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# If applicable, add the following below this CDDL HEADER, with the
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# fields enclosed by brackets "[]" replaced with your own identifying
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# information: Portions Copyright [yyyy] [name of copyright owner]
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
54119bda17c0eb663f4d2147df7363de8019647fAdam Moore# CDDL HEADER END
6eb4be1e0f37f895f72bc59d0d9efd610eb78100Adam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore#
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
54119bda17c0eb663f4d2147df7363de8019647fAdam Mooreinclude ../make-rules/shared-macros.mk
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# for now, the assumption is we build any directory with a Makefile. This may
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# not always be the case. If we build a new make-like tool to drive the upper
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# level build, it may make different decisions and will need to include
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# appropriate dependency information.
54119bda17c0eb663f4d2147df7363de8019647fAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# components.mk is auto-generated by the build tools. It populates the
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# COMPONENT_DIRS macro with a list of all directories in the workspace that
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# contain a component.
e371fe50702011b7021c8d79181e88184c23448bAdam Moorecomponents.mk: # Makefile # $(WS_TOP)/components
e371fe50702011b7021c8d79181e88184c23448bAdam Moore @echo "Generating component list..."
e371fe50702011b7021c8d79181e88184c23448bAdam Moore @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
e371fe50702011b7021c8d79181e88184c23448bAdam Moore | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore-include components.mk
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
54119bda17c0eb663f4d2147df7363de8019647fAdam Moore# depends.mk is auto-generated by concatenating 'depend.mk' files in each
54119bda17c0eb663f4d2147df7363de8019647fAdam Moore# component directory.
e371fe50702011b7021c8d79181e88184c23448bAdam Mooredepends.mk: components.mk
e371fe50702011b7021c8d79181e88184c23448bAdam Moore @echo "Generating component dependencies..."
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moore @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moore | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
e371fe50702011b7021c8d79181e88184c23448bAdam Moore 2>/dev/null
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore-include depends.mk
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Mooredownload: TARGET = download
e371fe50702011b7021c8d79181e88184c23448bAdam Mooreprep: TARGET = prep
e371fe50702011b7021c8d79181e88184c23448bAdam Moorebuild: TARGET = build
e371fe50702011b7021c8d79181e88184c23448bAdam Mooreinstall: TARGET = install
e371fe50702011b7021c8d79181e88184c23448bAdam Moorepublish: TARGET = publish
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Mooreclean: TARGET = clean
6eb4be1e0f37f895f72bc59d0d9efd610eb78100Adam Mooreclobber: TARGET = clobber
e371fe50702011b7021c8d79181e88184c23448bAdam Mooretest: TARGET = test
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Mooreprep build install publish test: TEMPLATE_ZONE=$(ZONE)
b39897a381c2203466da5568bfd2862a54a81311Adam Mooreprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore# turn off pkglint for the individual component builds.
e371fe50702011b7021c8d79181e88184c23448bAdam Mooreifeq ($(strip $(PKGLINT_COMPONENT)),)
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moorepublish: MAKEFLAGS += PKGLINT=/bin/true
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Mooreendif
b39897a381c2203466da5568bfd2862a54a81311Adam Moore
6eb4be1e0f37f895f72bc59d0d9efd610eb78100Adam Moore.DEFAULT: publish
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moorebuild install publish test: $(COMPONENT_DIRS)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam MooreCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Mooredownload prep: $(COMPONENT_DIRS.nosetup)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Mooreclean: $(COMPONENT_DIRS.nosetup)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(RM) components.mk depends.mk .profile
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Mooreclobber: $(COMPONENT_DIRS.nosetup) clean
e371fe50702011b7021c8d79181e88184c23448bAdam Moore @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Mooresetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore$(WS_LOGS):
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(MKDIR) $@
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam Moore$(WS_REPO):
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(PKGREPO) create $(PKG_REPO)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
e371fe50702011b7021c8d79181e88184c23448bAdam Moore
e371fe50702011b7021c8d79181e88184c23448bAdam MooreDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
e371fe50702011b7021c8d79181e88184c23448bAdam MooreDUMMYPKG += "set pkg.summary=dummy\n"
e371fe50702011b7021c8d79181e88184c23448bAdam MooreDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
e371fe50702011b7021c8d79181e88184c23448bAdam MooreDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
$(WS_LINT_CACHE): $(WS_LOGS)
ifdef CANONICAL_REPO
@echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
@(echo $(DUMMYPKG) | $(PKGLINT) \
-c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
>$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
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) rebuild -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
# 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: