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