Makefile revision 500
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley#
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley# CDDL HEADER START
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley#
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# The contents of this file are subject to the terms of the
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# Common Development and Distribution License (the "License").
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# You may not use this file except in compliance with the License.
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley#
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halley# or http://www.opensolaris.org/os/licensing.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# See the License for the specific language governing permissions
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# and limitations under the License.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley#
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# When distributing Covered Code, include this CDDL HEADER in each
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# If applicable, add the following below this CDDL HEADER, with the
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# fields enclosed by brackets "[]" replaced with your own identifying
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# information: Portions Copyright [yyyy] [name of copyright owner]
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff#
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# CDDL HEADER END
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff#
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff#
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffinclude ../make-rules/shared-macros.mk
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# for now, the assumption is we build any directory with a Makefile. This may
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# not always be the case. If we build a new make-like tool to drive the upper
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# level build, it may make different decisions and will need to include
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# appropriate dependency information.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# components.mk is auto-generated by the build tools. It populates the
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# COMPONENT_DIRS macro with a list of all directories in the workspace that
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# contain a component.
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halleycomponents.mk: # Makefile # $(WS_TOP)/components
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley @echo "Generating component list..."
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff-include components.mk
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# depends.mk is auto-generated by concatenating 'depend.mk' files in each
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# component directory.
036f4a76ec5e5bdba8a7d2f7e77c188a8246bbacBob Halleydepends.mk: components.mk
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley @echo "Generating component dependencies..."
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff 2>/dev/null
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff-include depends.mk
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffdownload: TARGET = download
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffprep: TARGET = prep
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffbuild: TARGET = build
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffinstall: TARGET = install
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffpublish: TARGET = publish
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffclean: TARGET = clean
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffclobber: TARGET = clobber
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Grafftest: TARGET = test
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffprep build install publish test: TEMPLATE_ZONE=$(ZONE)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# turn off pkglint for the individual component builds.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffpublish: MAKEFLAGS += PKGLINT=/bin/true
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff.DEFAULT: publish
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffbuild install publish test: $(COMPONENT_DIRS)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael GraffCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffdownload prep: $(COMPONENT_DIRS.nosetup)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffclean: $(COMPONENT_DIRS.nosetup)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(RM) components.mk depends.mk .profile
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffclobber: $(COMPONENT_DIRS.nosetup) clean
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffsetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff$(WS_LOGS):
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(MKDIR) $@
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff$(WS_REPO):
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(PKGREPO) create $(PKG_REPO)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff$(WS_LINT_CACHE): $(WS_LOGS)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffifdef CANONICAL_REPO
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @(echo "set name=fmri value=pkg:/dummy" | $(PKGLINT) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffelse
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley $(MKDIR) $(WS_LINT_CACHE)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffendif
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Grafftools:
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff# to pass a few things on to zone based builds
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff.profile:
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff echo "PATH=$(PATH)" >>$@
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff echo "WS_TOP=$(WS_TOP)" >>$@
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff echo "export PATH WS_TOP" >>$@
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @cd $@ && echo "$(TARGET) $@" && \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(@:%=--component %) --make $(TARGET) $(LOG)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffpublish:
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(PKGREPO) rebuild -s $(PKG_REPO)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -s "$(CONSOLIDATION) consolidation incorporation" \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley# pkglint all of the published manifests in one batch.
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffifdef CANONICAL_REPO
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @echo 'pkglinting all package manifests...'
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
3da473e3e96d2d054331b43519426a9b5f83cf4cBob Halley $(shell find . -name 'manifest-*.published')
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graffendif
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael GraffFORCE:
d2eb1644065bdfdf7ffd29d1f922600be313e9a0Michael Graff