fritzkink
2023-11-26 eeabfce3c9fe4c74eb998416bfad5c4e6bf10611
commit | author | age
9c75c0 1 #
NJ 2 # CDDL HEADER START
3 #
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.
7 #
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.
12 #
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]
18 #
19 # CDDL HEADER END
20 #
7bf47e 21 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
9c75c0 22 #
NJ 23
6185b3 24 -include ../make-rules/shared-macros.mk
9c75c0 25
5ea840 26 # for now, the assumption is we build any directory with a Makefile.  This may
NJ 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.
30
a325d4 31 # components.mk is auto-generated by the build tools.  It populates the
NJ 32 # COMPONENT_DIRS macro with a list of all directories in the workspace that
33 # contain a component.
8de8f7 34 $(WS_TOP)/components/$(ENCUMBERED)components.mk:    # Makefile # $(WS_TOP)/components
a325d4 35     @echo "Generating component list..."
79b849 36     @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=paths \
499a59 37         | sed -e 's;^$(shell pwd)/;;' \
AS 38         | sed -f components.ignore \
39         | sed -e 's;^;COMPONENT_DIRS += ;g' >$@
a325d4 40
6185b3 41 -include $(WS_TOP)/components/$(ENCUMBERED)components.mk
a325d4 42
705e8c 43 # mapping.json is auto-generated by the build tools. It provides a map
404117 44 # between component path and component FMRI.
45 $(WS_TOP)/components/mapping.json:
46     @echo "Generating component mapping..."
780de6 47     $(WS_TOOLS)/userland-mapping --workspace=$(WS_TOP) \
JMC 48         --repo=$(PUBLISHER) \
49         --repo-map=encumbered/=$(PUBLISHER)-encumbered
404117 50 mapping.json: $(WS_TOP)/components/mapping.json
9c75c0 51
705e8c 52 # dependencies.json is auto-generate by the build tools. It provides information
53 # about component dependencies.
54 $(WS_TOP)/components/dependencies.json: mapping.json
55     @echo "Generating component dependency list..."
56     @$(BASS_O_MATIC) --workspace=$(WS_TOP) --components=dependencies >$@
57 dependencies.json: $(WS_TOP)/components/dependencies.json
58
59 rebuild-dependents: dependencies.json
60     @echo "Bumping COMPONENT_REVISION for dependents of $(FMRI)"
61     @$(WS_TOOLS)/userland-bump -v --rebuild-dependents --fmri $(FMRI)
62
63 print-dependents: dependencies.json
64     @$(WS_TOOLS)/userland-bump -v --rebuild-dependents --dry-run --fmri $(FMRI)
65
f46b0e 66 publish-branch:
AL 67     @$(RM) $(WS_TOP)/components/$(ENCUMBERED)components.mk && \
68         ( env BASS_O_MATIC_MODE=incremental \
69             GIT_PREVIOUS_SUCCESSFUL_COMMIT=origin/oi/hipster \
70             $(GMAKE) -s publish )
71
72
3dc823 73 download:        TARGET = download
74c605 74 update-metadata:    TARGET = update-metadata
3dc823 75 prep:            TARGET = prep
NJ 76 build:            TARGET = build
77 install:        TARGET = install
b5b9c7 78 pre-publish:        TARGET = pre-publish
3dc823 79 publish:        TARGET = publish
NJ 80 clean:            TARGET = clean
81 clobber:        TARGET = clobber
874137 82 test:            TARGET = test
bf604a 83 zone-build:        TARGET = component-zone-build
84 zone-cleanup:        TARGET = component-zone-cleanup
764663 85 component-hook:        TARGET = component-hook
bf604a 86 zone-build zone-cleanup prep build install pre-publish publish test:    LOG = >$(WS_LOGS)/$(subst /,.,$@).$(TARGET).log 2>&1
9c75c0 87
a81d46 88 # turn off pkglint for the individual component builds.
048c87 89 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
a81d46 90 publish:        MAKEFLAGS += PKGLINT=/bin/true
048c87 91 endif
a81d46 92
9c75c0 93 .DEFAULT:    publish
NJ 94
bf604a 95 zone-build zone-cleanup build install pre-publish publish test: $(COMPONENT_DIRS)
9c75c0 96
79b849 97 COMPONENT_DIRS.nosetup =    $(COMPONENT_DIRS:%=%.nosetup)
74c605 98 COMPONENT_DIRS.nolog =        $(COMPONENT_DIRS:%=%.nolog)
9c75c0 99
b2b154 100 download prep:    $(COMPONENT_DIRS.nosetup)
74c605 101
JMC 102 update-metadata:    $(COMPONENT_DIRS.nolog)
b643a2 103
764663 104 component-hook:    $(COMPONENT_DIRS.nosetup)
NJ 105
b643a2 106 clean:        $(COMPONENT_DIRS.nosetup)
404117 107     $(RM) $(WS_TOP)/components/$(ENCUMBERED)components.mk \
108     $(WS_TOP)/components/mapping.json \
109     .profile
9c75c0 110
b643a2 111 clobber:    $(COMPONENT_DIRS.nosetup) clean
6185b3 112     @cd $(WS_TOP)/tools ; echo "clobbering tools..." ; $(GMAKE) clobber
724657 113     $(RM) -r $(WS_REPO) $(WS_LOGS) $(WS_LINT_CACHE) $(WS_MACH)/perl-meta-deps-cache
7999b2 114
79b849 115
0f4247 116 setup:    install_build_essential $(WS_LOGS) $(WS_REPO) tools $(WS_LINT_CACHE)
NH 117
118 install_build_essential:
119     @/usr/bin/pkg list -vH build-essential > /dev/null || \
120         $(PFEXEC) /usr/bin/pkg install --accept build-essential
9c75c0 121
NJ 122 $(WS_LOGS):
123     $(MKDIR) $@
124
d08673 125 $(WS_REPO):
dd0336 126     $(PKGREPO) create $(PKG_REPO)
DD 127     $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER)
313ffd 128     $(PKGREPO) rebuild -s $(PKG_REPO)
499a59 129 # Not required for OI
AS 130 #    $(PKGREPO) add-publisher -s $(PKG_REPO) $(PUBLISHER_LOCALIZABLE)
9c75c0 131
048c87 132 DUMMYPKG =  "set name=fmri value=pkg:/dummy@0,$(BUILD_VERSION)\n"
MS 133 DUMMYPKG += "set pkg.summary=dummy\n"
134 DUMMYPKG += "set org.opensolaris.consolidation=userland\n"
135 DUMMYPKG += "set info.classification=org.opensolaris.category.2008:System/Core"
136
7bf47e 137 $(WS_LINT_CACHE):    $(WS_LOGS) tools
d08673 138 ifdef CANONICAL_REPO
NJ 139     @echo "Generating pkglint(1) cache from $(CANONICAL_REPO)..."
048c87 140     @(echo $(DUMMYPKG) | $(PKGLINT) \
d08673 141         -c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
NJ 142         >$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 ; exit 0)
143 else
144     $(MKDIR) $(WS_LINT_CACHE)
145 endif
146
80b1b4 147 tools:
6185b3 148     @cd $(WS_TOP)/tools ; echo "building tools..." ; $(GMAKE) clean setup
80b1b4 149
79b849 150 # $(WS_COMPONENTS) is the home directory for the zone user, so create a profile
NJ 151 # to pass a few things on to zone based builds
152 .profile:
153     echo "PATH=$(PATH)" >>$@
154     echo "WS_TOP=$(WS_TOP)" >>$@
155     echo "export PATH WS_TOP" >>$@
156
b643a2 157 $(COMPONENT_DIRS):    $(WS_LOGS) setup FORCE
dab0d0 158     @+cd $@ && echo "$(TARGET) $@" && \
1018e3 159      $(BASS_O_MATIC) --make $(TARGET) $(LOG)
79b849 160
10a7de 161 incorporation:
0838fd 162     $(eval COMPONENT_REVISION := $(shell git rev-list HEAD --count))
10a7de 163     $(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
AP 164       --version=0.$(OS_VERSION),$(BUILD_VERSION) -p $(PUBLISHER) \
165       -c $(CONSOLIDATION) --destdir=$(WS_MACH) $(INCORPORATE_WERROR)
166     for incorporation in $(WS_MACH)/*.p5m ; do \
167         $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
168                    $${incorporation} ; \
169     done
170
171
a81d46 172 publish:
10a7de 173     $(PKGREPO) refresh -s $(PKG_REPO)
a81d46 174 ifdef CANONICAL_REPO
NJ 175     @echo 'pkglinting all package manifests...'
176     @$(ENV) PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
177             -c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
178             $(shell find . -name 'manifest-*.published')
179 endif
180
b643a2 181 $(COMPONENT_DIRS.nosetup):    $(WS_LOGS) FORCE
87ddce 182     @+cd $(@:%.nosetup=%) && echo "$(TARGET) $(@:%.nosetup=%)" && \
1018e3 183      $(BASS_O_MATIC) --make $(TARGET) $(LOG)
9c75c0 184
74c605 185 .PHONY:
JMC 186 $(COMPONENT_DIRS.nolog):
187     @$(MAKE) -s -C $(@:%.nolog=%) $(TARGET)
188
9c75c0 189 FORCE: