Blame GNUmakefile

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