generate version.c and version.h
authorJim Meyering <meyering@redhat.com>
Thu, 14 Aug 2008 19:17:27 +0000 (21:17 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 26 Aug 2008 16:45:06 +0000 (18:45 +0200)
* src/Makefile.am (version.c, version.h): New rules.  Generate.
(nodist_libver_a_SOURCES): Define
* .gitignore: Add src/version.c and src/version.h.
(DISTCLEANFILES): Add version.c and version.h.

.gitignore
src/Makefile.am
src/version.c [deleted file]
src/version.h [deleted file]

index 9190ce3..2db10a3 100644 (file)
@@ -67,5 +67,7 @@ po/POTFILES
 po/checksums
 po/coreutils.pot
 po/stamp-po
+src/version.c
+src/version.h
 stamp-h1
 tests/*/*.log
index 1d59003..1eae015 100644 (file)
@@ -70,7 +70,7 @@ CLEANFILES = $(SCRIPTS) su
 AM_CPPFLAGS = -I$(top_srcdir)/lib
 
 noinst_LIBRARIES = libver.a
-libver_a_SOURCES = version.c version.h
+nodist_libver_a_SOURCES = version.c version.h
 
 # Sometimes, the expansion of $(LIBINTL) includes -lc which may
 # include modules defining variables like `optind', so libcoreutils.a
@@ -311,6 +311,22 @@ fs.h: stat.c extract-magic
        @chmod a-w $@t
        mv $@t $@
 
+BUILT_SOURCES += version.c
+version.c: Makefile
+       rm -f $@
+       printf '#include <config.h>\n' > $@t
+       printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> $@t
+       @chmod a-w $@t
+       mv $@t $@
+
+BUILT_SOURCES += version.h
+version.h: Makefile
+       rm -f $@
+       printf 'extern char const *Version;\n' > $@t
+       @chmod a-w $@t
+       mv $@t $@
+
+DISTCLEANFILES = version.c version.h
 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
 
 # Sort in traditional ASCII order, regardless of the current locale;
diff --git a/src/version.c b/src/version.c
deleted file mode 100644 (file)
index 1187ff0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <config.h>
-char const *Version = VERSION;
diff --git a/src/version.h b/src/version.h
deleted file mode 100644 (file)
index f6a1ed3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-extern char const *Version;