Makefile revision 290
327N/A#
327N/A# CDDL HEADER START
327N/A#
327N/A# The contents of this file are subject to the terms of the
327N/A# Common Development and Distribution License (the "License").
327N/A# You may not use this file except in compliance with the License.
327N/A#
327N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
327N/A# or http://www.opensolaris.org/os/licensing.
327N/A# See the License for the specific language governing permissions
327N/A# and limitations under the License.
327N/A#
327N/A# When distributing Covered Code, include this CDDL HEADER in each
327N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
327N/A# If applicable, add the following below this CDDL HEADER, with the
327N/A# fields enclosed by brackets "[]" replaced with your own identifying
327N/A# information: Portions Copyright [yyyy] [name of copyright owner]
327N/A#
327N/A# CDDL HEADER END
327N/A#
327N/A# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
327N/A#
3976N/A
327N/Ainclude ../make-rules/shared-macros.mk
327N/A
327N/A# for now, the assumption is we build any directory with a Makefile. This may
327N/A# not always be the case. If we build a new make-like tool to drive the upper
864N/A# level build, it may make different decisions and will need to include
864N/A# appropriate dependency information.
327N/A
824N/A# components.mk is auto-generated by the build tools. It populates the
327N/A# COMPONENT_DIRS macro with a list of all directories in the workspace that
618N/A# contain a component.
327N/Acomponents.mk: # Makefile # $(WS_TOP)/components
844N/A @echo "Generating component list..."
844N/A @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
327N/A | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
1273N/A
327N/A-include components.mk
3661N/A
3661N/A# depends.mk is auto-generated by concatenating 'depend.mk' files in each
327N/A# component directory.
327N/Adepends.mk: components.mk
327N/A @echo "Generating component dependencies..."
327N/A @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
327N/A | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
327N/A 2>/dev/null
327N/A
327N/A-include depends.mk
327N/A
327N/A
327N/Adownload: TARGET = download
327N/Aprep: TARGET = prep
327N/Abuild: TARGET = build
327N/Ainstall: TARGET = install
327N/Apublish: TARGET = publish
327N/Ainstall-packages: TARGET = install-packages
327N/Avalidate: TARGET = validate
327N/Aclean: TARGET = clean
327N/Aclobber: TARGET = clobber
327N/Atest: TARGET = test
327N/Aprep build install publish test: TEMPLATE_ZONE=$(ZONE)
327N/Aprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
327N/A
824N/A# turn off pkglint for the individual component builds.
327N/Apublish: MAKEFLAGS += PKGLINT=/bin/true
327N/A
327N/A.DEFAULT: publish
327N/A
327N/Adownload prep build install publish install-packages validate \
327N/Atest: $(COMPONENT_DIRS)
327N/A
327N/ACOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
327N/A
327N/Aclean: $(COMPONENT_DIRS:%=%.nosetup)
327N/A $(RM) components.mk depends.mk .profile
327N/A
327N/Aclobber: $(COMPONENT_DIRS:%=%.nosetup) clean
327N/A $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
327N/A
327N/Asetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
327N/A
327N/A$(WS_LOGS):
327N/A $(MKDIR) $@
327N/A
327N/A$(WS_REPO):
$(PKGREPO) create $(PKG_REPO)
$(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
$(WS_LINT_CACHE): $(WS_LOGS)
ifdef CANONICAL_REPO
@echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
@(echo "set name=fmri value=pkg:/dummy" | $(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) 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): 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): FORCE
@cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
$(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
FORCE: