Blame GNUmakefile

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