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