corrected configure test.
[gnutls.git] / GNUmakefile
blob6e00ec89e701f9496d52b045697818fae8ddb733
1 # Having a separate GNUmakefile lets me `include' the dynamically
2 # generated rules created via cfg.mk (package-local configuration)
3 # as well as maint.mk (generic maintainer rules).
4 # This makefile is used only if you run GNU Make.
5 # It is necessary if you want to build targets usually of interest
6 # only to the maintainer.
8 # Copyright (C) 2001, 2003, 2006-2011 Free Software Foundation, Inc.
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # Systems where /bin/sh is not the default shell need this. The $(shell)
24 # command below won't work with e.g. stock DOS/Windows shells.
25 ifeq ($(wildcard /bin/s[h]),/bin/sh)
26 SHELL = /bin/sh
27 else
28 # will be used only with the next shell-test line, then overwritten
29 # by a configured-in value
30 SHELL = sh
31 endif
33 # If the user runs GNU make but has not yet run ./configure,
34 # give them a diagnostic.
35 _have-Makefile := $(shell test -f Makefile && echo yes)
36 ifeq ($(_have-Makefile),yes)
38 # Make tar archive easier to reproduce.
39 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
41 # Allow the user to add to this in the Makefile.
42 ALL_RECURSIVE_TARGETS =
44 include Makefile
46 # Some projects override e.g., _autoreconf here.
47 -include $(srcdir)/cfg.mk
48 include $(srcdir)/maint.mk
50 # Allow cfg.mk to override these.
51 _build-aux ?= build-aux
52 _autoreconf ?= autoreconf -v
54 # Ensure that $(VERSION) is up to date for dist-related targets, but not
55 # for others: rerunning autoreconf and recompiling everything isn't cheap.
56 _have-git-version-gen := \
57 $(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
58 ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
59 _is-dist-target ?= $(filter-out %clean, \
60 $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
61 _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
62 ifneq (,$(_is-dist-target)$(_is-install-target))
63 _curr-ver := $(shell cd $(srcdir) \
64 && $(_build-aux)/git-version-gen \
65 .tarball-version \
66 $(git-version-gen-tag-sed-script))
67 ifneq ($(_curr-ver),$(VERSION))
68 ifeq ($(_curr-ver),UNKNOWN)
69 $(info WARNING: unable to verify if $(VERSION) is the correct version)
70 else
71 ifneq (,$(_is-install-target))
72 # GNU Coding Standards state that 'make install' should not cause
73 # recompilation after 'make all'. But as long as changing the version
74 # string alters config.h, the cost of having 'make all' always have an
75 # up-to-date version is prohibitive. So, as a compromise, we merely
76 # warn when installing a version string that is out of date; the user
77 # should run 'autoreconf' (or something like 'make distcheck') to
78 # fix the version, 'make all' to propagate it, then 'make install'.
79 $(info WARNING: version string $(VERSION) is out of date;)
80 $(info run '$(MAKE) _version' to fix it)
81 else
82 $(info INFO: running autoreconf for new version string: $(_curr-ver))
83 GNUmakefile: _version
84 touch GNUmakefile
85 endif
86 endif
87 endif
88 endif
89 endif
91 .PHONY: _version
92 _version:
93 cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
94 $(MAKE) $(AM_MAKEFLAGS) Makefile
96 else
98 .DEFAULT_GOAL := abort-due-to-no-makefile
99 srcdir = .
101 # The package can override .DEFAULT_GOAL to run actions like autoreconf.
102 -include ./cfg.mk
103 include ./maint.mk
105 ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
106 $(MAKECMDGOALS): abort-due-to-no-makefile
107 endif
109 abort-due-to-no-makefile:
110 @echo There seems to be no Makefile in this directory. 1>&2
111 @echo "You must run ./configure before running \`make'." 1>&2
112 @exit 1
114 endif
116 # Tell version 3.79 and up of GNU make to not build goals in this
117 # directory in parallel, in case someone tries to build multiple
118 # targets, and one of them can cause a recursive target to be invoked.
120 # Only set this if Automake doesn't provide it.
121 AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
122 $(RECURSIVE_CLEAN_TARGETS:-recursive=) \
123 dist distcheck tags ctags
125 ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
127 ifneq ($(word 2, $(MAKECMDGOALS)), )
128 ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
129 .NOTPARALLEL:
130 endif
131 endif