Blame GNUmakefile

Packit aea12f
# Having a separate GNUmakefile lets me 'include' the dynamically
Packit aea12f
# generated rules created via cfg.mk (package-local configuration)
Packit aea12f
# as well as maint.mk (generic maintainer rules).
Packit aea12f
# This makefile is used only if you run GNU Make.
Packit aea12f
# It is necessary if you want to build targets usually of interest
Packit aea12f
# only to the maintainer.
Packit aea12f
Packit Service 991b93
# Copyright (C) 2001, 2003, 2006-2020 Free Software Foundation, Inc.
Packit aea12f
Packit aea12f
# This program is free software: you can redistribute it and/or modify
Packit aea12f
# it under the terms of the GNU General Public License as published by
Packit aea12f
# the Free Software Foundation, either version 3 of the License, or
Packit aea12f
# (at your option) any later version.
Packit aea12f
Packit aea12f
# This program is distributed in the hope that it will be useful,
Packit aea12f
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit aea12f
# GNU General Public License for more details.
Packit aea12f
Packit aea12f
# You should have received a copy of the GNU General Public License
Packit aea12f
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
Packit aea12f
Packit aea12f
# If the user runs GNU make but has not yet run ./configure,
Packit aea12f
# give them a diagnostic.
Packit aea12f
_gl-Makefile := $(wildcard [M]akefile)
Packit aea12f
ifneq ($(_gl-Makefile),)
Packit aea12f
Packit aea12f
# Make tar archive easier to reproduce.
Packit aea12f
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
Packit aea12f
Packit aea12f
# Allow the user to add to this in the Makefile.
Packit aea12f
ALL_RECURSIVE_TARGETS =
Packit aea12f
Packit aea12f
include Makefile
Packit aea12f
Packit aea12f
# Some projects override e.g., _autoreconf here.
Packit aea12f
-include $(srcdir)/cfg.mk
Packit aea12f
Packit aea12f
# Allow cfg.mk to override these.
Packit aea12f
_build-aux ?= build-aux
Packit aea12f
_autoreconf ?= autoreconf -v
Packit aea12f
Packit aea12f
include $(srcdir)/maint.mk
Packit aea12f
Packit aea12f
# Ensure that $(VERSION) is up to date for dist-related targets, but not
Packit aea12f
# for others: rerunning autoreconf and recompiling everything isn't cheap.
Packit aea12f
_have-git-version-gen := \
Packit aea12f
  $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
Packit aea12f
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
Packit aea12f
  _is-dist-target ?= $(filter-out %clean, \
Packit aea12f
    $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
Packit aea12f
  _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
Packit aea12f
  ifneq (,$(_is-dist-target)$(_is-install-target))
Packit aea12f
    _curr-ver := $(shell cd $(srcdir)				\
Packit aea12f
                   && $(_build-aux)/git-version-gen		\
Packit aea12f
                         .tarball-version			\
Packit aea12f
                         $(git-version-gen-tag-sed-script))
Packit aea12f
    ifneq ($(_curr-ver),$(VERSION))
Packit aea12f
      ifeq ($(_curr-ver),UNKNOWN)
Packit aea12f
        $(info WARNING: unable to verify if $(VERSION) is the correct version)
Packit aea12f
      else
Packit aea12f
        ifneq (,$(_is-install-target))
Packit aea12f
          # GNU Coding Standards state that 'make install' should not cause
Packit aea12f
          # recompilation after 'make all'.  But as long as changing the version
Packit aea12f
          # string alters config.h, the cost of having 'make all' always have an
Packit aea12f
          # up-to-date version is prohibitive.  So, as a compromise, we merely
Packit aea12f
          # warn when installing a version string that is out of date; the user
Packit aea12f
          # should run 'autoreconf' (or something like 'make distcheck') to
Packit aea12f
          # fix the version, 'make all' to propagate it, then 'make install'.
Packit aea12f
          $(info WARNING: version string $(VERSION) is out of date;)
Packit aea12f
          $(info run '$(MAKE) _version' to fix it)
Packit aea12f
        else
Packit aea12f
          $(info INFO: running autoreconf for new version string: $(_curr-ver))
Packit aea12f
GNUmakefile: _version
Packit aea12f
	touch GNUmakefile
Packit aea12f
        endif
Packit aea12f
      endif
Packit aea12f
    endif
Packit aea12f
  endif
Packit aea12f
endif
Packit aea12f
Packit aea12f
.PHONY: _version
Packit aea12f
_version:
Packit aea12f
	cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
Packit aea12f
	$(MAKE) $(AM_MAKEFLAGS) Makefile
Packit aea12f
Packit aea12f
else
Packit aea12f
Packit aea12f
.DEFAULT_GOAL := abort-due-to-no-makefile
Packit aea12f
srcdir = .
Packit aea12f
Packit aea12f
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
Packit aea12f
-include ./cfg.mk
Packit aea12f
Packit aea12f
# Allow cfg.mk to override these.
Packit aea12f
_build-aux ?= build-aux
Packit aea12f
_autoreconf ?= autoreconf -v
Packit aea12f
Packit aea12f
include ./maint.mk
Packit aea12f
Packit aea12f
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
Packit aea12f
$(MAKECMDGOALS): abort-due-to-no-makefile
Packit aea12f
endif
Packit aea12f
Packit aea12f
abort-due-to-no-makefile:
Packit aea12f
	@echo There seems to be no Makefile in this directory.   1>&2
Packit aea12f
	@echo "You must run ./configure before running 'make'." 1>&2
Packit aea12f
	@exit 1
Packit aea12f
Packit aea12f
endif
Packit aea12f
Packit aea12f
# Tell version 3.79 and up of GNU make to not build goals in this
Packit aea12f
# directory in parallel, in case someone tries to build multiple
Packit aea12f
# targets, and one of them can cause a recursive target to be invoked.
Packit aea12f
Packit aea12f
# Only set this if Automake doesn't provide it.
Packit aea12f
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
Packit aea12f
  $(RECURSIVE_CLEAN_TARGETS:-recursive=) \
Packit aea12f
  dist distcheck tags ctags
Packit aea12f
Packit aea12f
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
Packit aea12f
Packit aea12f
ifneq ($(word 2, $(MAKECMDGOALS)), )
Packit aea12f
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
Packit aea12f
.NOTPARALLEL:
Packit aea12f
endif
Packit aea12f
endif