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