components/Makefile
author Norm Jacobs <Norm.Jacobs@Sun.COM>
Fri, 14 Jan 2011 13:12:28 -0800
changeset 58 d8024c042a00
parent 53 e398cb2c4b45
child 70 c610cf9d3d5d
permissions -rw-r--r--
7011369 gmake complains about fresh userland bits 7011699 USERLAND prefix relocation is broken 7011719 userland doesn't need to be able to build python 2.4 bits. 7011956 userland-fetch friendliness enhancements

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
#

include ../make-rules/shared-macros.mk

# for now, the assumption is we build any directory with a Makefile.  This may
# not always be the case. If we build a new make-like tool to drive the upper
# level build, it may make different decisions and will need to include
# appropriate dependency information.

# components.mk is auto-generated by the build tools.  It populates the
# COMPONENT_DIRS macro with a list of all directories in the workspace that
# contain a component.
components.mk:	# Makefile # $(WS_TOP)/components
	@echo "Generating component list..."
	@$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
		| sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@

-include components.mk


download:		TARGET = download
prep:			TARGET = prep
build:			TARGET = build
install:		TARGET = install
publish:		TARGET = publish
install-packages:	TARGET = install-packages
validate:		TARGET = validate
clean:			TARGET = clean
clobber:		TARGET = clobber
prep build install publish:		TEMPLATE_ZONE=$(ZONE)
prep build install publish:		LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1

.DEFAULT:	publish

download prep build install publish install-packages validate: $(COMPONENT_DIRS)

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) $(WS_LINT_CACHE)

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: