Blame GNUmakefile

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