Commit cf784443 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Rename svn_version.c to vcs_version.c, simplify generation

Fix up the generation of vcs_version.c with the assumption that if you
have a .git directory at the top, you have git installed.  Drop logic
for handling svn checkouts.
parent ef058a0c
......@@ -100,7 +100,7 @@ void varnish_version(const char *);
int vtmpfile(char *);
char *vreadfile(const char *pfx, const char *fn);
const char* svn_version(void);
const char* vcs_version(void);
/* Safe printf into a fixed-size buffer */
#define bprintf(buf, fmt, ...) \
......
# $Id$
INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@
lib_LTLIBRARIES = libvarnish.la
......@@ -16,7 +14,7 @@ libvarnish_la_SOURCES = \
cli_serve.c \
flopen.c \
num.c \
svn_version.c \
vcs_version.c \
time.c \
tcp.c \
vct.c \
......@@ -35,12 +33,12 @@ libvarnish_la_SOURCES = \
libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'
libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@
DISTCLEANFILES = svn_version.c
svn_version.c: FORCE
V="$$(sh -c "git log -n 1 --pretty=format:%h" 2>/dev/null || LANG=C svnversion -n $(top_srcdir))" \
H="$$(head -n 1 svn_version.c 2>/dev/null || true)"; \
[ "$$V" = "exported" ] && [ -e svn_version.c ] && exit 0 ; \
if [ "/* $$V */" != "$$H" ]; then \
DISTCLEANFILES = vcs_version.c
vcs_version.c: FORCE
if [ -d "$(top_srcdir)/.git" ]; then \
V="$$(git describe --always)" \
H="$$(head -n 1 vcs_version.c 2>/dev/null || true)"; \
if [ "/* $$V */" != "$$H" ]; then \
( \
echo "/* $$V */" ;\
echo '/*' ;\
......@@ -51,12 +49,13 @@ svn_version.c: FORCE
echo ' */' ;\
echo '' ;\
echo "#include <libvarnish.h>" ;\
echo "const char* svn_version(void)" ;\
echo "const char* vcs_version(void)" ;\
echo "{" ;\
echo " const char* SVN_Version = \"$$V\";" ;\
echo " return SVN_Version;" ;\
echo " const char* VCS_Version = \"$$V\";" ;\
echo " return VCS_Version;" ;\
echo "}" ;\
) > svn_version.c ; \
) > vcs_version.c ; \
fi \
fi
FORCE:
......
......@@ -41,8 +41,8 @@ SVNID("$Id$")
void
varnish_version(const char *progname)
{
fprintf(stderr, "%s (%s-%s SVN %s)\n", progname,
PACKAGE_TARNAME, PACKAGE_VERSION, svn_version());
fprintf(stderr, "%s (%s-%s revision %s)\n", progname,
PACKAGE_TARNAME, PACKAGE_VERSION, vcs_version());
fprintf(stderr,
"Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS\n");
}
......@@ -12,7 +12,7 @@ libvarnishapi_la_SOURCES = \
\
../libvarnish/assert.c \
../libvarnish/argv.c \
../libvarnish/svn_version.c \
../libvarnish/vcs_version.c \
../libvarnish/version.c \
../libvarnish/vin.c \
../libvarnish/vmb.c \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment