[master] f435e46 Rename vcs_version.c to vcs_version.h

Tollef Fog Heen tfheen at varnish-cache.org
Mon Jun 6 12:26:06 CEST 2011


commit f435e460de6d0307e990ba8ff5a83f5173c52b55
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Mon Jun 6 12:06:04 2011 +0200

    Rename vcs_version.c to vcs_version.h
    
    Adjust build system accordingly.

diff --git a/.gitignore b/.gitignore
index 922414b..06624b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,7 +45,7 @@ TAGS
 /include/vcl_returns.h
 /include/vrt_obj.h
 /include/vrt_stv_var.h
-/lib/libvarnish/vcs_version.c
+/lib/libvarnish/vcs_version.h
 /lib/libvcl/vcc_fixed_token.c
 /lib/libvcl/vcc_obj.c
 /lib/libvcl/vcc_token_defs.h
diff --git a/lib/libvarnish/Makefile.am b/lib/libvarnish/Makefile.am
index 584a4c3..4949610 100644
--- a/lib/libvarnish/Makefile.am
+++ b/lib/libvarnish/Makefile.am
@@ -14,7 +14,7 @@ libvarnish_la_SOURCES = \
 	cli_serve.c \
 	flopen.c \
 	num.c \
-	vcs_version.c \
+	vcs_version.h \
 	time.c \
 	tcp.c \
 	vct.c \
@@ -33,11 +33,13 @@ libvarnish_la_SOURCES = \
 libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'
 libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@
 
-DISTCLEANFILES = vcs_version.c
-vcs_version.c: FORCE
+version.o: vcs_version.h
+
+DISTCLEANFILES = vcs_version.h
+vcs_version.h: FORCE
 	if [ -d "$(top_srcdir)/.git" ]; then \
 		V="$$(git describe --always)" \
-		H="$$(head -n 1 vcs_version.c 2>/dev/null || true)"; \
+		H="$$(head -n 1 vcs_version.h 2>/dev/null || true)"; \
 		if [ "/* $$V */" != "$$H" ]; then \
 		( \
 		  echo "/* $$V */" ;\
@@ -48,12 +50,8 @@ vcs_version.c: FORCE
 		  echo ' *'  ;\
 		  echo ' */' ;\
 		  echo '' ;\
-		  echo "#include <libvarnish.h>" ;\
-		  echo "const char* VCS_Version(void)" ;\
-		  echo "{" ;\
-		  echo "	return (\"$$V\");" ;\
-		  echo "}" ;\
-		) > vcs_version.c ; \
+		  echo "#define VCS_Version \"$$V\"" \
+		) > vcs_version.h ; \
 		fi \
 	fi
 FORCE:
diff --git a/lib/libvarnish/version.c b/lib/libvarnish/version.c
index 070a056..014eda4 100644
--- a/lib/libvarnish/version.c
+++ b/lib/libvarnish/version.c
@@ -34,12 +34,13 @@
 #include <stdio.h>
 
 #include "libvarnish.h"
+#include "vcs_version.h"
 
 void
 VCS_Message(const char *progname)
 {
 	fprintf(stderr, "%s (%s-%s revision %s)\n", progname,
-		PACKAGE_TARNAME, PACKAGE_VERSION, VCS_Version());
+		PACKAGE_TARNAME, PACKAGE_VERSION, VCS_Version);
 	fprintf(stderr, "Copyright (c) 2006 Verdens Gang AS\n");
 	fprintf(stderr, "Copyright (c) 2006-2011 Varnish Software AS\n");
 }
diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am
index e30c400..165a726 100644
--- a/lib/libvarnishapi/Makefile.am
+++ b/lib/libvarnishapi/Makefile.am
@@ -12,7 +12,7 @@ libvarnishapi_la_SOURCES = \
 	\
 	../libvarnish/assert.c \
 	../libvarnish/argv.c \
-	../libvarnish/vcs_version.c \
+	../libvarnish/vcs_version.h \
 	../libvarnish/version.c \
 	../libvarnish/cli_common.c \
 	../libvarnish/cli_auth.c \



More information about the varnish-commit mailing list