Makefile revision 346
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# CDDL HEADER START
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# The contents of this file are subject to the terms of the
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# Common Development and Distribution License (the "License").
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# You may not use this file except in compliance with the License.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# or http://www.opensolaris.org/os/licensing.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# See the License for the specific language governing permissions
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# and limitations under the License.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# When distributing Covered Code, include this CDDL HEADER in each
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# If applicable, add the following below this CDDL HEADER, with the
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# fields enclosed by brackets "[]" replaced with your own identifying
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# information: Portions Copyright [yyyy] [name of copyright owner]
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# CDDL HEADER END
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiinclude ../make-rules/shared-macros.mk
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg# for now, the assumption is we build any directory with a Makefile. This may
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# not always be the case. If we build a new make-like tool to drive the upper
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# level build, it may make different decisions and will need to include
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# appropriate dependency information.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# components.mk is auto-generated by the build tools. It populates the
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# COMPONENT_DIRS macro with a list of all directories in the workspace that
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# contain a component.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaicomponents.mk: # Makefile # $(WS_TOP)/components
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @echo "Generating component list..."
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai-include components.mk
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# depends.mk is auto-generated by concatenating 'depend.mk' files in each
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai# component directory.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaidepends.mk: components.mk
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @echo "Generating component dependencies..."
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai 2>/dev/null
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai-include depends.mk
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaidownload: TARGET = download
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiprep: TARGET = prep
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaibuild: TARGET = build
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiinstall: TARGET = install
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaipublish: TARGET = publish
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiclean: TARGET = clean
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiclobber: TARGET = clobber
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaitest: TARGET = test
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiprep build install publish test: TEMPLATE_ZONE=$(ZONE)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg# turn off pkglint for the individual component builds.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaipublish: MAKEFLAGS += PKGLINT=/bin/true
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg.DEFAULT: publish
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jgbuild install publish test: $(COMPONENT_DIRS)
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jgCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jgdownload prep: $(COMPONENT_DIRS.nosetup)
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jgclean: $(COMPONENT_DIRS.nosetup)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(RM) components.mk depends.mk .profile
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiclobber: $(COMPONENT_DIRS.nosetup) clean
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaisetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai$(WS_LOGS):
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(MKDIR) $@
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai$(WS_REPO):
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(PKGREPO) create $(PKG_REPO)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai$(WS_LINT_CACHE): $(WS_LOGS)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiifdef CANONICAL_REPO
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai @(echo "set name=fmri value=pkg:/dummy" | $(PKGLINT) \
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaielse
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai $(MKDIR) $(WS_LINT_CACHE)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiendif
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaitools:
@cd ../tools ; echo "building tools..." ; $(GMAKE) 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)
# 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: