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