Makefile revision 38
012a352f4b26cfd874db8d06debc495c2303e8b2Bob Halley#
178f6ad061e54bc5babfca3577f72058fa0797c1Bob Halley# CDDL HEADER START
5c144477062a5df657acee41a82051d38537fd38Tinderbox User#
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# The contents of this file are subject to the terms of the
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# Common Development and Distribution License (the "License").
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# You may not use this file except in compliance with the License.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# or http://www.opensolaris.org/os/licensing.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# See the License for the specific language governing permissions
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# and limitations under the License.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
b897c52f865b2fc4e220e2110b874e59c716456bBob Halley# information: Portions Copyright [yyyy] [name of copyright owner]
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User#
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# CDDL HEADER END
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt#
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt# Copyright (c) 2010, Oracle and/or it's affiliates. All rights reserved.
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt#
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntinclude ../make-rules/shared-macros.mk
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence# for now, the assumption is we build any directory with a Makefile. This may
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# not always be the case. If we build a new make-like tool to drive the upper
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# level build, it may make different decisions and will need to include
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt# appropriate dependency information.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# components.mk is auto-generated by the build tools. It populates the
b897c52f865b2fc4e220e2110b874e59c716456bBob Halley# COMPONENT_DIRS macro with a list of all directories in the workspace that
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley# contain a component.
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halleycomponents.mk: # Makefile # $(WS_TOP)/components
c7b785510e3f517a0c98c0b6b6e6ad8f359e9e4cMark Andrews @echo "Generating component list..."
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley | sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >$@
b897c52f865b2fc4e220e2110b874e59c716456bBob Halley
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntinclude components.mk
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntdownload: TARGET = download
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntprep: TARGET = prep
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntbuild: TARGET = build
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntinstall: TARGET = install
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntpublish: TARGET = publish
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntinstall-packages: TARGET = install-packages
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntvalidate: TARGET = validate
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntclean: TARGET = clean
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntclobber: TARGET = clobber
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Huntprep build install publish: TEMPLATE_ZONE=$(ZONE)
460b427411b72da26b1836b9424e2e70d65d9394David Lawrenceprep build install publish: LOG = >$(WS_LOGS)/$@.$(TARGET).log 2>&1
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews.DEFAULT: publish
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrewsdownload prep build install publish install-packages validate: $(COMPONENT_DIRS)
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews
18483fce5b9d1e02748bdcb916014cedea654f78Mark AndrewsCOMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrewsclean: $(COMPONENT_DIRS:%=%.nosetup)
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence $(RM) components.mk depends.mk .profile
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley
12e63bfe1d111ccb57f482b28d56c785cccc7cf7David Lawrenceclobber: $(COMPONENT_DIRS:%=%.nosetup) clean
12e63bfe1d111ccb57f482b28d56c785cccc7cf7David Lawrence $(RM) -r $(WS_REPO) $(WS_LOGS)
af9dbf1ccdd53933aaae9300d13ce0965d39b067Evan Hunt
12e63bfe1d111ccb57f482b28d56c785cccc7cf7David Lawrencesetup: $(WS_LOGS) repo tools .profile
12e63bfe1d111ccb57f482b28d56c785cccc7cf7David Lawrence
dabea86dac4c01f852b7aea728f73b4f55a89d44Mark Andrews$(WS_LOGS):
dabea86dac4c01f852b7aea728f73b4f55a89d44Mark Andrews $(MKDIR) $@
dabea86dac4c01f852b7aea728f73b4f55a89d44Mark Andrews
12a3ab37fe6556406acdf92fc7c5f198d603ca2eMark Andrewsrepo:
f5cfcbf2f7906fb59c2b8b9b8fc9c7a75ac44dabMark Andrews $(PKGSEND) -s $(PKG_REPO) create-repository \
2d46d268ccff30bb50e661b47c6496d23d9156c7Mark Andrews --set-property publisher.prefix=$(PUBLISHER)
2d46d268ccff30bb50e661b47c6496d23d9156c7Mark Andrews
dabea86dac4c01f852b7aea728f73b4f55a89d44Mark Andrewstools:
0b72c791466d0807bcf22522b5ddb7da902c2720Bob Halley @cd ../tools ; echo "building tools..." ; $(GMAKE) setup
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews# to pass a few things on to zone based builds
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence.profile:
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews echo "PATH=$(PATH)" >>$@
2d9bd38ec3fbbfe920757b8972d94f664a9b354bMark Andrews echo "WS_TOP=$(WS_TOP)" >>$@
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews echo "export PATH WS_TOP" >>$@
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews$(COMPONENT_DIRS): setup FORCE
8319af16557b81eba3277ee67215285f0823b587Mark Andrews @cd $@ && echo "$(TARGET) $@" && \
8319af16557b81eba3277ee67215285f0823b587Mark Andrews $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
aee5e9cbacd8f88325840b8a498876f4319b0890Mark Andrews $(@:%=--component %) --make $(TARGET) $(LOG)
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews
9e5854255178c04170bc98839282d4cf3fae7443Mark Andrews$(COMPONENT_DIRS.nosetup): FORCE
f7a6d4f915ce622d988916397f313b33ae954afcMark Andrews @cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
f7a6d4f915ce622d988916397f313b33ae954afcMark Andrews $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence
66c9805347f24da946c17a881e489ffe2e89c25dMark Andrews# depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
66c9805347f24da946c17a881e489ffe2e89c25dMark Andrewsdepends.mk: components.mk
18483fce5b9d1e02748bdcb916014cedea654f78Mark Andrews @echo "Generating component dependencies..."
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
66c9805347f24da946c17a881e489ffe2e89c25dMark Andrews | sed -e 's;$(shell pwd)/;;g' >$@
66c9805347f24da946c17a881e489ffe2e89c25dMark Andrews
12e63bfe1d111ccb57f482b28d56c785cccc7cf7David Lawrenceinclude depends.mk
c32b87bc54abacf95fb3b063d72b7d1855c1643bMichael Graff
7f9f8c13c5e5e26e0ba2b82c0900d11ecf6269ceMark AndrewsFORCE:
460b427411b72da26b1836b9424e2e70d65d9394David Lawrence