Makefile revision 3701
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER START
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# The contents of this file are subject to the terms of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Common Development and Distribution License (the "License").
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# You may not use this file except in compliance with the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# or http://www.opensolaris.org/os/licensing.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# See the License for the specific language governing permissions
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# and limitations under the License.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# When distributing Covered Code, include this CDDL HEADER in each
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4eTheo Schlossnagle# If applicable, add the following below this CDDL HEADER, with the
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# fields enclosed by brackets "[]" replaced with your own identifying
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# information: Portions Copyright [yyyy] [name of copyright owner]
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER END
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov#
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinclude ../make-rules/shared-macros.mk
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# for now, the assumption is we build any directory with a Makefile. This may
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# not always be the case. If we build a new make-like tool to drive the upper
b9476f453004695da12eaaff383ed9005e7a47c4Joshua M. Clulow# level build, it may make different decisions and will need to include
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# appropriate dependency information.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# components.mk is auto-generated by the build tools. It populates the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# COMPONENT_DIRS macro with a list of all directories in the workspace that
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# contain a component.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecomponents.mk: # Makefile # $(WS_TOP)/components
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @echo "Generating component list..."
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe-include components.mk
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# depends.mk is auto-generated by concatenating 'depend.mk' files in each
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# component directory.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedepends.mk: components.mk
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @echo "Generating component dependencies..."
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @cat $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe | sed -e 's;^$(shell pwd)/;;g' -e 's;$$;/depend.mk;g') >$@ \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe 2>/dev/null
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe-include depends.mk
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedownload: TARGET = download
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweprep: TARGET = prep
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowebuild: TARGET = build
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchiinstall: TARGET = install
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowepublish: TARGET = publish
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclean: TARGET = clean
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclobber: TARGET = clobber
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowetest: TARGET = test
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecomponent-hook: TARGET = component-hook
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovprep build install publish test: TEMPLATE_ZONE=$(ZONE)
5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4eTheo Schlossnagleprep build install publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# turn off pkglint for the individual component builds.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweifeq ($(strip $(PKGLINT_COMPONENT)),)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowepublish: MAKEFLAGS += PKGLINT=/bin/true
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweendif
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# In order to work around an IPS simultaneous publication issue and to improve
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# top level build performance, we postpone catalog and index updates until the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# end of the build. Individual component builds postpone the updates until
b9476f453004695da12eaaff383ed9005e7a47c4Joshua M. Clulow# they have published all of their packages.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowepublish: MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# For cases in which a component test should be skipped at at the top level
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowetest: MAKEFLAGS += TOP_LEVEL_TEST=yes
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe.DEFAULT: publish
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowebuild install publish test: $(COMPONENT_DIRS)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowedownload prep: $(COMPONENT_DIRS.nosetup)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowecomponent-hook: $(COMPONENT_DIRS.nosetup)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclean: $(COMPONENT_DIRS.nosetup)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(RM) components.mk depends.mk .profile
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweclobber: $(COMPONENT_DIRS.nosetup) clean
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @cd ../tools ; echo "clobbering tools..." ; $(GMAKE) clobber
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowesetup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(WS_LOGS):
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MKDIR) $@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(WS_REPO):
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(PKGREPO) create $(PKG_REPO)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDUMMYPKG += "set pkg.summary=dummy\n"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDUMMYPKG += "set org.opensolaris.consolidation=userland\n"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard LoweDUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(WS_LINT_CACHE): $(WS_LOGS) tools
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweifdef CANONICAL_REPO
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @(echo $(DUMMYPKG) | $(PKGLINT) \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 || \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ( echo "pkglint(1) failed, please see $(WS_LOGS)/naughty-canonical-repo-actions"; \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe exit 1 ) \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe )
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweelse
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(MKDIR) $(WS_LINT_CACHE)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweendif
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowetools:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @cd ../tools ; echo "building tools..." ; $(GMAKE) clean setup
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# to pass a few things on to zone based builds
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe.profile:
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe echo "PATH=$(PATH)" >>$@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe echo "WS_TOP=$(WS_TOP)" >>$@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe echo "export PATH WS_TOP" >>$@
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe$(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe @cd $@ && echo "$(TARGET) $@" && \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe $(@:%=--component %) --make $(TARGET) $(LOG)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Turn userland-incorporator warnings into build failures
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert MustacchiINCORPORATE_WERROR ?= --Werror
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchi
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchiincorporation:
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchi $(PKGREPO) refresh -s $(PKG_REPO)
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchi $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchi --version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
177d5b5f8c0e969013441207a0a705ae66b08cf7Robert Mustacchi -c $(CONSOLIDATION) --destdir=$(WS_LOGS) $(INCORPORATE_WERROR)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe for incorporation in $(WS_LOGS)/*.p5m ; do \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $${incorporation} ; \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov done
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovpublish:
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $(MAKE) incorporation
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# pkglint all of the published manifests in one batch.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovifdef CANONICAL_REPO
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov @echo 'pkglinting all package manifests...'
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov @$(ENV) PYTHONPATH=$(WS_TOOLS)/python \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov SOLARIS_VERSION=$(SOLARIS_VERSION) \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $(PKGLINT) \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $(shell find . -name 'manifest-*.published')
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankovendif
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov$(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
b9476f453004695da12eaaff383ed9005e7a47c4Joshua M. Clulow $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
b9476f453004695da12eaaff383ed9005e7a47c4Joshua M. Clulow
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri PankovFORCE:
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov