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