Makefile revision 58
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews#
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# CDDL HEADER START
04428429c4e689333e3ef8d19a2debeb20d4d15dMark Andrews#
e999539fb3e45b2617571e0e3ecd651992291701Mark Andrews# The contents of this file are subject to the terms of the
e999539fb3e45b2617571e0e3ecd651992291701Mark Andrews# Common Development and Distribution License (the "License").
2a40fdc2d34adb8a5c72a748449699666032d461Mark Andrews# You may not use this file except in compliance with the License.
555d01f4c02295e896a26c649d0ffc8808a0bbdcAutomatic Updater#
a3b428812703d22a605a9f882e71ed65f0ffdc65Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# or http://www.opensolaris.org/os/licensing.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# See the License for the specific language governing permissions
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews# and limitations under the License.
068a66979695c77359e7a9181bb3f831c965b21cMark Andrews#
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# When distributing Covered Code, include this CDDL HEADER in each
d56e188030368b835122d759ebbf8d9613c166f4Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews# If applicable, add the following below this CDDL HEADER, with the
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c718d15a9a95054ee3c71540c02335426071fc6dMark Andrews#
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews# CDDL HEADER END
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
04eba969cb9a54bbda2896db2067c07b2ac5ba16Automatic Updater#
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsinclude ../make-rules/shared-macros.mk
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews# for now, the assumption is we build any directory with a Makefile. This may
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# not always be the case. If we build a new make-like tool to drive the upper
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# level build, it may make different decisions and will need to include
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# appropriate dependency information.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# components.mk is auto-generated by the build tools. It populates the
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# COMPONENT_DIRS macro with a list of all directories in the workspace that
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington# contain a component.
a3b428812703d22a605a9f882e71ed65f0ffdc65Mark Andrewscomponents.mk: # Makefile # $(WS_TOP)/components
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews @echo "Generating component list..."
bac1bc98410bd876b8d38a6de6126709a7f8cc5aAutomatic Updater @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
f8448666aa53603696bea83de971a05007735d8fMark Andrews-include components.mk
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
3098364bcdd7a719fbafa5fc8d2cc9e90e5a5989Automatic Updater
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrewsdownload: TARGET = download
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsprep: TARGET = prep
3098364bcdd7a719fbafa5fc8d2cc9e90e5a5989Automatic Updaterbuild: TARGET = build
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsinstall: TARGET = install
3a6600c8d319275d73c36eb625f77103cd83e824Automatic Updaterpublish: TARGET = publish
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrewsinstall-packages: TARGET = install-packages
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsvalidate: TARGET = validate
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrewsclean: TARGET = clean
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssonclobber: TARGET = clobber
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrewsprep build install publish: TEMPLATE_ZONE=$(ZONE)
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrewsprep build install publish: LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews.DEFAULT: publish
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrewsdownload prep build install publish install-packages validate: $(COMPONENT_DIRS)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
91216cff91b34c9ff6e846dc23f248219cafe660Andreas GustafssonCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtonclean: $(COMPONENT_DIRS:%=%.nosetup)
26a77b80bb7ee886c6fa704348d5e80a011d8811Mark Andrews $(RM) components.mk depends.mk .profile
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
6f046a065e5543f8cd7e2f24991c65d2372f4c8dMark Andrewsclobber: $(COMPONENT_DIRS:%=%.nosetup) clean
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewssetup: $(WS_LOGS) repo tools .profile
62ee2c9f460d2e2e45dcf1abc8b4b4a4a43f5618Mark Andrews
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews$(WS_LOGS):
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews $(MKDIR) $@
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
068a66979695c77359e7a9181bb3f831c965b21cMark Andrewsrepo:
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews $(PKGSEND) -s $(PKG_REPO) create-repository \
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews --set-property publisher.prefix=$(PUBLISHER)
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafssontools:
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews# to pass a few things on to zone based builds
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson.profile:
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews echo "PATH=$(PATH)" >>$@
96ea71632887c58a9d00f47eb318bf76b35903c3Mark Andrews echo "WS_TOP=$(WS_TOP)" >>$@
dde4bc92964ec60a35212dfed59562580e3265e3Mark Andrews echo "export PATH WS_TOP" >>$@
80f9a970ae6681c08529ef209eaabbe078c27ca3Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews$(COMPONENT_DIRS): setup FORCE
dde4bc92964ec60a35212dfed59562580e3265e3Mark Andrews @cd $@ && echo "$(TARGET) $@" && \
04eba969cb9a54bbda2896db2067c07b2ac5ba16Automatic Updater $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
3098364bcdd7a719fbafa5fc8d2cc9e90e5a5989Automatic Updater $(@:%=--component %) --make $(TARGET) $(LOG)
dde4bc92964ec60a35212dfed59562580e3265e3Mark Andrews
45eca3a5d46ed15aee14d81f6cb6c9fb6f365344Mark Andrews$(COMPONENT_DIRS.nosetup): FORCE
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
04eba969cb9a54bbda2896db2067c07b2ac5ba16Automatic Updater $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
605bd686e437162b5ab65ac4e7c1be0bba1886ddMark Andrews $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews# depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
413988c8166976498250c0ebb2e3a645d0366bd3Mark Andrewsdepends.mk: components.mk
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews @echo "Generating component dependencies..."
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews | sed -e 's;$(shell pwd)/;;g' >$@
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews-include depends.mk
6b5c57e52ac8c3e0af1547be3140ebbfb41a85b3Mark Andrews
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark AndrewsFORCE:
a9789e288ee11ae4315e27235c33bae5405bd7c4Mark Andrews