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