Print this page
NEX-9559 remove nza-closed cruft
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-5206 pkg should use the adjunct for dependency resolution
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3128 remove dependency on sysidtool
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3127 nza-kernel can't be built with fresh perl versions
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3124 Disable IPP printing like SMB printing can be disabled
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-1666 More maintainable ips2deb
4463 NLM fails wrongly on clnt_control().
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Jason King <jason.brian.king@gmail.com>
Approved by: Garrett D'Amore <garrett@damore.org>
4413 repository-metadata target should use "pkgrepo refresh" instead of "pkg.depotd"
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: Alexander Pyhalov <alp@rsu.ru>
Reviewed by: Richard PALO <richard.palo@free.fr>
Approved by: Richard Lowe <richlowe@richlowe.net>
re #13842 make clobber leaves trash
re #13468 rb4431 ACPI CA could be less verbose in release builds
re #12731 rb4460 Integrate ISA-L kernel module into nza-closed
Adding AoE support to nza-kernel


   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 #
  21 
  22 #
  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 #
  27 
  28 include $(SRC)/Makefile.master
  29 include $(SRC)/Makefile.buildnum
  30 
  31 #
  32 # Make sure we're getting a consistent execution environment for the
  33 # embedded scripts.
  34 #
  35 SHELL= /usr/bin/ksh93
  36 
  37 #
  38 # To suppress package dependency generation on any system, regardless
  39 # of how it was installed, set SUPPRESSPKGDEP=true in the build
  40 # environment.
  41 #
  42 SUPPRESSPKGDEP= false
  43 


 225 # By default, PKGS will list all manifests.  To build and/or publish a
 226 # subset of packages, override this on the command line or in the
 227 # build environment and then reference (implicitly or explicitly) the all
 228 # or install targets.
 229 #
 230 MANIFESTS :sh= (cd manifests; print *.mf)
 231 PKGS= $(MANIFESTS:%.mf=%)
 232 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
 233 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
 234 
 235 #
 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.
 239 #
 240 SYNTH_PKGS= osnet-incorporation osnet-redist
 241 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
 242 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
 243 
 244 #
 245 # Root of pkg image to use for dependency resolution
 246 # Normally / on the machine used to build the binaries
 247 #
 248 PKGDEP_RESOLVE_IMAGE = /




 249 


 250 #
 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.
 255 #
 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.
 259 #
 260 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
 261 
 262 #
 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.
 266 #
 267 # The meanings of each package status are as follows:
 268 #
 269 #       PKGSTAT         meaning


 343 #                       |
 344 #                       | pkgrepo refresh
 345 #                       |
 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
 357 #                                       |
 358 #                               processed manifests
 359 # 
 360 
 361 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
 362 




 363 all: $(ALL_TARGETS)
 364 
 365 #
 366 # This will build the directory to contain the processed manifests
 367 # and the metadata symlinks.
 368 #
 369 $(PDIR):
 370         @print "Creating $(@)"
 371         $(PKGDEBUG)$(INS.dir)
 372 
 373 #
 374 # This rule resolves dependencies across all published manifests.
 375 #
 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.
 379 #
 380 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
 381         -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
 382                 print "Suppressing dependency resolution"; \
 383                 for p in $(DEP_PKGS:%.dep=%); do \
 384                         $(CP) $$p.dep $$p.res; \
 385                 done; \
 386         else \
 387                 print "Resolving dependencies"; \
 388                 pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
 389                     -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
 390                 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
 391                         if [ "$$(print $$p.metadata.*)" = \
 392                              "$$(print $$p.metadata.noincorp.*)" ]; \
 393                         then \
 394                                 print "Removing dependency versions from $$p"; \
 395                                 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
 396                                     -O $$p.res -I transforms \
 397                                     strip_versions $$p.dep.res; \
 398                                 $(RM) $$p.dep.res; \
 399                         else \
 400                                 $(MV) $$p.dep.res $$p.res; \
 401                         fi; \
 402                 done; \
 403         fi
 404         $(PKGDEBUG)$(TOUCH) $(@)
 405 
 406 install: $(ALL_TARGETS) repository-metadata
 407 
 408 repository-metadata: publish_pkgs
 409         $(PKGDEBUG)for r in $(REPOS); do \
 410                 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
 411         done
 412 
 413 #
 414 # Since we create zero-length processed manifests for a graceful abort
 415 # from pkgmogrify, we need to detect that here and make no effort to
 416 # publish the package.
 417 #
 418 # For all other packages, we publish them regardless of status.  We
 419 # derive the target repository as a component of the metadata-derived
 420 # symlink for each package.
 421 #
 422 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
 423 
 424 #
 425 # Before publishing, we want to pull the license files from $CODEMGR_WS
 426 # into the proto area.  This allows us to NOT pass $SRC (or
 427 # $CODEMGR_WS) as a basedir for publication.
 428 #
 429 $(PUB_PKGS): stage-licenses
 430 
 431 #
 432 # Initialize the empty on-disk repositories
 433 #
 434 $(REPOS:%=$(PKGDEST)/repo.%):
 435         @print "Initializing $(@F)"
 436         $(PKGDEBUG)$(INS.dir)
 437         $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
 438                 --set-property publisher.prefix=$(PKGPUBLISHER)
 439 
 440 #
 441 # rule to process real manifests
 442 #
 443 # To allow redistributability and package status to change, we must
 444 # remove not only the actual build target (the processed manifest), but
 445 # also the incidental ones (the metadata-derived symlinks).
 446 #
 447 # If pkgmogrify exits cleanly but fails to create the specified output
 448 # file, it means that it encountered an abort directive.  That means
 449 # that this package should not be published for this particular build
 450 # environment.  Since we can't prune such packages from $(PKGS)
 451 # retroactively, we need to create an empty target file to keep make
 452 # from trying to rebuild it every time.  For these empty targets, we
 453 # do not create metadata symlinks.
 454 #
 455 # Automatic dependency resolution to files is also done at this phase of
 456 # processing.  The skipped packages are skipped due to existing bugs
 457 # in pkgdepend.
 458 #
 459 # The incorporation dependency is tricky: it needs to go into all
 460 # current and renamed manifests (ie all incorporated packages), but we


 481 #   variable assignments to stdout.  Those are published to the
 482 #   .vars temporary files, and then used as input to the eval
 483 #   statement.  This is done in stages specifically so that pkgmogrify
 484 #   can signal failure if the manifest has a syntactic or other error.
 485 #   The eval statement should begin with the default values, and the
 486 #   output from pkgmogrify (if any) should be in the form of a
 487 #   variable assignment to override those defaults.
 488 #
 489 # - When this rule completes execution, it must leave an updated
 490 #   target file ($@) in place, or make will reprocess the package
 491 #   every time it encounters it as a dependency.  Hence the "touch"
 492 #   statement to ensure that the target is created, even when
 493 #   pkgmogrify encounters an abort in the publish transforms.
 494 #
 495 
 496 .SUFFIXES: .mf .mog .dep .res .pub
 497 
 498 $(PDIR)/%.mog: manifests/%.mf
 499         @print "Processing manifest $(<F)"
 500         @env PKGFMT_OUTPUT=v1 pkgfmt -c $<
 501         $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
 502                 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
 503         $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
 504                 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
 505                 $(<) $(PM_TRANSFORMS)
 506         $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
 507                 `$(CAT) -s $(@).vars`; \
 508         if [ -f $(@) ]; then \
 509                 if [ "$$NODEPEND" != "false" ]; then \
 510                          $(TOUCH) $(@:%.mog=%.nodepend); \
 511                 fi; \
 512                 $(LN) -s $(@F) \
 513                         $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
 514                 if [ \( "$$PKGSTAT" = "current" \) -o \
 515                      \( "$$PKGSTAT" = "renamed" \) ]; \
 516                         then print $(PKGDEP_INCORP) >> $(@); \
 517                 fi; \
 518                 print $$LICS > $(@:%.mog=%.lics); \
 519         else \
 520                 $(TOUCH) $(@) $(@:%.mog=%.lics); \
 521         fi
 522         $(PKGDEBUG)$(RM) $(@).vars
 523 
 524 $(PDIR)/%.dep: $(PDIR)/%.mog
 525         @print "Generating dependencies for $(<F)"
 526         $(PKGDEBUG)$(RM) $(@)
 527         $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
 528                 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
 529                         $(PKGROOT) > $(@); \
 530         else \
 531                 $(CP) $(<) $(@); \
 532         fi
 533 
 534 #
 535 # The full chain implies that there should be a .dep.res suffix rule,
 536 # but dependency generation is done on a set of manifests, rather than
 537 # on a per-manifest basis.  Instead, see the gendeps rule above.
 538 #
 539 
 540 $(PDIR)/%.pub: $(PDIR)/%.res
 541         $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
 542         r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
 543         if [ -s $(<) ]; then \
 544                 print "Publishing $(@F:%.pub=%) to $$r repository"; \
 545                 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
 546                     -d $(PKGROOT) -d $(TOOLSROOT) \
 547                     -d license_files -d $(PKGROOT)/licenses \
 548                     --fmri-in-manifest --no-index --no-catalog $(<) \
 549                     > /dev/null; \
 550         fi; \
 551         $(TOUCH) $(@);
 552 
 553 #
 554 # rule to build the synthetic manifests
 555 #
 556 # This rule necessarily has PKGDEP_TYPE that changes according to
 557 # the specific synthetic manifest.  Rather than escape command
 558 # dependency checking for the real manifest processing, or failing to
 559 # express the (indirect) dependency of synthetic manifests on real
 560 # manifests, we simply split this rule out from the one above.
 561 #
 562 # The implementation notes from the previous rule are applicable
 563 # here, too.
 564 #
 565 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
 566         @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
 567         $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
 568         $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
 569                 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
 570                 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
 571                 $(PM_TRANSFORMS) synthetic
 572         $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
 573         if [ -f $(@) ]; then \


 691 proto_list_$(PKGMACH): $(PROC_PKGS)
 692         @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
 693 
 694 $(PROC_PKGS): $(PDIR)
 695 
 696 #
 697 # This is a convenience target to allow package names to function as
 698 # build targets.  Generally, using it is only useful when iterating on
 699 # development of a manifest.
 700 #
 701 # When processing a manifest, use the basename (without extension) of
 702 # the package.  When publishing, use the basename with a ".pub"
 703 # extension.
 704 #
 705 # Other than during manifest development, the preferred usage is to
 706 # avoid these targets and override PKGS on the make command line and
 707 # use the provided all and install targets.
 708 #
 709 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
 710 
 711 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
 712 
 713 #
 714 # This is a convenience target to resolve dependencies without publishing
 715 # packages.
 716 #
 717 gendeps: $(PDIR)/gendeps
 718 
 719 #
 720 # These are convenience targets for cross-platform packaging.  If you
 721 # want to build any of "the normal" targets for a different
 722 # architecture, simply use "arch/target" as your build target.
 723 #
 724 # Since the most common use case for this is "install," the architecture
 725 # specific install targets have been further abbreviated to elide "/install."
 726 #
 727 i386/% sparc/%:
 728         $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
 729 
 730 i386 sparc: $$(@)/install
 731 


   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 #
  21 
  22 #
  23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  25 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  26 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
  27 #
  28 
  29 include $(SRC)/Makefile.master
  30 include $(SRC)/Makefile.buildnum
  31 
  32 #
  33 # Make sure we're getting a consistent execution environment for the
  34 # embedded scripts.
  35 #
  36 SHELL= /usr/bin/ksh93
  37 
  38 #
  39 # To suppress package dependency generation on any system, regardless
  40 # of how it was installed, set SUPPRESSPKGDEP=true in the build
  41 # environment.
  42 #
  43 SUPPRESSPKGDEP= false
  44 


 226 # By default, PKGS will list all manifests.  To build and/or publish a
 227 # subset of packages, override this on the command line or in the
 228 # build environment and then reference (implicitly or explicitly) the all
 229 # or install targets.
 230 #
 231 MANIFESTS :sh= (cd manifests; print *.mf)
 232 PKGS= $(MANIFESTS:%.mf=%)
 233 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
 234 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
 235 
 236 #
 237 # Track the synthetic manifests separately so we can properly express
 238 # build rules and dependencies.  The synthetic and real packages use
 239 # different sets of transforms and macros for pkgmogrify.
 240 #
 241 SYNTH_PKGS= osnet-incorporation osnet-redist
 242 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
 243 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
 244 
 245 #
 246 # Root of pkg image to use for dependency resolution Normally / on the machine
 247 # used to build the binaries, or the ADJUNCT_PROTO
 248 #
 249 PKG_ADJUNCT.cmd= AP=$${ADJUNCT_PROTO:-/}; if [[ -d $${AP}/var/pkg ]]; then \
 250                 echo $$AP; \
 251         else    \
 252                 echo /; \
 253         fi
 254 
 255 PKGDEP_RESOLVE_IMAGE = $(PKG_ADJUNCT.cmd:sh)
 256 
 257 #
 258 # For each package, we determine the target repository based on
 259 # manifest-embedded metadata.  Because we make that determination on
 260 # the fly, the publication target cannot be expressed as a
 261 # subdirectory inside the unknown-by-the-makefile target repository.
 262 #
 263 # In order to limit the target set to real files in known locations,
 264 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless
 265 # of content or target repository.
 266 #
 267 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
 268 
 269 #
 270 # Any given repository- and status-specific package list may be empty,
 271 # but we can only determine that dynamically, so we always generate all
 272 # lists for each repository we're building.
 273 #
 274 # The meanings of each package status are as follows:
 275 #
 276 #       PKGSTAT         meaning


 350 #                       |
 351 #                       | pkgrepo refresh
 352 #                       |
 353 #               published packages
 354 #                |              |
 355 #                |              | pkgsend publish
 356 #                |              |
 357 #         repositories      resolved dependencies
 358 #                |                      |
 359 # pkgsend        |                      | pkgdepend resolve
 360 # create-repository                     |
 361 #                |              generated dependencies
 362 #        repo directories               |
 363 #                                       | pkgdepend
 364 #                                       |
 365 #                               processed manifests
 366 # 
 367 
 368 ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
 369 
 370 # This may be empty, or set to "ips", or "deb"
 371 PKGTYPE=ips
 372 include Makefile.$(PKGTYPE)
 373 
 374 all: $(ALL_TARGETS)
 375 
 376 #
 377 # This will build the directory to contain the processed manifests
 378 # and the metadata symlinks.
 379 #
 380 $(PDIR):
 381         @print "Creating $(@)"
 382         $(PKGDEBUG)$(INS.dir)
 383 
 384 #
 385 # This rule resolves dependencies across all published manifests.
 386 #
 387 # We shouldn't have to ignore the error from pkgdepend, but until
 388 # 16012 and its dependencies are resolved, pkgdepend will always exit
 389 # with an error.
 390 #
 391 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
 392         -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
 393                 print "Suppressing dependency resolution"; \
 394                 for p in $(DEP_PKGS:%.dep=%); do \
 395                         $(CP) $$p.dep $$p.res; \
 396                 done; \
 397         else \
 398                 print "Resolving dependencies"; \
 399                 pkgdepend $(PKGDEP_FLAGS) resolve \
 400                     $(PKGRES_FLAGS) $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
 401                 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
 402                         if [ "$$(print $$p.metadata.*)" = \
 403                              "$$(print $$p.metadata.noincorp.*)" ]; \
 404                         then \
 405                                 print "Removing dependency versions from $$p"; \
 406                                 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
 407                                     -O $$p.res -I transforms \
 408                                     strip_versions $$p.dep.res; \
 409                                 $(RM) $$p.dep.res; \
 410                         else \
 411                                 $(MV) $$p.dep.res $$p.res; \
 412                         fi; \
 413                 done; \
 414         fi
 415         $(PKGDEBUG)$(TOUCH) $(@)
 416 







 417 #



























 418 # rule to process real manifests
 419 #
 420 # To allow redistributability and package status to change, we must
 421 # remove not only the actual build target (the processed manifest), but
 422 # also the incidental ones (the metadata-derived symlinks).
 423 #
 424 # If pkgmogrify exits cleanly but fails to create the specified output
 425 # file, it means that it encountered an abort directive.  That means
 426 # that this package should not be published for this particular build
 427 # environment.  Since we can't prune such packages from $(PKGS)
 428 # retroactively, we need to create an empty target file to keep make
 429 # from trying to rebuild it every time.  For these empty targets, we
 430 # do not create metadata symlinks.
 431 #
 432 # Automatic dependency resolution to files is also done at this phase of
 433 # processing.  The skipped packages are skipped due to existing bugs
 434 # in pkgdepend.
 435 #
 436 # The incorporation dependency is tricky: it needs to go into all
 437 # current and renamed manifests (ie all incorporated packages), but we


 458 #   variable assignments to stdout.  Those are published to the
 459 #   .vars temporary files, and then used as input to the eval
 460 #   statement.  This is done in stages specifically so that pkgmogrify
 461 #   can signal failure if the manifest has a syntactic or other error.
 462 #   The eval statement should begin with the default values, and the
 463 #   output from pkgmogrify (if any) should be in the form of a
 464 #   variable assignment to override those defaults.
 465 #
 466 # - When this rule completes execution, it must leave an updated
 467 #   target file ($@) in place, or make will reprocess the package
 468 #   every time it encounters it as a dependency.  Hence the "touch"
 469 #   statement to ensure that the target is created, even when
 470 #   pkgmogrify encounters an abort in the publish transforms.
 471 #
 472 
 473 .SUFFIXES: .mf .mog .dep .res .pub
 474 
 475 $(PDIR)/%.mog: manifests/%.mf
 476         @print "Processing manifest $(<F)"
 477         @env PKGFMT_OUTPUT=v1 pkgfmt -c $<
 478         $(PKGDEBUG)$(RM) -r $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
 479                 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
 480         $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
 481                 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
 482                 $(<) $(PM_TRANSFORMS)
 483         $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
 484                 `$(CAT) -s $(@).vars`; \
 485         if [ -f $(@) ]; then \
 486                 if [ "$$NODEPEND" != "false" ]; then \
 487                          $(TOUCH) $(@:%.mog=%.nodepend); \
 488                 fi; \
 489                 $(LN) -s $(@F) \
 490                         $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
 491                 if [ \( "$$PKGSTAT" = "current" \) -o \
 492                      \( "$$PKGSTAT" = "renamed" \) ]; \
 493                         then print $(PKGDEP_INCORP) >> $(@); \
 494                 fi; \
 495                 print $$LICS > $(@:%.mog=%.lics); \
 496         else \
 497                 $(TOUCH) $(@) $(@:%.mog=%.lics); \
 498         fi
 499         $(PKGDEBUG)$(RM) $(@).vars
 500 
 501 $(PDIR)/%.dep: $(PDIR)/%.mog
 502         @print "Generating dependencies for $(<F)"
 503         $(PKGDEBUG)$(RM) $(@)
 504         $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
 505                 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
 506                         $(PKGROOT) > $(@); \
 507         else \
 508                 $(CP) $(<) $(@); \
 509         fi
 510 
 511 #



















 512 # rule to build the synthetic manifests
 513 #
 514 # This rule necessarily has PKGDEP_TYPE that changes according to
 515 # the specific synthetic manifest.  Rather than escape command
 516 # dependency checking for the real manifest processing, or failing to
 517 # express the (indirect) dependency of synthetic manifests on real
 518 # manifests, we simply split this rule out from the one above.
 519 #
 520 # The implementation notes from the previous rule are applicable
 521 # here, too.
 522 #
 523 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
 524         @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
 525         $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
 526         $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
 527                 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
 528                 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
 529                 $(PM_TRANSFORMS) synthetic
 530         $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
 531         if [ -f $(@) ]; then \


 649 proto_list_$(PKGMACH): $(PROC_PKGS)
 650         @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
 651 
 652 $(PROC_PKGS): $(PDIR)
 653 
 654 #
 655 # This is a convenience target to allow package names to function as
 656 # build targets.  Generally, using it is only useful when iterating on
 657 # development of a manifest.
 658 #
 659 # When processing a manifest, use the basename (without extension) of
 660 # the package.  When publishing, use the basename with a ".pub"
 661 # extension.
 662 #
 663 # Other than during manifest development, the preferred usage is to
 664 # avoid these targets and override PKGS on the make command line and
 665 # use the provided all and install targets.
 666 #
 667 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
 668 

 669 
 670 #
 671 # This is a convenience target to resolve dependencies without publishing
 672 # packages.
 673 #
 674 gendeps: $(PDIR)/gendeps
 675 
 676 #
 677 # These are convenience targets for cross-platform packaging.  If you
 678 # want to build any of "the normal" targets for a different
 679 # architecture, simply use "arch/target" as your build target.
 680 #
 681 # Since the most common use case for this is "install," the architecture
 682 # specific install targets have been further abbreviated to elide "/install."
 683 #
 684 i386/% sparc/%:
 685         $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
 686 
 687 i386 sparc: $$(@)/install
 688