components/Makefile
author Norm Jacobs <Norm.Jacobs@Sun.COM>
Fri, 15 Oct 2010 16:15:38 -0500
changeset 38 cd00ea74156e
parent 34 d20b10eba317
child 53 e398cb2c4b45
permissions -rw-r--r--
package audits should pass pkglint incrementals should work better
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     1
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     2
# CDDL HEADER START
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     3
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     4
# The contents of this file are subject to the terms of the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     5
# Common Development and Distribution License (the "License").
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     6
# You may not use this file except in compliance with the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     7
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     8
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
     9
# or http://www.opensolaris.org/os/licensing.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    10
# See the License for the specific language governing permissions
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    11
# and limitations under the License.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    12
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    13
# When distributing Covered Code, include this CDDL HEADER in each
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    14
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    15
# If applicable, add the following below this CDDL HEADER, with the
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    16
# fields enclosed by brackets "[]" replaced with your own identifying
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    17
# information: Portions Copyright [yyyy] [name of copyright owner]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    18
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    19
# CDDL HEADER END
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    20
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    21
# Copyright (c) 2010, Oracle and/or it's affiliates.  All rights reserved.
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    22
#
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    23
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    24
include ../make-rules/shared-macros.mk
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    25
23
e7ed56b7c498 autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 21
diff changeset
    26
# for now, the assumption is we build any directory with a Makefile.  This may
e7ed56b7c498 autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 21
diff changeset
    27
# not always be the case. If we build a new make-like tool to drive the upper
e7ed56b7c498 autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 21
diff changeset
    28
# level build, it may make different decisions and will need to include
e7ed56b7c498 autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 21
diff changeset
    29
# appropriate dependency information.
e7ed56b7c498 autogenerate components to build
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 21
diff changeset
    30
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    31
# components.mk is auto-generated by the build tools.  It populates the
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    32
# COMPONENT_DIRS macro with a list of all directories in the workspace that
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    33
# contain a component.
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    34
components.mk:	# Makefile # $(WS_TOP)/components
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    35
	@echo "Generating component list..."
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    36
	@$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    37
		| sed -e 's;^$(shell pwd)/;COMPONENT_DIRS += ;g' >[email protected]
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    38
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    39
include components.mk
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    40
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    41
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    42
download:		TARGET = download
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    43
prep:			TARGET = prep
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    44
build:			TARGET = build
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    45
install:		TARGET = install
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    46
publish:		TARGET = publish
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    47
install-packages:	TARGET = install-packages
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    48
validate:		TARGET = validate
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    49
clean:			TARGET = clean
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    50
clobber:		TARGET = clobber
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    51
prep build install publish:		TEMPLATE_ZONE=$(ZONE)
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    52
prep build install publish:		LOG = >$(WS_LOGS)/[email protected]$(TARGET).log 2>&1
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    53
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    54
.DEFAULT:	publish
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    55
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    56
download prep build install publish install-packages validate: $(COMPONENT_DIRS)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    57
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    58
COMPONENT_DIRS.nosetup =	$(COMPONENT_DIRS:%=%.nosetup)
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    59
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    60
clean:	$(COMPONENT_DIRS:%=%.nosetup)
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    61
	$(RM) components.mk depends.mk .profile
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    62
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    63
clobber:	$(COMPONENT_DIRS:%=%.nosetup) clean
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    64
	$(RM) -r $(WS_REPO) $(WS_LOGS)
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    65
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    66
setup:	$(WS_LOGS) repo tools .profile
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    67
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    68
$(WS_LOGS):
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    69
	$(MKDIR) [email protected]
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    70
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    71
repo:
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    72
	$(PKGSEND) -s $(PKG_REPO) create-repository \
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    73
		--set-property publisher.prefix=$(PUBLISHER)
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
    74
6
20f80c019d73 add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    75
tools:
20f80c019d73 add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    76
	@cd ../tools ; echo "building tools..." ; $(GMAKE) setup
20f80c019d73 add compiler date/time chatter reduction tools
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 2
diff changeset
    77
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    78
# $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    79
# to pass a few things on to zone based builds
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    80
.profile:
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    81
	echo "PATH=$(PATH)" >>[email protected]
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    82
	echo "WS_TOP=$(WS_TOP)" >>[email protected]
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    83
	echo "export PATH WS_TOP" >>[email protected]
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    84
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    85
$(COMPONENT_DIRS):	setup FORCE
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    86
	@cd [email protected] && echo "$(TARGET) [email protected]" && \
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    87
	 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    88
			 $(@:%=--component %) --make $(TARGET) $(LOG)
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    89
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    90
$(COMPONENT_DIRS.nosetup):	FORCE
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    91
	@cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    92
	 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
38
cd00ea74156e package audits should pass pkglint
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 34
diff changeset
    93
			 $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    94
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    95
# depends.mk is auto-generated by the build tools, bass-o-matic.py in particular
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    96
depends.mk:	components.mk
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    97
	@echo "Generating component dependencies..."
34
d20b10eba317 prepare for zone based component builds
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 32
diff changeset
    98
	@$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=depend \
32
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
    99
		| sed -e 's;$(shell pwd)/;;g' >[email protected]
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
   100
280a7444e782 automatically generate intercomponent dependencies for build ordering
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents: 23
diff changeset
   101
include depends.mk
2
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   102
125cd5d2cd9e include gmake example
Norm Jacobs <Norm.Jacobs@Sun.COM>
parents:
diff changeset
   103
FORCE: