-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-version-gen.mk
70 lines (61 loc) · 2.57 KB
/
git-version-gen.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*-Automake-*-
# Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA.
# This file is part of the roboptim.
#
# roboptim is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Additional permission under section 7 of the GNU General Public
# License, version 3 ("GPLv3"):
#
# If you convey this file as part of a work that contains a
# configuration script generated by Autoconf, you may do so under
# terms of your choice.
#
# roboptim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with roboptim. If not, see <http://www.gnu.org/licenses/>.
EXTRA_DIST += \
$(top_srcdir)/build-aux/git-version-gen
# Update version files when needed.
BUILT_SOURCES = $(top_srcdir)/.version
CURRENT_VERSION = \
`cd $(srcdir) && ./build-aux/git-version-gen .tarball-version`
# Do not generate .version in distributed tarball.
$(top_srcdir)/.version:
if ! test -f $(top_srcdir)/.tarball-version; then \
echo $(VERSION) > $@-t && mv $@-t $@; \
fi
# Make sure one is not installing the software if the version string
# is out-of-date. As the GNU coding standards states that ``make install''
# should not cause recompilation, the rule just prevent the install from
# being done but do not regenerate the version string automatically.
.PHONY: check-version
check-version:
@if ! test x$(CURRENT_VERSION) = x$(VERSION); then \
echo "WARNING: Version string is out of date."; \
echo " please run \`\`make _version'' and reinstall."; \
exit 42; \
fi
#FIXME: this is too annoying, disable for now.
#install-exec-hook: check-version
#install-data-hook: check-version
# Check that the version is up-to-date or regenerate if required.
# Then, generate .tarball-version file to bundle the tarball with a
# valid version number even if git directory is not available.
dist-hook:
@if ! test x$(CURRENT_VERSION) = x$(VERSION); then \
echo "Version string is out of date, regenerating."; \
$(MAKE) $(AM_MAKEFLAGS) _version; \
fi; \
echo $(VERSION) > $(distdir)/.tarball-version
# Regenerate version string.
.PHONY: _version
_version:
cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf