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