Makefile revision 1244
2247N/A#
2247N/A# CDDL HEADER START
2247N/A#
2247N/A# The contents of this file are subject to the terms of the
2247N/A# Common Development and Distribution License (the "License").
2247N/A# You may not use this file except in compliance with the License.
2247N/A#
2247N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2247N/A# or http://www.opensolaris.org/os/licensing.
2247N/A# See the License for the specific language governing permissions
2247N/A# and limitations under the License.
2247N/A#
2247N/A# When distributing Covered Code, include this CDDL HEADER in each
2247N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2247N/A# If applicable, add the following below this CDDL HEADER, with the
2247N/A# fields enclosed by brackets "[]" replaced with your own identifying
2247N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2247N/A#
2247N/A# CDDL HEADER END
2247N/A#
3817N/A# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
2247N/A#
2247N/A
2247N/Ainclude ../make-rules/shared-macros.mk
2247N/A
5023N/A# for now, the assumption is we build any directory with a Makefile. This may
2276N/A# not always be the case. If we build a new make-like tool to drive the upper
2276N/A# level build, it may make different decisions and will need to include
2276N/A# appropriate dependency information.
2276N/A
2276N/A# components.mk is auto-generated by the build tools. It populates the
2276N/A# COMPONENT_DIRS macro with a list of all directories in the workspace that
5023N/A# contain a component.
2276N/Acomponents.mk: # Makefile # $(WS_TOP)/components
2276N/A @echo "Generating component list..."
2247N/A @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
5023N/A | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
2247N/A
2247N/A-include components.mk
2247N/A
5023N/A# depends.mk is auto-generated by concatenating 'depend.mk' files in each
3574N/A# component directory.
2899N/Adepends.mk: components.mk
3817N/A @echo "Generating component dependencies..."
3817N/A @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
3817N/A | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
2247N/A 2>/dev/null
2247N/A
2247N/A-include depends.mk
2247N/A
3930N/A
3930N/Adownload: TARGET = download
3142N/Aprep: TARGET = prep
3142N/Abuild: TARGET = build
3142N/Ainstall: TARGET = install
3142N/Apublish: TARGET = publish
3142N/Aclean: TARGET = clean
3142N/Aclobber: TARGET = clobber
3142N/Atest: TARGET = test
3142N/Acomponent-hook: TARGET = component-hook
4076N/Aprep build install publish test: TEMPLATE_ZONE=$(ZONE)
4742N/Aprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
5024N/A
3142N/A# turn off pkglint for the individual component builds.
3142N/Aifeq ($(strip $(PKGLINT_COMPONENT)),)
2247N/Apublish: MAKEFLAGS += PKGLINT=/bin/true
2247N/Aendif
2247N/A
2247N/A.DEFAULT: publish
2247N/A
3431N/Abuild install publish test: $(COMPONENT_DIRS)
3431N/A
3431N/ACOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
3431N/A
3431N/Adownload prep: $(COMPONENT_DIRS.nosetup)
3431N/A
2247N/Acomponent-hook: $(COMPONENT_DIRS.nosetup)
3513N/A
2247N/Aclean: $(COMPONENT_DIRS.nosetup)
2247N/A $(RM) components.mk depends.mk .profile
2247N/A
2247N/Aclobber: $(COMPONENT_DIRS.nosetup) clean
2247N/A @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
2247N/A $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
2247N/A
4707N/A
2247N/Asetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
2588N/A
2247N/A$(WS_LOGS):
2247N/A $(MKDIR) $@
2247N/A
3520N/A$(WS_REPO):
3260N/A $(PKGREPO) create $(PKG_REPO)
2247N/A $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
2738N/A $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
2738N/A
2738N/ADUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
2738N/ADUMMYPKG += "set pkg.summary=dummy\n"
2738N/ADUMMYPKG += "set org.opensolaris.consolidation=userland\n"
2738N/ADUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
3513N/A
3513N/A$(WS_LINT_CACHE): $(WS_LOGS)
3513N/Aifdef CANONICAL_REPO
2247N/A @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
3477N/A @(echo $(DUMMYPKG) | $(PKGLINT) \
3477N/A -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
3431N/A >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
2247N/Aelse
3431N/A $(MKDIR) $(WS_LINT_CACHE)
2247N/Aendif
2247N/A
2247N/Atools:
2247N/A @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
2247N/A
4337N/A# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
4337N/A# to pass a few things on to zone based builds
2247N/A.profile:
3817N/A echo "PATH=$(PATH)" >>$@
3817N/A echo "WS_TOP=$(WS_TOP)" >>$@
3817N/A echo "export PATH WS_TOP" >>$@
3817N/A
3817N/A$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
3930N/A @cd $@ && echo "$(TARGET) $@" && \
3817N/A $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
3817N/A $(@:%=--component %) --make $(TARGET) $(LOG)
4941N/A
publish:
$(PKGREPO) rebuild -s $(PKG_REPO)
$(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
-p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
-s "$(CONSOLIDATION) consolidation incorporation" \
-d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
-c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
# pkglint all of the published manifests in one batch.
ifdef CANONICAL_REPO
@echo 'pkglinting all package manifests...'
@$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
-c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
$(shell find . -name 'manifest-*.published')
endif
$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
@cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
$(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
$(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
FORCE: