forked from lutris/gens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_version.am
35 lines (33 loc) · 1.33 KB
/
git_version.am
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
# Copyright (c) 2007 Hans Ulrich Niedermann <[email protected]>
#
# This Makefile fragment is free software; the author(s) give(s)
# unlimited permission to copy, distribute and modify it.
# The stamp file which is never created ensures that git_version.h is updated
# before every build. Having git_version.h in foo_SOURCES ensures a recompile
# of foo-bar.c if it is newer than the foo-bar.o file. Using noinst_foo_SOURCES
# instead of foo_SOURCES prevents shipping git_version.h in dist tarballs,
# which may cause false GIT_FOO readings.
BUILT_SOURCES += git_version.stamp
CLEANFILES += git_version.h
GIT_VERSION_CMD = $(SHELL) $(top_srcdir)/git_version.sh
git_version.stamp:
@if test -f "$(srcdir)/git_version.h"; then \
if test -f "git_version.h"; then :; \
else \
cp "$(srcdir)/git_version.h" "git_version.h"; \
fi; \
fi
$(GIT_VERSION_CMD) -k -s $(top_srcdir) -o git_version.h
@if test -s "$(srcdir)/git_version.h"; then \
if cmp "$(srcdir)/git_version.h" "git_version.h"; then :; \
else \
echo "Error: $(srcdir)/git_version.h and git_version.h differ."; \
echo " You probably want to remove the former."; \
exit 1; \
fi; \
fi
dist-hook: git_version.stamp
if test -f "git_version.h"; then \
$(SED) -e 's|^#undef GIT_IS_DIST.*|#define GIT_IS_DIST 1|' \
"git_version.h" > "$(distdir)/git_version.h"; \
fi