Unleashed v1.1
[unleashed.git] / usr / src / pkg / Makefile
blob6d20527c374a0a30aa3481c8394e8de28fd67ea5
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>
28 include $(SRC)/Makefile.master
31 # Make sure we're getting a consistent execution environment for the
32 # embedded scripts.
34 SHELL= /usr/bin/ksh93
37 # To suppress package dependency generation on any system, regardless
38 # of how it was installed, set SUPPRESSPKGDEP=true in the build
39 # environment.
41 SUPPRESSPKGDEP= false
44 # Comment this line out or set "PKGDEBUG=" in your build environment
45 # to get more verbose output from the make processes in usr/src/pkg
47 PKGDEBUG= @
49 # Hackery to deal with uname transition
50 SETLEGACYUNAME:sh= if [ `uname` != SunOS ]; then echo puname; fi
53 # Cross platform packaging notes
55 # By default, we package the proto area from the same architecture as
56 # the packaging build. In other words, if you're running nightly or
57 # bldenv on an x86 platform, it will take objects from the x86 proto
58 # area and use them to create x86 repositories.
60 # If you want to create repositories for an architecture that's
61 # different from $(uname -p), you do so by setting PKGMACH in your
62 # build environment.
64 # For this to work correctly, the following must all happen:
66 # 1. You need the desired proto area, which you can get either by
67 # doing a gatekeeper-style build with the -U option to
68 # nightly(1), or by using rsync. If you don't do this, you will
69 # get packaging failures building all packages, because pkgsend
70 # is unable to find the required binaries.
71 # 2. You need the desired tools proto area, which you can get in the
72 # same ways as the normal proto area. If you don't do this, you
73 # will get packaging failures building onbld, because pkgsend is
74 # unable to find the tools binaries.
75 # 3. The remainder of this Makefile should never refer directly to
76 # $(MACH). Instead, $(PKGMACH) should be used whenever an
77 # architecture-specific path or token is needed. If this is done
78 # incorrectly, then packaging will fail, and you will see the
79 # value of $(uname -p) instead of the value of $(PKGMACH) in the
80 # commands that fail.
81 # 4. Each time a rule in this Makefile invokes $(MAKE), it should
82 # pass PKGMACH=$(PKGMACH) explicitly on the command line. If
83 # this is done incorrectly, then packaging will fail, and you
84 # will see the value of $(uname -p) instead of the value of
85 # $(PKGMACH) in the commands that fail.
87 # Refer also to the convenience targets defined later in this
88 # Makefile.
90 PKGMACH= $(MACH)
93 # ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
94 # bldenv. These macros translate them into terms of $PKGMACH, instead
95 # of $ARCH.
97 PKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
98 PKGROOT= $(PKGROOT.cmd:sh)
99 TOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
100 TOOLSROOT= $(TOOLSROOT.cmd:sh)
101 PKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
102 PKGDEST= $(PKGDEST.cmd:sh)
104 EXCEPTIONS= packaging
106 PKGMOGRIFY= pkgmogrify
109 # Always build the redistributable repository, but only build the
110 # nonredistributable bits if we have access to closed source.
112 # Some objects that result from the closed build are still
113 # redistributable, and should be packaged as part of an open-only
114 # build. Access to those objects is provided via the closed-bins
115 # tarball. See usr/src/tools/scripts/bindrop.sh for details.
117 REPOS= redist
120 # The packages directory will contain the processed manifests as
121 # direct build targets and subdirectories for package metadata extracted
122 # incidentally during manifest processing.
124 # Nothing underneath $(PDIR) should ever be managed by SCM.
126 PDIR= packages.$(PKGMACH)
129 # The tools proto must be specified for dependency generation.
130 # Publication from the tools proto area is managed in the
131 # publication rule.
133 $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT)
136 # To get these defaults, manifests should simply refer to $(PKGVERS).
138 # NOTE WELL:
139 # Because of the circular dependencies in the osnet incorporation, it
140 # is COMPLETELY AND UTTERLY IMPOSSIBLE TO UPDATE YOUR SYSTEM if your
141 # build doesn't have the same leading components. CHANGE THIS AT YOUR
142 # OWN RISK. If you're not using an existing distro, feel free to change
143 # this in your environment. This setting has no impact on tools that
144 # don't examine packaging versions.
146 PKGVERS_COMPONENT= 1.1
147 PKGVERS_BUILTON= 5.11
148 PKGVERS_BRANCH=
149 PKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)$(PKGVERS_BRANCH)
152 # The ARCH32 and ARCH64 macros are used in the manifests to express
153 # architecture-specific subdirectories in the installation paths
154 # for isaexec'd commands.
156 # We can't simply use $(MACH32) and $(MACH64) here, because they're
157 # only defined for the build architecture. To do cross-platform
158 # packaging, we need both values.
160 i386_ARCH32= i86
161 i386_ARCH64= amd64
164 # macros and transforms needed by pkgmogrify
166 # If you append to this list using target-specific assignments (:=),
167 # be very careful that the targets are of the form $(PDIR)/pkgname. If
168 # you use a higher level target, or a package list, you'll trigger a
169 # complete reprocessing of all manifests because they'll fail command
170 # dependency checking.
172 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
173 extract_metadata
174 PM_INC= transforms manifests
176 PKGMOG_DEFINES= \
177 i386_ONLY=$(POUND_SIGN) \
178 i86pc_ONLY=$(POUND_SIGN) \
179 $(PKGMACH)_ONLY= \
180 $(CONFIG_PLATFORM)_ONLY= \
181 CONFIG_PLATFORM=$(CONFIG_PLATFORM) \
182 ARCH=$(PKGMACH) \
183 ARCH32=$($(PKGMACH)_ARCH32) \
184 ARCH64=$($(PKGMACH)_ARCH64) \
185 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
186 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
187 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
188 PKGVERS=$(PKGVERS) \
189 ENABLE_PERL64=$(ENABLE_PERL64) \
190 PERL_ARCH=$(PERL_ARCH) \
191 PERL_ARCH64=$(PERL_ARCH64) \
192 PERL_VERSION=$(PERL_VERSION) \
193 PERL_PKGVERS=$(PERL_PKGVERS) \
194 PYTHON_VERSION=$(PYTHON_VERSION) \
195 PYTHON_PKGVERS=$(PYTHON_PKGVERS) \
196 HUMAN_VERSION=$(VERSION)
198 PKGDEP_TOKENS_i386= \
199 'PLATFORM=i86pc' \
200 'ISALIST=amd64' \
201 'ISALIST=i386'
202 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
205 # The package lists are generated with $(PKGDEP_TYPE) as their
206 # dependency types, so that they can be included by either an
207 # incorporation or a group package.
209 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
210 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
212 PKGDEP_INCORP= \
213 depend fmri=consolidation/osnet/osnet-incorporation type=require
216 # All packaging build products should go into $(PDIR), so they don't
217 # need to be included separately in CLOBBERFILES.
219 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) install-$(PKGMACH).out \
220 license-list
223 # By default, PKGS will list all manifests. To build and/or publish a
224 # subset of packages, override this on the command line or in the
225 # build environment and then reference (implicitly or explicitly) the all
226 # or install targets.
228 MANIFESTS :sh= (cd manifests; print *.mf)
230 PKGS= $(MANIFESTS:%.mf=%)
231 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
232 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
235 # Track the synthetic manifests separately so we can properly express
236 # build rules and dependencies. The synthetic and real packages use
237 # different sets of transforms and macros for pkgmogrify.
239 SYNTH_PKGS= osnet-incorporation osnet-redist
240 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
241 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
244 # Root of pkg image to use for dependency resolution
245 # Normally / on the machine used to build the binaries
247 PKGDEP_RESOLVE_IMAGE = /
250 # For each package, we determine the target repository based on
251 # manifest-embedded metadata. Because we make that determination on
252 # the fly, the publication target cannot be expressed as a
253 # subdirectory inside the unknown-by-the-makefile target repository.
255 # In order to limit the target set to real files in known locations,
256 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless
257 # of content or target repository.
259 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
262 # Any given repository- and status-specific package list may be empty,
263 # but we can only determine that dynamically, so we always generate all
264 # lists for each repository we're building.
266 # The meanings of each package status are as follows:
268 # PKGSTAT meaning
269 # ---------- ----------------------------------------------------
270 # noincorp Do not include in incorporation or group package
271 # obsolete Include in incorporation, but not group package
272 # renamed Include in incorporation, but not group package
273 # current Include in incorporation and group package
275 # Since the semantics of the "noincorp" package status dictate that
276 # such packages are not included in the incorporation or group packages,
277 # there is no need to build noincorp package lists.
279 PKGLISTS= \
280 $(REPOS:%=$(PDIR)/packages.%.current) \
281 $(REPOS:%=$(PDIR)/packages.%.renamed) \
282 $(REPOS:%=$(PDIR)/packages.%.obsolete)
284 .KEEP_STATE:
286 .PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
287 $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
290 # For a single manifest, the dependency chain looks like this:
292 # raw manifest (mypkg.mf)
294 # | use pkgmogrify to process raw manifest
296 # processed manifest (mypkg.mog)
298 # * | use pkgdepend generate to generate dependencies
300 # manifest with TBD dependencies (mypkg.dep)
302 # % | use pkgdepend resolve to resolve dependencies
304 # manifest with dependencies resolved (mypkg.res)
306 # | use pkgsend to publish the package
308 # placeholder to indicate successful publication (mypkg.pub)
310 # * This may be suppressed via SUPPRESSPKGDEP. The resulting
311 # packages will install correctly, but care must be taken to
312 # install all dependencies, because pkg will not have the input
313 # it needs to determine this automatically.
315 # % This is included in this diagram to make the picture complete, but
316 # this is a point of synchronization in the build process.
317 # Dependency resolution is actually done once on the entire set of
318 # manifests, not on a per-package basis.
320 # The full dependency chain for generating everything that needs to be
321 # published, without actually publishing it, looks like this:
323 # processed synthetic packages
324 # | |
325 # package lists synthetic package manifests
327 # processed real packages
328 # | |
329 # package dir real package manifests
331 # Here, each item is a set of real or synthetic packages. For this
332 # portion of the build, no reference is made to the proto area. It is
333 # therefore suitable for the "all" target, as opposed to "install."
335 # Since each of these steps is expressed explicitly, "all" need only
336 # depend on the head of the chain.
338 # From the end of manifest processing, the publication dependency
339 # chain looks like this:
341 # repository metadata (catalogs and search indices)
343 # | pkgrepo refresh
345 # published packages
346 # | |
347 # | | pkgsend publish
348 # | |
349 # repositories resolved dependencies
350 # | |
351 # pkgsend | | pkgdepend resolve
352 # create-repository |
353 # | generated dependencies
354 # repo directories |
355 # | pkgdepend
357 # processed manifests
360 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
362 all: $(ALL_TARGETS)
365 # This will build the directory to contain the processed manifests
366 # and the metadata symlinks.
368 $(PDIR):
369 @print "Creating $(@)"
370 $(PKGDEBUG)$(INS.dir)
373 # This rule resolves dependencies across all published manifests.
375 # We shouldn't have to ignore the error from pkgdepend, but until
376 # 16012 and its dependencies are resolved, pkgdepend will always exit
377 # with an error.
379 # Note that for now pkgdepend relies on uname -s -r == SunOS 5.11.
380 # This is a bug inherited via its use of terminatorlib via simpljson.
382 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
383 -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
384 print "Suppressing dependency resolution"; \
385 for p in $(DEP_PKGS:%.dep=%); do \
386 $(CP) $$p.dep $$p.res; \
387 done; \
388 else \
389 print "Resolving dependencies"; \
390 $(SETLEGACYUNAME) pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
391 -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
392 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
393 if [ "$$(print $$p.metadata.*)" = \
394 "$$(print $$p.metadata.noincorp.*)" ]; \
395 then \
396 print "Removing dependency versions from $$p"; \
397 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
398 -O $$p.res -I transforms \
399 strip_versions $$p.dep.res; \
400 $(RM) $$p.dep.res; \
401 else \
402 $(MV) $$p.dep.res $$p.res; \
403 fi; \
404 done; \
406 $(PKGDEBUG)$(TOUCH) $(@)
408 install: $(ALL_TARGETS) repository-metadata
410 repository-metadata: publish_pkgs
411 $(PKGDEBUG)for r in $(REPOS); do \
412 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
413 done
416 # Since we create zero-length processed manifests for a graceful abort
417 # from pkgmogrify, we need to detect that here and make no effort to
418 # publish the package.
420 # For all other packages, we publish them regardless of status. We
421 # derive the target repository as a component of the metadata-derived
422 # symlink for each package.
424 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
427 # Before publishing, we want to pull the license files from $SRCTOP
428 # into the proto area. This allows us to NOT pass $SRC (or
429 # $SRCTOP) as a basedir for publication.
431 $(PUB_PKGS): stage-licenses
434 # Initialize the empty on-disk repositories
436 $(REPOS:%=$(PKGDEST)/repo.%):
437 @print "Initializing $(@F)"
438 $(PKGDEBUG)$(INS.dir)
439 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
440 --set-property publisher.prefix=$(PKGPUBLISHER)
443 # rule to process real manifests
445 # To allow redistributability and package status to change, we must
446 # remove not only the actual build target (the processed manifest), but
447 # also the incidental ones (the metadata-derived symlinks).
449 # If pkgmogrify exits cleanly but fails to create the specified output
450 # file, it means that it encountered an abort directive. That means
451 # that this package should not be published for this particular build
452 # environment. Since we can't prune such packages from $(PKGS)
453 # retroactively, we need to create an empty target file to keep make
454 # from trying to rebuild it every time. For these empty targets, we
455 # do not create metadata symlinks.
457 # Automatic dependency resolution to files is also done at this phase of
458 # processing. The skipped packages are skipped due to existing bugs
459 # in pkgdepend.
461 # The incorporation dependency is tricky: it needs to go into all
462 # current and renamed manifests (ie all incorporated packages), but we
463 # don't know which those are until after we run pkgmogrify. So
464 # instead of expressing it as a transform, we tack it on ex post facto.
466 # Implementation notes:
468 # - The first $(RM) must not match other manifests, or we'll run into
469 # race conditions with parallel manifest processing.
471 # - The make macros [ie $(MACRO)] are evaluated when the makefile is
472 # read in, and will result in a fixed, macro-expanded rule for each
473 # target enumerated in $(PROC_PKGS).
475 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule
476 # is executed. The results may only be referenced in the shell in
477 # which they are assigned, so from the perspective of make, all code
478 # that needs these variables needs to be part of the same line of
479 # code. Hence the use of command separators and line continuation
480 # characters.
482 # - The extract_metadata transforms are designed to spit out shell
483 # variable assignments to stdout. Those are published to the
484 # .vars temporary files, and then used as input to the eval
485 # statement. This is done in stages specifically so that pkgmogrify
486 # can signal failure if the manifest has a syntactic or other error.
487 # The eval statement should begin with the default values, and the
488 # output from pkgmogrify (if any) should be in the form of a
489 # variable assignment to override those defaults.
491 # - When this rule completes execution, it must leave an updated
492 # target file ($@) in place, or make will reprocess the package
493 # every time it encounters it as a dependency. Hence the "touch"
494 # statement to ensure that the target is created, even when
495 # pkgmogrify encounters an abort in the publish transforms.
498 .SUFFIXES: .mf .mog .dep .res .pub
500 $(PDIR)/%.mog: manifests/%.mf
501 @print "Processing manifest $(<F)"
502 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
503 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
504 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
505 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
506 $(<) $(PM_TRANSFORMS)
507 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
508 `$(CAT) -s $(@).vars`; \
509 if [ -f $(@) ]; then \
510 if [ "$$NODEPEND" != "false" ]; then \
511 $(TOUCH) $(@:%.mog=%.nodepend); \
512 fi; \
513 $(LN) -s $(@F) \
514 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
515 if [ \( "$$PKGSTAT" = "current" \) -o \
516 \( "$$PKGSTAT" = "renamed" \) ]; \
517 then print $(PKGDEP_INCORP) >> $(@); \
518 fi; \
519 print $$LICS > $(@:%.mog=%.lics); \
520 else \
521 $(TOUCH) $(@) $(@:%.mog=%.lics); \
523 $(PKGDEBUG)$(RM) $(@).vars
525 $(PDIR)/%.dep: $(PDIR)/%.mog
526 @print "Generating dependencies for $(<F)"
527 $(PKGDEBUG)$(RM) $(@)
528 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
529 $(SETLEGACYUNAME) pkgdepend generate -m \
530 $(PKGDEP_TOKENS:%=-D %) $(<) $(PKGROOT) > $(@); \
531 else \
532 $(CP) $(<) $(@); \
536 # The full chain implies that there should be a .dep.res suffix rule,
537 # but dependency generation is done on a set of manifests, rather than
538 # on a per-manifest basis. Instead, see the gendeps rule above.
541 $(PDIR)/%.pub: $(PDIR)/%.res
542 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
543 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
544 if [ -s $(<) ]; then \
545 print "Publishing $(@F:%.pub=%) to $$r repository"; \
546 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
547 -d $(PKGROOT) -d $(TOOLSROOT) \
548 -d license_files -d $(PKGROOT)/licenses \
549 --fmri-in-manifest --no-index --no-catalog $(<) \
550 > /dev/null; \
551 fi; \
552 $(TOUCH) $(@);
555 # rule to build the synthetic manifests
557 # This rule necessarily has PKGDEP_TYPE that changes according to
558 # the specific synthetic manifest. Rather than escape command
559 # dependency checking for the real manifest processing, or failing to
560 # express the (indirect) dependency of synthetic manifests on real
561 # manifests, we simply split this rule out from the one above.
563 # The implementation notes from the previous rule are applicable
564 # here, too.
566 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
567 @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
568 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
569 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
570 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
571 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
572 $(PM_TRANSFORMS) synthetic
573 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
574 if [ -f $(@) ]; then \
575 $(LN) -s $(@F) \
576 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
577 else \
578 $(TOUCH) $(@); \
580 $(PKGDEBUG)$(RM) $(@).vars
582 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
583 @print "Skipping dependency generation for $(@F:%.dep=%)"
584 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
586 clean:
588 clobber: clean
589 $(RM) -r $(CLOBBERFILES)
592 # This rule assumes that all links in the $PKGSTAT directories
593 # point to valid manifests, and will fail the make run if one
594 # does not contain an fmri.
596 # We do this in the BEGIN action instead of using pattern matching
597 # because we expect the fmri to be at or near the first line of each input
598 # file, and this way lets us avoid reading the rest of the file after we
599 # find what we need.
601 # We keep track of a failure to locate an fmri, so we can fail the
602 # make run, but we still attempt to process each package in the
603 # repo/pkgstat-specific subdir, in hopes of maybe giving some
604 # additional useful info.
606 # The protolist is used for bfu archive creation, which may be invoked
607 # interactively by the user. Both protolist and PKGLISTS targets
608 # depend on $(PROC_PKGS), but protolist builds them recursively.
609 # To avoid collisions, we insert protolist into the dependency chain
610 # here. This has two somewhat subtle benefits: it allows bfu archive
611 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
612 # and it ensures that a protolist file here will always correspond to the
613 # contents of the processed manifests, which can vary depending on build
614 # environment.
616 $(PKGLISTS): $(PROC_PKGS)
617 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \
618 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
619 print "Generating $$r $$s package list"; \
620 $(RM) $(@); $(TOUCH) $(@); \
621 $(AWK) 'BEGIN { \
622 if (ARGC < 2) { \
623 exit; \
625 retcode = 0; \
626 for (i = 1; i < ARGC; i++) { \
627 do { \
628 e = getline f < ARGV[i]; \
629 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \
630 close(ARGV[i]); \
631 if (e == 1) { \
632 l = split(f, a, "="); \
633 print "depend fmri=" a[l], \
634 "type=$$(PKGDEP_TYPE)"; \
635 } else { \
636 print "no fmri in " ARGV[i] >> "/dev/stderr"; \
637 retcode = 2; \
640 exit retcode; \
641 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
642 -name NOSUCHFILE \)` >> $(@)
645 # rules to validate proto area against manifests, check for safe
646 # file permission modes, and generate a faux proto list
648 # For the check targets, the dependencies on $(PROC_PKGS) is specified
649 # as a subordinate make process in order to suppress output.
651 makesilent:
652 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
653 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
656 # The .lics files were created during pkgmogrification, and list the
657 # set of licenses to pull from $SRC for each package. Because
658 # licenses may be duplicated between packages, we uniquify them as
659 # well as aggregating them here.
661 license-list: makesilent
662 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
663 do print $$l; done ) | sort -u > $@
666 # Staging the license and description files in the proto area allows
667 # us to do proper unreferenced file checking of both license and
668 # description files without blanket exceptions, and to pull license
669 # content without reference to $SRCTOP during publication.
671 stage-licenses: license-list FRC
672 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
673 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
674 `$(AWK) '{ \
675 print "$(PKGROOT)/licenses/" $$0; \
676 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
677 }' license-list` > /dev/null;
679 protocmp: makesilent
680 @validate_pkg -a $(PKGMACH) -v \
681 $(EXCEPTIONS:%=-e $(SRCTOP)/exception_lists/%) \
682 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
684 pmodes: makesilent
685 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
686 -e $(SRCTOP)/exception_lists/pmodes
688 check: protocmp pmodes
690 protolist: proto_list_$(PKGMACH)
692 proto_list_$(PKGMACH): $(PROC_PKGS)
693 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
695 $(PROC_PKGS): $(PDIR)
698 # This is a convenience target to allow package names to function as
699 # build targets. Generally, using it is only useful when iterating on
700 # development of a manifest.
702 # When processing a manifest, use the basename (without extension) of
703 # the package. When publishing, use the basename with a ".pub"
704 # extension.
706 # Other than during manifest development, the preferred usage is to
707 # avoid these targets and override PKGS on the make command line and
708 # use the provided all and install targets.
710 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
712 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
715 # This is a convenience target to resolve dependencies without publishing
716 # packages.
718 gendeps: $(PDIR)/gendeps
721 # These are convenience targets for cross-platform packaging. If you
722 # want to build any of "the normal" targets for a different
723 # architecture, simply use "arch/target" as your build target.
725 # Since the most common use case for this is "install," the architecture
726 # specific install targets have been further abbreviated to elide "/install."
728 i386/%:
729 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
731 i386: $$(@)/install
733 FRC: