Makefile revision 2238
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User# CDDL HEADER START
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# The contents of this file are subject to the terms of the
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# Common Development and Distribution License (the "License").
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# You may not use this file except in compliance with the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# or http://www.opensolaris.org/os/licensing.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# See the License for the specific language governing permissions
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# and limitations under the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# CDDL HEADER END
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsinclude ../make-rules/shared-macros.mk
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updater
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# for now, the assumption is we build any directory with a Makefile. This may
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# not always be the case. If we build a new make-like tool to drive the upper
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# level build, it may make different decisions and will need to include
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# appropriate dependency information.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# components.mk is auto-generated by the build tools. It populates the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# COMPONENT_DIRS macro with a list of all directories in the workspace that
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# contain a component.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewscomponents.mk: # Makefile # $(WS_TOP)/components
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updater @echo "Generating component list..."
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updater @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews-include components.mk
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# depends.mk is auto-generated by concatenating 'depend.mk' files in each
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# component directory.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdepends.mk: components.mk
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews @echo "Generating component dependencies..."
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User 2>/dev/null
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User-include depends.mk
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userdownload: TARGET = download
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userprep: TARGET = prep
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsbuild: TARGET = build
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntinstall: TARGET = install
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspublish: TARGET = publish
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclean: TARGET = clean
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntclobber: TARGET = clobber
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunttest: TARGET = test
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewscomponent-hook: TARGET = component-hook
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntprep build install publish test: TEMPLATE_ZONE=$(ZONE)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# turn off pkglint for the individual component builds.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsifeq ($(strip $(PKGLINT_COMPONENT)),)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userpublish: MAKEFLAGS += PKGLINT=/bin/true
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userendif
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# In order to work around an IPS simultaneous publication issue and to improve
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# top level build performance, we postpone catalog and index updates until the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# end of the build. Individual component builds postpone the updates until
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# they have published all of their packages.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntpublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews.DEFAULT: publish
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsbuild install publish test: $(COMPONENT_DIRS)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan HuntCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsdownload prep: $(COMPONENT_DIRS.nosetup)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntcomponent-hook: $(COMPONENT_DIRS.nosetup)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsclean: $(COMPONENT_DIRS.nosetup)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(RM) components.mk depends.mk .profile
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntclobber: $(COMPONENT_DIRS.nosetup) clean
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewssetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews$(WS_LOGS):
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $(MKDIR) $@
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt$(WS_REPO):
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(PKGREPO) create $(PKG_REPO)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsDUMMYPKG += "set pkg.summary=dummy\n"
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox UserDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox UserDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User$(WS_LINT_CACHE): $(WS_LOGS) tools
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Userifdef CANONICAL_REPO
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @(echo $(DUMMYPKG) | $(PKGLINT) \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewselse
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User $(MKDIR) $(WS_LINT_CACHE)
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Userendif
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewstools:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# to pass a few things on to zone based builds
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews.profile:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User echo "PATH=$(PATH)" >>$@
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews echo "WS_TOP=$(WS_TOP)" >>$@
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt echo "export PATH WS_TOP" >>$@
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @cd $@ && echo "$(TARGET) $@" && \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(@:%=--component %) --make $(TARGET) $(LOG)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userincorporation:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(PKGREPO) refresh -s $(PKG_REPO)
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt -s "$(CONSOLIDATION) consolidation incorporation" \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews -d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewspublish:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(MAKE) incorporation
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# pkglint all of the published manifests in one batch.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsifdef CANONICAL_REPO
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews @echo 'pkglinting all package manifests...'
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(shell find . -name 'manifest-*.published')
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsendif
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsFORCE:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User