Makefile revision 38
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# CDDL HEADER START
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# The contents of this file are subject to the terms of the
7bc7346c0c75ced7da727f63c2772fd53809244dcm# Common Development and Distribution License (the "License").
7bc7346c0c75ced7da727f63c2772fd53809244dcm# You may not use this file except in compliance with the License.
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7bc7346c0c75ced7da727f63c2772fd53809244dcm# or http://www.opensolaris.org/os/licensing.
7bc7346c0c75ced7da727f63c2772fd53809244dcm# See the License for the specific language governing permissions
7bc7346c0c75ced7da727f63c2772fd53809244dcm# and limitations under the License.
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# When distributing Covered Code, include this CDDL HEADER in each
7bc7346c0c75ced7da727f63c2772fd53809244dcm# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7bc7346c0c75ced7da727f63c2772fd53809244dcm# If applicable, add the following below this CDDL HEADER, with the
7bc7346c0c75ced7da727f63c2772fd53809244dcm# fields enclosed by brackets "[]" replaced with your own identifying
7bc7346c0c75ced7da727f63c2772fd53809244dcm# information: Portions Copyright [yyyy] [name of copyright owner]
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# CDDL HEADER END
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm# Copyright (c) 2010, Oracle and/or it's affiliates. All rights reserved.
7bc7346c0c75ced7da727f63c2772fd53809244dcm#
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcminclude ../make-rules/shared-macros.mk
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm# for now, the assumption is we build any directory with a Makefile. This may
7bc7346c0c75ced7da727f63c2772fd53809244dcm# not always be the case. If we build a new make-like tool to drive the upper
7bc7346c0c75ced7da727f63c2772fd53809244dcm# level build, it may make different decisions and will need to include
7bc7346c0c75ced7da727f63c2772fd53809244dcm# appropriate dependency information.
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm# components.mk is auto-generated by the build tools. It populates the
7bc7346c0c75ced7da727f63c2772fd53809244dcm# COMPONENT_DIRS macro with a list of all directories in the workspace that
7bc7346c0c75ced7da727f63c2772fd53809244dcm# contain a component.
7bc7346c0c75ced7da727f63c2772fd53809244dcmcomponents.mk: # Makefile # $(WS_TOP)/components
7bc7346c0c75ced7da727f63c2772fd53809244dcm @echo "Generating component list..."
7bc7346c0c75ced7da727f63c2772fd53809244dcm @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
7bc7346c0c75ced7da727f63c2772fd53809244dcm | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcminclude components.mk
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmdownload: TARGET = download
7bc7346c0c75ced7da727f63c2772fd53809244dcmprep: TARGET = prep
7bc7346c0c75ced7da727f63c2772fd53809244dcmbuild: TARGET = build
7bc7346c0c75ced7da727f63c2772fd53809244dcminstall: TARGET = install
7bc7346c0c75ced7da727f63c2772fd53809244dcmpublish: TARGET = publish
7bc7346c0c75ced7da727f63c2772fd53809244dcminstall-packages: TARGET = install-packages
7bc7346c0c75ced7da727f63c2772fd53809244dcmvalidate: TARGET = validate
7bc7346c0c75ced7da727f63c2772fd53809244dcmclean: TARGET = clean
7bc7346c0c75ced7da727f63c2772fd53809244dcmclobber: TARGET = clobber
7bc7346c0c75ced7da727f63c2772fd53809244dcmprep build install publish: TEMPLATE_ZONE=$(ZONE)
7bc7346c0c75ced7da727f63c2772fd53809244dcmprep build install publish: LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm.DEFAULT: publish
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmdownload prep build install publish install-packages validate: $(COMPONENT_DIRS)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmclean: $(COMPONENT_DIRS:%=%.nosetup)
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(RM) components.mk depends.mk .profile
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmclobber: $(COMPONENT_DIRS:%=%.nosetup) clean
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(RM) -r $(WS_REPO) $(WS_LOGS)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmsetup: $(WS_LOGS) repo tools .profile
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm$(WS_LOGS):
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(MKDIR) $@
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmrepo:
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(PKGSEND) -s $(PKG_REPO) create-repository \
7bc7346c0c75ced7da727f63c2772fd53809244dcm --set-property publisher.prefix=$(PUBLISHER)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmtools:
7bc7346c0c75ced7da727f63c2772fd53809244dcm @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
7bc7346c0c75ced7da727f63c2772fd53809244dcm# to pass a few things on to zone based builds
7bc7346c0c75ced7da727f63c2772fd53809244dcm.profile:
7bc7346c0c75ced7da727f63c2772fd53809244dcm echo "PATH=$(PATH)" >>$@
7bc7346c0c75ced7da727f63c2772fd53809244dcm echo "WS_TOP=$(WS_TOP)" >>$@
7bc7346c0c75ced7da727f63c2772fd53809244dcm echo "export PATH WS_TOP" >>$@
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm$(COMPONENT_DIRS): setup FORCE
7bc7346c0c75ced7da727f63c2772fd53809244dcm @cd $@ && echo "$(TARGET) $@" && \
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(@:%=--component %) --make $(TARGET) $(LOG)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm$(COMPONENT_DIRS.nosetup): FORCE
7bc7346c0c75ced7da727f63c2772fd53809244dcm @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
7bc7346c0c75ced7da727f63c2772fd53809244dcm $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcm# depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
7bc7346c0c75ced7da727f63c2772fd53809244dcmdepends.mk: components.mk
7bc7346c0c75ced7da727f63c2772fd53809244dcm @echo "Generating component dependencies..."
7bc7346c0c75ced7da727f63c2772fd53809244dcm @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
7bc7346c0c75ced7da727f63c2772fd53809244dcm | sed -e 's;$(shell pwd)/;;g' >$@
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcminclude depends.mk
7bc7346c0c75ced7da727f63c2772fd53809244dcm
7bc7346c0c75ced7da727f63c2772fd53809244dcmFORCE:
7bc7346c0c75ced7da727f63c2772fd53809244dcm