Blame GNUmakefile

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