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