Alexander Pyhalov
2016-07-30 86e587ad52bf9e4dc49f51a9e803a7a26cc5bf29
Revert "ips.mk / shared-macros.mk : add optional ALL_INSTALLED_STAMP so we do not call the "install" dynamic target many times"

This reverts commit 871b0337349743a1c89e768ad45547d39708ae32.
3 files modified
64 ■■■■ changed files
doc/makefile-targets.txt 20 ●●●●● patch | view | raw | blame | history
make-rules/ips.mk 25 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 19 ●●●●● patch | view | raw | blame | history
doc/makefile-targets.txt
@@ -75,26 +75,6 @@
  macro used will depend on the component and corresponds to the build target
  macro used.
$(ALL_INSTALLED_STAMP):
  This variable points to a file in the build directory that can be used by
  recipe steps which should logically follow the "install" target.  That is,
  for this file to be touched, the component's generic "install" rule must
  complete successfully.  This covers doing smaller-scoped install rules of
  the multiple sub-components, for multiple architectures and bitnesses, as
  well as custom rules sometimes attached in ultimate recipes to happen after
  a common "gmake install".  It is also logically different from the several
  $(BUILD_DIR)/*/.installed files, since those mark only the completion of
  just the "install" rule for a specific sub-component built for a specific
  architecture and installed (into component's common $(PROTO_DIR) usually).
  Rules which intend to run only after all manipulation of the PROTO_DIR has
  completed, can depend on this file (and so cause its creation) rather than
  the dynamically re-evaluated "install" rule directly -- both to save some
  compute resources and to avoid possible invalidation of previously built
  objects if the "install" rule of a particular recipe always does something
  actively changing the filesystem contents (even if just touching a file).
  In particular, the IPS packaging steps should only take place after the
  installation prototype location has stabilized, so they depend on this file.
pkglint::
  This target is an optional target is automatically defined in each Makefile
  by the inclusion of $(WS_MAKE_RULES)/prep.mk.  It will run the build steps
make-rules/ips.mk
@@ -194,15 +194,12 @@
# Do all that is needed to ensure the package is consistent for publishing,
# except actually pushing to a repo, separately from the push to the repo.
# Note that running "install" rule as a dependency for multiple targets can
# have adverse effects, so instead we call it at most once by requiring the
# touched ALL_INSTALLED_STAMP file.
pre-publish:    $(ALL_INSTALLED_STAMP) $(PRE_PUBLISH_STAMP)
pre-publish:    build install $(PRE_PUBLISH_STAMP)
publish:        pre-publish $(PUBLISH_STAMP)
sample-manifest:    $(GENERATED).p5m
$(GENERATED).p5m:    $(ALL_INSTALLED_STAMP)
$(GENERATED).p5m:    install
    [ ! -d $(SAMPLE_MANIFEST_DIR) ] && $(MKDIR) $(SAMPLE_MANIFEST_DIR) || true
    $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \
    $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \
@@ -214,7 +211,7 @@
        $(TEE) $@ $(SAMPLE_MANIFEST_FILE) >/dev/null
# copy the canonical manifest(s) to the build tree
$(MANIFEST_BASE)-%.generate:    %.p5m canonical-manifests $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.generate:    %.p5m canonical-manifests
    cat $(METADATA_TEMPLATE) $< >$@
# The text of a transform that will emit a dependency conditional on the
@@ -244,7 +241,7 @@
        $(call mkgeneric,runtime/python,$(ver)))
# Build Python version-wrapping manifests from the generic version.
$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
    $(PKGMOGRIFY) -D PYV=### $(BUILD_DIR)/mkgeneric-python \
        $(WS_TOP)/transforms/mkgeneric $< > $@
    if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
@@ -268,7 +265,7 @@
        $(call mkgeneric,runtime/perl,$(ver)))
# Build Perl version-wrapping manifests from the generic version.
$(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl
    $(PKGMOGRIFY) -D PLV=### $(BUILD_DIR)/mkgeneric-perl \
        $(WS_TOP)/transforms/mkgeneric $< > $@
    if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
@@ -290,7 +287,7 @@
        PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \
            RUBYV=$(subst .,,$(1))
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
    if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
            cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \
    fi
@@ -314,14 +311,14 @@
# Build Ruby version-wrapping manifests from the generic version.
# Creates build/manifest-*-modulename.p5m file.
#
$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
    $(PKGMOGRIFY) -D RUBYV=### $(BUILD_DIR)/mkgeneric-ruby \
            $(WS_TOP)/transforms/mkgeneric $< > $@
    if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
ifeq   ($(strip $(COMPONENT_AUTOGEN_MANIFEST)),yes)
# auto-generate file/directory list
$(MANIFEST_BASE)-%.generated:    %.p5m $(BUILD_DIR) $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.generated:    %.p5m $(BUILD_DIR)
    (cat $(METADATA_TEMPLATE); \
    $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR)) | \
    $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(AUTOGEN_MANIFEST_TRANSFORMS) | \
@@ -341,7 +338,7 @@
        sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
else
# mogrify non-parameterized manifests
$(MANIFEST_BASE)-%.mogrified:    %.p5m $(BUILD_DIR) $(ALL_INSTALLED_STAMP)
$(MANIFEST_BASE)-%.mogrified:    %.p5m $(BUILD_DIR)
    $(PKGMOGRIFY) $(PKG_OPTIONS) $< \
        $(PUBLISH_TRANSFORMS) | \
        sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
@@ -389,7 +386,7 @@
# resolve the dependencies all at once
$(BUILD_DIR)/.resolved-$(MACH):    $(DEPENDED) $(ALL_INSTALLED_STAMP)
$(BUILD_DIR)/.resolved-$(MACH):    $(DEPENDED)
    $(PKGDEPEND) resolve $(EXTDEPFILES:%=-e %) -m $(DEPENDED)
    $(TOUCH) $@
@@ -466,7 +463,7 @@
        echo "unsafe to install package(s) automatically" ; \
     fi
$(RESOLVED):    $(ALL_INSTALLED_STAMP)
$(RESOLVED):    install
canonical-manifests:    $(CANONICAL_MANIFESTS) Makefile $(PATCHES)
ifeq    ($(strip $(CANONICAL_MANIFESTS)),)
make-rules/shared-macros.mk
@@ -324,7 +324,6 @@
$(BUILD_DIR_64)/.installed:       BITS=64
# set the default target for installation of the component
# (the argument(s) to its make or equivalent build wrapper)
COMPONENT_INSTALL_TARGETS =    install
# set the default test results directory
@@ -420,24 +419,6 @@
$(BUILD_DIR_64)/.tested:        BITS=64
$(BUILD_DIR_32)/.tested-and-compared:    BITS=32
$(BUILD_DIR_64)/.tested-and-compared:    BITS=64
# The "install" target is not a good one to depend on everywhere
# after installation (e.g. during the packaging pipeline), because
# each evaluation is dynamic - both slow to process, and it can
# potentially change some files and invalidate previous steps.
# So in later stages such as packaging (see ips.mk) we call the
# "install" rule at most once by depending on ALL_INSTALLED_STAMP
# filename and leave the single timestamped file to know it is over.
# If the stamp exists, we know that the build and install rules
# (however defined and mutilated by ultimate recipes, but usually
# depending on "%/.installed" files in all sub-component per-MACH
# build directories) have passed and a PROTO_DIR has probably been
# created (although some components are known to limit themselves
# to just building code with no actual installation implementation).
ALL_INSTALLED_STAMP ?= $(BUILD_DIR)/.all-installed
$(ALL_INSTALLED_STAMP): build install
    test -d "$(PROTO_DIR)" || { echo "WARN: install completed but PROTO_DIR is missing!">&2; }
    $(TOUCH) $@
# BUILD_TOOLS is the root of all tools not normally installed on the system.
BUILD_TOOLS ?=    /opt