bzip2: change to new library paths
[unleashed-userland.git] / components / Makefile
bloba474ad61f0be72c020e83db1a1c9a0dfc2401f99
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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 COMPONENT_LIST?= components.mk
32 -include $(WS_TOP)/$(COMPONENT_LIST)
34 # depends.mk is auto-generated by concatenating 'depend.mk' files in each
35 # component directory.
36 $(WS_TOP)/components/depends.mk: $(WS_TOP)/$(COMPONENT_LIST)
37 @echo "Generating component dependencies..."
38 @cat /dev/null $(shell $(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
39 | sed -e 's;^$(shell pwd)/;;g' \
40 | sed -f components.ignore \
41 | sed -e 's;$$;/depend.mk;g') >$@ \
42 2>/dev/null
44 -include $(WS_TOP)/components/depends.mk
47 download: TARGET = download
48 prep: TARGET = prep
49 build: TARGET = build
50 install: TARGET = install
51 pre-publish: TARGET = pre-publish
52 publish: TARGET = publish
53 clean: TARGET = clean
54 clobber: TARGET = clobber
55 test: TARGET = test
56 component-hook: TARGET = component-hook
57 prep build install pre-publish publish test: TEMPLATE_ZONE=$(ZONE)
58 prep build install pre-publish publish test: LOG = >$(WS_LOGS)/$(@F).$(TARGET).log 2>&1
60 # turn off pkglint for the individual component builds.
61 ifeq ($(strip $(PKGLINT_COMPONENT)),)
62 publish: MAKEFLAGS += PKGLINT=/bin/true
63 endif
65 .DEFAULT: publish
67 build install pre-publish publish test: $(COMPONENT_DIRS)
69 COMPONENT_DIRS.nosetup = $(COMPONENT_DIRS:%=%.nosetup)
71 download prep: $(COMPONENT_DIRS.nosetup)
73 component-hook: $(COMPONENT_DIRS.nosetup)
75 clean: $(COMPONENT_DIRS.nosetup)
76 $(RM) $(WS_TOP)/components/depends.mk .profile
78 clobber: $(COMPONENT_DIRS.nosetup) clean
79 @cd $(WS_TOP)/tools ; echo "clobbering tools..." ; $(GMAKE) clobber
80 $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE)
83 setup: $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
85 $(WS_LOGS):
86 $(MKDIR) $@
88 $(WS_REPO):
89 $(PKGREPO) create $(PKG_REPO)
90 $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
91 $(PKGREPO) rebuild -s $(PKG_REPO)
92 # Not required for OI
93 # $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
95 DUMMYPKG = "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
96 DUMMYPKG += "set pkg.summary=dummy\n"
97 DUMMYPKG += "set org.opensolaris.consolidation=userland\n"
98 DUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
100 $(WS_LINT_CACHE): $(WS_LOGS) tools
101 ifdef CANONICAL_REPO
102 @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
103 @(echo $(DUMMYPKG) | $(PKGLINT) \
104 -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
105 >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
106 else
107 $(MKDIR) $(WS_LINT_CACHE)
108 endif
110 tools:
111 @cd $(WS_TOP)/tools ; echo "building tools..." ; $(GMAKE) clean setup
113 # $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
114 # to pass a few things on to zone based builds
115 .profile:
116 echo "PATH=$(PATH)" >>$@
117 echo "WS_TOP=$(WS_TOP)" >>$@
118 echo "export PATH WS_TOP" >>$@
120 $(COMPONENT_DIRS): $(WS_LOGS) setup FORCE
121 @+cd $@ && echo "$(TARGET) $@" && \
122 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
123 $(@:%=--component %) --make $(TARGET) $(LOG)
125 incorporation:
126 $(eval COMPONENT_REVISION := $(shell git rev-list HEAD --count))
127 $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
128 --version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
129 -c $(CONSOLIDATION) --destdir=$(WS_MACH) $(INCORPORATE_WERROR)
130 for incorporation in $(WS_MACH)/*.p5m ; do \
131 $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
132 $${incorporation} ; \
133 done
136 publish:
137 $(PKGREPO) refresh -s $(PKG_REPO)
138 ifdef CANONICAL_REPO
139 @echo 'pkglinting all package manifests...'
140 @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
141 -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
142 $(shell find . -name 'manifest-*.published')
143 endif
145 $(COMPONENT_DIRS.nosetup): $(WS_LOGS) FORCE
146 @+cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
147 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
148 $(@:%.nosetup=--component %) --make $(TARGET) $(LOG)
150 FORCE: