Unleashed v1.4
[unleashed.git] / usr / src / pkg / Makefile
blob835faf0ae6020ac868b4c86172ff76d1d7915619
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
23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
25 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
26 # Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
29 include $(SRC)/Makefile.master
32 # Make sure we're getting a consistent execution environment for the
33 # embedded scripts.
35 SHELL= /bin/sh
38 # To suppress package dependency generation on any system, regardless
39 # of how it was installed, set SUPPRESSPKGDEP=true in the build
40 # environment.
42 SUPPRESSPKGDEP= false
45 # Comment this line out or set "PKGDEBUG=" in your build environment
46 # to get more verbose output from the make processes in usr/src/pkg
48 PKGDEBUG= @
50 # Hackery to deal with uname transition
51 SETLEGACYUNAME:sh= if [ `uname` != SunOS ]; then echo puname; fi
54 # Cross platform packaging notes
56 # By default, we package the proto area from the same architecture as
57 # the packaging build. In other words, if you're running nightly or
58 # bldenv on an x86 platform, it will take objects from the x86 proto
59 # area and use them to create x86 repositories.
61 # If you want to create repositories for an architecture that's
62 # different from $(uname -p), you do so by setting PKGMACH in your
63 # build environment.
65 # For this to work correctly, the following must all happen:
67 # 1. You need the desired proto area, which you can get either by
68 # doing a gatekeeper-style build with the -U option to
69 # nightly(1), or by using rsync. If you don't do this, you will
70 # get packaging failures building all packages, because pkgsend
71 # is unable to find the required binaries.
72 # 2. You need the desired tools proto area, which you can get in the
73 # same ways as the normal proto area. If you don't do this, you
74 # will get packaging failures building onbld, because pkgsend is
75 # unable to find the tools binaries.
76 # 3. The remainder of this Makefile should never refer directly to
77 # $(MACH). Instead, $(PKGMACH) should be used whenever an
78 # architecture-specific path or token is needed. If this is done
79 # incorrectly, then packaging will fail, and you will see the
80 # value of $(uname -p) instead of the value of $(PKGMACH) in the
81 # commands that fail.
82 # 4. Each time a rule in this Makefile invokes $(MAKE), it should
83 # pass PKGMACH=$(PKGMACH) explicitly on the command line. If
84 # this is done incorrectly, then packaging will fail, and you
85 # will see the value of $(uname -p) instead of the value of
86 # $(PKGMACH) in the commands that fail.
88 # Refer also to the convenience targets defined later in this
89 # Makefile.
91 PKGMACH= $(MACH)
94 # ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
95 # bldenv. These macros translate them into terms of $PKGMACH, instead
96 # of $ARCH.
98 PKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
99 PKGROOT= $(PKGROOT.cmd:sh)
100 TOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
101 TOOLSROOT= $(TOOLSROOT.cmd:sh)
102 PKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
103 PKGDEST= $(PKGDEST.cmd:sh)
105 EXCEPTIONS= packaging
107 PKGMOGRIFY= pkgmogrify
110 # Always build the redistributable repository, but only build the
111 # nonredistributable bits if we have access to closed source.
113 # Some objects that result from the closed build are still
114 # redistributable, and should be packaged as part of an open-only
115 # build. Access to those objects is provided via the closed-bins
116 # tarball. See usr/src/tools/scripts/bindrop.sh for details.
118 REPOS= redist
121 # The packages directory will contain the processed manifests as
122 # direct build targets and subdirectories for package metadata extracted
123 # incidentally during manifest processing.
125 # Nothing underneath $(PDIR) should ever be managed by SCM.
127 PDIR= packages.$(PKGMACH)
130 # The tools proto must be specified for dependency generation.
131 # Publication from the tools proto area is managed in the
132 # publication rule.
134 $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT)
137 # To get these defaults, manifests should simply refer to $(PKGVERS).
139 # NOTE WELL:
140 # Because of the circular dependencies in the osnet incorporation, it
141 # is COMPLETELY AND UTTERLY IMPOSSIBLE TO UPDATE YOUR SYSTEM if your
142 # build doesn't have the same leading components. CHANGE THIS AT YOUR
143 # OWN RISK. If you're not using an existing distro, feel free to change
144 # this in your environment. This setting has no impact on tools that
145 # don't examine packaging versions.
147 PKGVERS_COMPONENT= 1.4
148 PKGVERS_BUILTON= 5.11
149 PKGVERS_BRANCH=
150 PKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)$(PKGVERS_BRANCH)
153 # The ARCH32 and ARCH64 macros are used in the manifests to express
154 # architecture-specific subdirectories in the installation paths
155 # for isaexec'd commands.
157 # We can't simply use $(MACH32) and $(MACH64) here, because they're
158 # only defined for the build architecture. To do cross-platform
159 # packaging, we need both values.
161 i386_ARCH32= i386
162 i386_ARCH64= amd64
165 # macros and transforms needed by pkgmogrify
167 # If you append to this list using target-specific assignments (:=),
168 # be very careful that the targets are of the form $(PDIR)/pkgname. If
169 # you use a higher level target, or a package list, you'll trigger a
170 # complete reprocessing of all manifests because they'll fail command
171 # dependency checking.
173 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
174 extract_metadata
175 PM_INC= transforms manifests
177 PKGMOG_DEFINES= \
178 ARCH=$(PKGMACH) \
179 ARCH32=$($(PKGMACH)_ARCH32) \
180 ARCH64=$($(PKGMACH)_ARCH64) \
181 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
182 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
183 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
184 PKGVERS=$(PKGVERS) \
185 ENABLE_PERL64=$(ENABLE_PERL64) \
186 PERL_ARCH=$(PERL_ARCH) \
187 PERL_ARCH64=$(PERL_ARCH64) \
188 PERL_VERSION=$(PERL_VERSION) \
189 PERL_PKGVERS=$(PERL_PKGVERS) \
190 PYTHON_VERSION=$(PYTHON_VERSION) \
191 PYTHON3_VERSION=$(PYTHON3_VERSION) \
192 PYTHON_PKGVERS=$(PYTHON_PKGVERS) \
193 PYTHON3_PKGVERS=$(PYTHON3_PKGVERS) \
194 python2_ONLY=$(BUILDPY2) \
195 python3_ONLY=$(BUILDPY3) \
196 python2tools_ONLY=$(BUILDPY2TOOLS) \
197 python3tools_ONLY=$(BUILDPY3TOOLS) \
198 HUMAN_VERSION=$(VERSION)
200 PKGDEP_TOKENS_i386= \
201 'ISALIST=amd64' \
202 'ISALIST=i386'
203 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
206 # The package lists are generated with $(PKGDEP_TYPE) as their
207 # dependency types, so that they can be included by either an
208 # incorporation or a group package.
210 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
211 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
213 PKGDEP_INCORP= \
214 depend fmri=consolidation/osnet/osnet-incorporation type=require
217 # All packaging build products should go into $(PDIR), so they don't
218 # need to be included separately in CLOBBERFILES.
220 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) install-$(PKGMACH).out \
221 license-list
224 # By default, PKGS will list all manifests. To build and/or publish a
225 # subset of packages, override this on the command line or in the
226 # build environment and then reference (implicitly or explicitly) the all
227 # or install targets.
229 MANIFESTS :sh= (cd manifests; print *.mf)
231 PKGS= $(MANIFESTS:%.mf=%)
232 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
233 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
236 # Track the synthetic manifests separately so we can properly express
237 # build rules and dependencies. The synthetic and real packages use
238 # different sets of transforms and macros for pkgmogrify.
240 SYNTH_PKGS= osnet-incorporation osnet-redist
241 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
242 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
245 # Root of pkg image to use for dependency resolution
246 # Normally / on the machine used to build the binaries
248 PKGDEP_RESOLVE_IMAGE = /
251 # For each package, we determine the target repository based on
252 # manifest-embedded metadata. Because we make that determination on
253 # the fly, the publication target cannot be expressed as a
254 # subdirectory inside the unknown-by-the-makefile target repository.
256 # In order to limit the target set to real files in known locations,
257 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless
258 # of content or target repository.
260 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
263 # Any given repository- and status-specific package list may be empty,
264 # but we can only determine that dynamically, so we always generate all
265 # lists for each repository we're building.
267 # The meanings of each package status are as follows:
269 # PKGSTAT meaning
270 # ---------- ----------------------------------------------------
271 # noincorp Do not include in incorporation or group package
272 # obsolete Include in incorporation, but not group package
273 # renamed Include in incorporation, but not group package
274 # current Include in incorporation and group package
276 # Since the semantics of the "noincorp" package status dictate that
277 # such packages are not included in the incorporation or group packages,
278 # there is no need to build noincorp package lists.
280 PKGLISTS= \
281 $(REPOS:%=$(PDIR)/packages.%.current) \
282 $(REPOS:%=$(PDIR)/packages.%.renamed) \
283 $(REPOS:%=$(PDIR)/packages.%.obsolete)
285 .KEEP_STATE:
287 .PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
288 $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
291 # For a single manifest, the dependency chain looks like this:
293 # raw manifest (mypkg.mf)
295 # | use pkgmogrify to process raw manifest
297 # processed manifest (mypkg.mog)
299 # * | use pkgdepend generate to generate dependencies
301 # manifest with TBD dependencies (mypkg.dep)
303 # % | use pkgdepend resolve to resolve dependencies
305 # manifest with dependencies resolved (mypkg.res)
307 # | use pkgsend to publish the package
309 # placeholder to indicate successful publication (mypkg.pub)
311 # * This may be suppressed via SUPPRESSPKGDEP. The resulting
312 # packages will install correctly, but care must be taken to
313 # install all dependencies, because pkg will not have the input
314 # it needs to determine this automatically.
316 # % This is included in this diagram to make the picture complete, but
317 # this is a point of synchronization in the build process.
318 # Dependency resolution is actually done once on the entire set of
319 # manifests, not on a per-package basis.
321 # The full dependency chain for generating everything that needs to be
322 # published, without actually publishing it, looks like this:
324 # processed synthetic packages
325 # | |
326 # package lists synthetic package manifests
328 # processed real packages
329 # | |
330 # package dir real package manifests
332 # Here, each item is a set of real or synthetic packages. For this
333 # portion of the build, no reference is made to the proto area. It is
334 # therefore suitable for the "all" target, as opposed to "install."
336 # Since each of these steps is expressed explicitly, "all" need only
337 # depend on the head of the chain.
339 # From the end of manifest processing, the publication dependency
340 # chain looks like this:
342 # repository metadata (catalogs and search indices)
344 # | pkgrepo refresh
346 # published packages
347 # | |
348 # | | pkgsend publish
349 # | |
350 # repositories resolved dependencies
351 # | |
352 # pkgsend | | pkgdepend resolve
353 # create-repository |
354 # | generated dependencies
355 # repo directories |
356 # | pkgdepend
358 # processed manifests
361 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
363 all: $(ALL_TARGETS)
366 # This will build the directory to contain the processed manifests
367 # and the metadata symlinks.
369 $(PDIR):
370 @print "Creating $(@)"
371 $(PKGDEBUG)$(INS.dir)
374 # This rule resolves dependencies across all published manifests.
376 # We shouldn't have to ignore the error from pkgdepend, but until
377 # 16012 and its dependencies are resolved, pkgdepend will always exit
378 # with an error.
380 # Note that for now pkgdepend relies on uname -s -r == SunOS 5.11.
381 # This is a bug inherited via its use of terminatorlib via simpljson.
383 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
384 -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
385 print "Suppressing dependency resolution"; \
386 for p in $(DEP_PKGS:%.dep=%); do \
387 $(CP) $$p.dep $$p.res; \
388 done; \
389 else \
390 print "Resolving dependencies"; \
391 $(SETLEGACYUNAME) pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
392 -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
393 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
394 if [ "$$(print $$p.metadata.*)" = \
395 "$$(print $$p.metadata.noincorp.*)" ]; \
396 then \
397 print "Removing dependency versions from $$p"; \
398 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
399 -O $$p.res -I transforms \
400 strip_versions $$p.dep.res; \
401 $(RM) $$p.dep.res; \
402 else \
403 $(MV) $$p.dep.res $$p.res; \
404 fi; \
405 done; \
407 $(PKGDEBUG)$(TOUCH) $(@)
409 install: $(ALL_TARGETS) repository-metadata
411 repository-metadata: publish_pkgs
412 $(PKGDEBUG)for r in $(REPOS); do \
413 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
414 done
417 # Since we create zero-length processed manifests for a graceful abort
418 # from pkgmogrify, we need to detect that here and make no effort to
419 # publish the package.
421 # For all other packages, we publish them regardless of status. We
422 # derive the target repository as a component of the metadata-derived
423 # symlink for each package.
425 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
428 # Before publishing, we want to pull the license files from $SRCTOP
429 # into the proto area. This allows us to NOT pass $SRC (or
430 # $SRCTOP) as a basedir for publication.
432 $(PUB_PKGS): stage-licenses
435 # Initialize the empty on-disk repositories
437 $(REPOS:%=$(PKGDEST)/repo.%):
438 @print "Initializing $(@F)"
439 $(PKGDEBUG)$(INS.dir)
440 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
441 --set-property publisher.prefix=$(PKGPUBLISHER)
444 # rule to process real manifests
446 # To allow redistributability and package status to change, we must
447 # remove not only the actual build target (the processed manifest), but
448 # also the incidental ones (the metadata-derived symlinks).
450 # If pkgmogrify exits cleanly but fails to create the specified output
451 # file, it means that it encountered an abort directive. That means
452 # that this package should not be published for this particular build
453 # environment. Since we can't prune such packages from $(PKGS)
454 # retroactively, we need to create an empty target file to keep make
455 # from trying to rebuild it every time. For these empty targets, we
456 # do not create metadata symlinks.
458 # Automatic dependency resolution to files is also done at this phase of
459 # processing. The skipped packages are skipped due to existing bugs
460 # in pkgdepend.
462 # The incorporation dependency is tricky: it needs to go into all
463 # current and renamed manifests (ie all incorporated packages), but we
464 # don't know which those are until after we run pkgmogrify. So
465 # instead of expressing it as a transform, we tack it on ex post facto.
467 # Implementation notes:
469 # - The first $(RM) must not match other manifests, or we'll run into
470 # race conditions with parallel manifest processing.
472 # - The make macros [ie $(MACRO)] are evaluated when the makefile is
473 # read in, and will result in a fixed, macro-expanded rule for each
474 # target enumerated in $(PROC_PKGS).
476 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule
477 # is executed. The results may only be referenced in the shell in
478 # which they are assigned, so from the perspective of make, all code
479 # that needs these variables needs to be part of the same line of
480 # code. Hence the use of command separators and line continuation
481 # characters.
483 # - The extract_metadata transforms are designed to spit out shell
484 # variable assignments to stdout. Those are published to the
485 # .vars temporary files, and then used as input to the eval
486 # statement. This is done in stages specifically so that pkgmogrify
487 # can signal failure if the manifest has a syntactic or other error.
488 # The eval statement should begin with the default values, and the
489 # output from pkgmogrify (if any) should be in the form of a
490 # variable assignment to override those defaults.
492 # - When this rule completes execution, it must leave an updated
493 # target file ($@) in place, or make will reprocess the package
494 # every time it encounters it as a dependency. Hence the "touch"
495 # statement to ensure that the target is created, even when
496 # pkgmogrify encounters an abort in the publish transforms.
499 .SUFFIXES: .mf .mog .dep .res .pub
501 $(PDIR)/%.mog: manifests/%.mf
502 @print "Processing manifest $(<F)"
503 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
504 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
505 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
506 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
507 $(<) $(PM_TRANSFORMS)
508 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
509 `$(CAT) -s $(@).vars`; \
510 if [ -f $(@) ]; then \
511 if [ "$$NODEPEND" != "false" ]; then \
512 $(TOUCH) $(@:%.mog=%.nodepend); \
513 fi; \
514 $(LN) -s $(@F) \
515 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
516 if [ \( "$$PKGSTAT" = "current" \) -o \
517 \( "$$PKGSTAT" = "renamed" \) ]; \
518 then print $(PKGDEP_INCORP) >> $(@); \
519 fi; \
520 print $$LICS > $(@:%.mog=%.lics); \
521 else \
522 $(TOUCH) $(@) $(@:%.mog=%.lics); \
524 $(PKGDEBUG)$(RM) $(@).vars
526 $(PDIR)/%.dep: $(PDIR)/%.mog
527 @print "Generating dependencies for $(<F)"
528 $(PKGDEBUG)$(RM) $(@)
529 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
530 $(SETLEGACYUNAME) pkgdepend generate -m \
531 $(PKGDEP_TOKENS:%=-D %) $(<) $(PKGROOT) > $(@); \
532 else \
533 $(CP) $(<) $(@); \
537 # The full chain implies that there should be a .dep.res suffix rule,
538 # but dependency generation is done on a set of manifests, rather than
539 # on a per-manifest basis. Instead, see the gendeps rule above.
542 $(PDIR)/%.pub: $(PDIR)/%.res
543 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
544 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
545 if [ -s $(<) ]; then \
546 print "Publishing $(@F:%.pub=%) to $$r repository"; \
547 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
548 -d $(PKGROOT) -d $(TOOLSROOT) \
549 -d license_files -d $(PKGROOT)/licenses \
550 --fmri-in-manifest --no-index --no-catalog $(<) \
551 > /dev/null; \
552 fi; \
553 $(TOUCH) $(@);
556 # rule to build the synthetic manifests
558 # This rule necessarily has PKGDEP_TYPE that changes according to
559 # the specific synthetic manifest. Rather than escape command
560 # dependency checking for the real manifest processing, or failing to
561 # express the (indirect) dependency of synthetic manifests on real
562 # manifests, we simply split this rule out from the one above.
564 # The implementation notes from the previous rule are applicable
565 # here, too.
567 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
568 @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
569 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
570 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
571 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
572 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
573 $(PM_TRANSFORMS) synthetic
574 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
575 if [ -f $(@) ]; then \
576 $(LN) -s $(@F) \
577 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
578 else \
579 $(TOUCH) $(@); \
581 $(PKGDEBUG)$(RM) $(@).vars
583 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
584 @print "Skipping dependency generation for $(@F:%.dep=%)"
585 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
587 clean:
589 clobber: clean
590 $(RM) -r $(CLOBBERFILES)
593 # This rule assumes that all links in the $PKGSTAT directories
594 # point to valid manifests, and will fail the make run if one
595 # does not contain an fmri.
597 # We do this in the BEGIN action instead of using pattern matching
598 # because we expect the fmri to be at or near the first line of each input
599 # file, and this way lets us avoid reading the rest of the file after we
600 # find what we need.
602 # We keep track of a failure to locate an fmri, so we can fail the
603 # make run, but we still attempt to process each package in the
604 # repo/pkgstat-specific subdir, in hopes of maybe giving some
605 # additional useful info.
607 # The protolist is used for bfu archive creation, which may be invoked
608 # interactively by the user. Both protolist and PKGLISTS targets
609 # depend on $(PROC_PKGS), but protolist builds them recursively.
610 # To avoid collisions, we insert protolist into the dependency chain
611 # here. This has two somewhat subtle benefits: it allows bfu archive
612 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
613 # and it ensures that a protolist file here will always correspond to the
614 # contents of the processed manifests, which can vary depending on build
615 # environment.
617 $(PKGLISTS): $(PROC_PKGS)
618 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \
619 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
620 print "Generating $$r $$s package list"; \
621 $(RM) $(@); $(TOUCH) $(@); \
622 $(AWK) 'BEGIN { \
623 if (ARGC < 2) { \
624 exit; \
626 retcode = 0; \
627 for (i = 1; i < ARGC; i++) { \
628 do { \
629 e = getline f < ARGV[i]; \
630 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \
631 close(ARGV[i]); \
632 if (e == 1) { \
633 l = split(f, a, "="); \
634 print "depend fmri=" a[l], \
635 "type=$$(PKGDEP_TYPE)"; \
636 } else { \
637 print "no fmri in " ARGV[i] >> "/dev/stderr"; \
638 retcode = 2; \
641 exit retcode; \
642 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
643 -name NOSUCHFILE \)` >> $(@)
646 # rules to validate proto area against manifests, check for safe
647 # file permission modes, and generate a faux proto list
649 # For the check targets, the dependencies on $(PROC_PKGS) is specified
650 # as a subordinate make process in order to suppress output.
652 makesilent:
653 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
654 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
657 # The .lics files were created during pkgmogrification, and list the
658 # set of licenses to pull from $SRC for each package. Because
659 # licenses may be duplicated between packages, we uniquify them as
660 # well as aggregating them here.
662 license-list: makesilent
663 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
664 do print $$l; done ) | sort -u > $@
667 # Staging the license and description files in the proto area allows
668 # us to do proper unreferenced file checking of both license and
669 # description files without blanket exceptions, and to pull license
670 # content without reference to $SRCTOP during publication.
672 stage-licenses: license-list FRC
673 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
674 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
675 `$(AWK) '{ \
676 print "$(PKGROOT)/licenses/" $$0; \
677 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
678 }' license-list` > /dev/null;
680 protocmp: makesilent
681 @validate_pkg -a $(PKGMACH) -v \
682 $(EXCEPTIONS:%=-e $(SRCTOP)/exception_lists/%) \
683 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
685 pmodes: makesilent
686 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
687 -e $(SRCTOP)/exception_lists/pmodes
689 check: protocmp pmodes
691 protolist: proto_list_$(PKGMACH)
693 proto_list_$(PKGMACH): $(PROC_PKGS)
694 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
696 $(PROC_PKGS): $(PDIR)
699 # This is a convenience target to allow package names to function as
700 # build targets. Generally, using it is only useful when iterating on
701 # development of a manifest.
703 # When processing a manifest, use the basename (without extension) of
704 # the package. When publishing, use the basename with a ".pub"
705 # extension.
707 # Other than during manifest development, the preferred usage is to
708 # avoid these targets and override PKGS on the make command line and
709 # use the provided all and install targets.
711 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
713 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
716 # This is a convenience target to resolve dependencies without publishing
717 # packages.
719 gendeps: $(PDIR)/gendeps
722 # These are convenience targets for cross-platform packaging. If you
723 # want to build any of "the normal" targets for a different
724 # architecture, simply use "arch/target" as your build target.
726 # Since the most common use case for this is "install," the architecture
727 # specific install targets have been further abbreviated to elide "/install."
729 i386/%:
730 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
732 i386: $$(@)/install
734 FRC: