4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
24 -include ..
/make-rules
/shared-macros.mk
26 # for now, the assumption is we build any directory with a Makefile. This may
27 # not always be the case. If we build a new make-like tool to drive the upper
28 # level build, it may make different decisions and will need to include
29 # appropriate dependency information.
31 # components.mk is auto-generated by the build tools. It populates the
32 # COMPONENT_DIRS macro with a list of all directories in the workspace that
33 # contain a component.
34 COMPONENTS_IGNORE
= components.ignore
35 $(WS_TOP
)/components
/$(ENCUMBERED
)components.mk
: # Makefile # $(WS_TOP)/components
36 @echo
"Generating component list..."
37 @
$(BASS_O_MATIC
) --workspace
=$(WS_TOP
) --components
=paths \
38 | sed
-e
's;^$(shell pwd)/;;' \
39 | sed
-f
$(COMPONENTS_IGNORE
) \
40 | sed
-e
's;^;COMPONENT_DIRS += ;g' >$@
42 -include $(WS_TOP
)/components
/$(ENCUMBERED
)components.mk
44 # mapping.json is auto-generated by the build tools. It provides a map
45 # between component path and component FMRI.
46 $(WS_TOP
)/components
/mapping.json
:
47 @echo
"Generating component mapping..."
48 $(WS_TOOLS
)/userland-mapping
--workspace
=$(WS_TOP
) \
50 --repo-map
=encumbered
/=$(PUBLISHER
)-encumbered
51 mapping.json
: $(WS_TOP
)/components
/mapping.json
53 # dependencies.json is auto-generate by the build tools. It provides information
54 # about component dependencies.
55 $(WS_TOP
)/components
/dependencies.json
: mapping.json
56 @echo
"Generating component dependency list..."
57 @
$(BASS_O_MATIC
) --workspace
=$(WS_TOP
) --components
=dependencies
>$@
58 dependencies.json
: $(WS_TOP
)/components
/dependencies.json
60 rebuild-dependents
: dependencies.json
61 @echo
"Bumping COMPONENT_REVISION for dependents of $(FMRI)"
62 @
$(WS_TOOLS
)/userland-bump
-v
--rebuild-dependents
--fmri
$(FMRI
)
64 print-dependents
: dependencies.json
65 @
$(WS_TOOLS
)/userland-bump
-v
--rebuild-dependents
--dry-run
--fmri
$(FMRI
)
68 @
$(RM
) $(WS_TOP
)/components
/$(ENCUMBERED
)components.mk
&& \
69 ( env BASS_O_MATIC_MODE
=incremental \
70 GIT_PREVIOUS_SUCCESSFUL_COMMIT
=origin/oi
/hipster \
74 download
: TARGET
= download
75 update-metadata
: TARGET
= update-metadata
78 install: TARGET
= install
79 pre-publish
: TARGET
= pre-publish
80 publish
: TARGET
= publish
82 clobber: TARGET
= clobber
84 zone-build
: TARGET
= component-zone-build
85 zone-cleanup
: TARGET
= component-zone-cleanup
86 component-hook
: TARGET
= component-hook
87 zone-build zone-cleanup prep build
install pre-publish publish
test: LOG
= >$(WS_LOGS
)/$(subst /,.
,$@
).
$(TARGET
).log
2>&1
89 # turn off pkglint for the individual component builds.
90 ifeq ($(strip $(PKGLINT_COMPONENT
)),)
91 publish
: MAKEFLAGS
+= PKGLINT
=/bin
/true
96 zone-build zone-cleanup build
install pre-publish publish
test: $(COMPONENT_DIRS
)
98 COMPONENT_DIRS.nosetup
= $(COMPONENT_DIRS
:%=%.nosetup
)
99 COMPONENT_DIRS.nolog
= $(COMPONENT_DIRS
:%=%.nolog
)
101 download prep
: $(COMPONENT_DIRS.nosetup
)
103 update-metadata
: $(COMPONENT_DIRS.nolog
)
105 component-hook
: $(COMPONENT_DIRS.nosetup
)
107 clean: $(COMPONENT_DIRS.nosetup
)
108 $(RM
) $(WS_TOP
)/components
/$(ENCUMBERED
)components.mk \
109 $(WS_TOP
)/components
/mapping.json \
112 clobber: $(COMPONENT_DIRS.nosetup
) clean
113 @cd
$(WS_TOP
)/tools
; echo
"clobbering tools..." ; $(GMAKE
) clobber
114 $(RM
) -r
$(WS_REPO
) $(WS_LOGS
) $(WS_LINT_CACHE
) $(WS_MACH
)/perl-meta-deps-cache
117 setup
: install_build_essential
$(WS_LOGS
) $(WS_REPO
) tools
$(WS_LINT_CACHE
)
119 install_build_essential
:
120 @
/usr
/bin
/pkg list
-vH build-essential
> /dev
/null || \
121 $(PFEXEC
) /usr
/bin
/pkg
install --accept build-essential
127 $(PKGREPO
) create
$(PKG_REPO
)
128 $(PKGREPO
) add-publisher
-s
$(PKG_REPO
) $(PUBLISHER
)
129 $(PKGREPO
) rebuild
-s
$(PKG_REPO
)
130 # Not required for OI
131 # $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
133 DUMMYPKG
= "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
134 DUMMYPKG
+= "set pkg.summary=dummy\n"
135 DUMMYPKG
+= "set org.opensolaris.consolidation=userland\n"
136 DUMMYPKG
+= "set info.classification=org.opensolaris.category.2008:System/Core"
138 $(WS_LINT_CACHE
): $(WS_LOGS
) tools
140 @echo
"Generating pkglint(1) cache from $(CANONICAL_REPO)..."
141 @
(echo
$(DUMMYPKG
) |
$(PKGLINT
) \
142 -c
$(WS_LINT_CACHE
) -r
$(CANONICAL_REPO
) /dev
/fd
/0 \
143 >$(WS_LOGS
)/naughty-canonical-repo-actions
2>&1 ; exit
0)
145 $(MKDIR
) $(WS_LINT_CACHE
)
149 @cd
$(WS_TOP
)/tools
; echo
"building tools..." ; $(GMAKE
) clean setup
151 # $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
152 # to pass a few things on to zone based builds
154 echo
"PATH=$(PATH)" >>$@
155 echo
"WS_TOP=$(WS_TOP)" >>$@
156 echo
"export PATH WS_TOP" >>$@
158 $(COMPONENT_DIRS
): $(WS_LOGS
) setup FORCE
159 @
+cd
$@
&& echo
"$(TARGET) $@" && \
160 $(BASS_O_MATIC
) --make
$(TARGET
) $(LOG
)
163 $(eval COMPONENT_REVISION
:= $(shell git rev-list HEAD
--count
))
164 $(WS_TOOLS
)/userland-incorporator
--repository
$(PKG_REPO
) \
165 --version
=0.
$(OS_VERSION
),$(BUILD_VERSION
) -p
$(PUBLISHER
) \
166 -c
$(CONSOLIDATION
) --destdir
=$(WS_MACH
) $(INCORPORATE_WERROR
)
167 for incorporation in
$(WS_MACH
)/*.p5m
; do \
168 $(PKGSEND
) -s
$(PKG_REPO
) publish
--fmri-in-manifest \
169 $${incorporation} ; \
174 $(PKGREPO
) refresh
-s
$(PKG_REPO
)
176 @echo
'pkglinting all package manifests...'
177 @
$(ENV
) PYTHONPATH
=$(WS_TOOLS
)/python
$(PKGLINT
) \
178 -c
$(WS_LINT_CACHE
) -f
$(WS_TOOLS
)/pkglintrc \
179 $(shell find .
-name
'manifest-*.published')
182 $(COMPONENT_DIRS.nosetup
): $(WS_LOGS
) FORCE
183 @
+cd
$(@
:%.nosetup
=%) && echo
"$(TARGET) $(@:%.nosetup=%)" && \
184 $(BASS_O_MATIC
) --make
$(TARGET
) $(LOG
)
187 $(COMPONENT_DIRS.nolog
):
188 @
$(MAKE
) -s
-C
$(@
:%.nolog
=%) $(TARGET
)