bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] use new global, "Version", rather than macro, VERSION


From: Jim Meyering
Subject: [PATCH] use new global, "Version", rather than macro, VERSION
Date: Thu, 28 Aug 2008 13:54:06 +0200

This change makes ccache (http://ccache.samba.org/) more useful in
that cached .o files from one build are usually still useful after a
version number change.  Before, due to the use of VERSION, the old .o
files would be useless and just pollute the cache.

This first patch uses version-controlled files named
src/version.[ch].  The second change-set makes it so they
are generated, and hence not version-controlled.

Comments or suggested improvements welcome.



>From 0c1fc1c715aa18605eb11c6c25867277824e8f8d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 13 Aug 2008 22:30:14 +0200
Subject: [PATCH] use new global, "Version", rather than macro, VERSION

With this change, a version-string update no longer
forces recompilation of 100+ src/*.o files.
* src/version.c (Version): New global.  New file.
* src/version.h: Declare it.
* src/Makefile.am: Put it in a library that everyone links to.
(noinst_LIBRARIES, libver_a_SOURCES): Define.
(LDADD): Add libver.a.
(sc_tight_scope): Use perl (was sed), and a more relaxed regexp
to build the global-variable-name-recognizing regexp list.
* src/system.h: Include "version.h".
(case_GETOPT_VERSION_CHAR): Use Version rather than VERSION.
* src/basename.c (main): Use Version rather than VERSION.
* src/chroot.c (main): Likewise.
* src/cksum.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/dirname.c (main): Likewise.
* src/echo.c (main): Likewise.
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/link.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/nice.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/printenv.c (main): Likewise.
* src/printf.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/sleep.c (main): Likewise.
* src/sync.c (main): Likewise.
* src/test.c (main): Likewise.
* src/timeout.c (main): Likewise.
* src/true.c (main): Likewise.
* src/tsort.c (main): Likewise.
* src/unlink.c (main): Likewise.
* src/uptime.c (main): Likewise.
* src/users.c (main): Likewise.
* src/whoami.c (main): Likewise.
* src/yes.c (main): Likewise.
---
 src/Makefile.am |    9 ++++++---
 src/basename.c  |    2 +-
 src/chroot.c    |    2 +-
 src/cksum.c     |    2 +-
 src/dd.c        |    2 +-
 src/dirname.c   |    2 +-
 src/echo.c      |    2 +-
 src/hostid.c    |    2 +-
 src/hostname.c  |    2 +-
 src/link.c      |    2 +-
 src/logname.c   |    2 +-
 src/nice.c      |    2 +-
 src/nohup.c     |    2 +-
 src/printenv.c  |    2 +-
 src/printf.c    |    2 +-
 src/pwd.c       |    2 +-
 src/setuidgid.c |    2 +-
 src/sleep.c     |    2 +-
 src/sync.c      |    2 +-
 src/system.h    |    3 ++-
 src/test.c      |    2 +-
 src/timeout.c   |    2 +-
 src/true.c      |    2 +-
 src/tsort.c     |    2 +-
 src/unlink.c    |    2 +-
 src/uptime.c    |    2 +-
 src/users.c     |    2 +-
 src/version.c   |    2 ++
 src/version.h   |    1 +
 src/whoami.c    |    2 +-
 src/yes.c       |    2 +-
 31 files changed, 38 insertions(+), 31 deletions(-)
 create mode 100644 src/version.c
 create mode 100644 src/version.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 359d18e..1d59003 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,12 +69,15 @@ CLEANFILES = $(SCRIPTS) su

 AM_CPPFLAGS = -I$(top_srcdir)/lib

+noinst_LIBRARIES = libver.a
+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
 # must precede $(LIBINTL) in order to ensure we use GNU getopt.
 # But libcoreutils.a must also follow $(LIBINTL), since libintl uses
 # replacement functions defined in libcoreutils.a.
-LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a
+LDADD = libver.a ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a

 cat_LDADD = $(LDADD)
 df_LDADD = $(LDADD)
@@ -435,8 +438,8 @@ sc_tight_scope: $(all_programs)
          { echo 'the above functions should have static scope' 1>&2;   \
            exit 1; } || : ;                                            \
        ( printf '^program_name$$\n';                                   \
-         sed -n 's/^extern int \([^ ][^ ]*\);$$/^\1$$/p'               \
-           $(noinst_HEADERS) ) > $$t;                                  \
+         perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"'       \
+           *.h ) > $$t;                                                \
        nm -e *.$(OBJEXT)                                               \
            | sed -n 's/.* [BD] //p'                                    \
            | grep -Ev -f $$t &&                                        \
diff --git a/src/basename.c b/src/basename.c
index 69b708f..ac2e01e 100644
--- a/src/basename.c
+++ b/src/basename.c
@@ -103,7 +103,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/chroot.c b/src/chroot.c
index d55db6e..299acbc 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -71,7 +71,7 @@ main (int argc, char **argv)
   initialize_exit_failure (EXIT_FAILURE);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/cksum.c b/src/cksum.c
index a2d49c5..8bbed37 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -287,7 +287,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/dd.c b/src/dd.c
index d32cd94..f598e44 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1739,7 +1739,7 @@ main (int argc, char **argv)

   page_size = getpagesize ();

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
                      usage, AUTHORS, (char const *) NULL);
   close_stdout_required = false;

diff --git a/src/dirname.c b/src/dirname.c
index 3a31912..1092643 100644
--- a/src/dirname.c
+++ b/src/dirname.c
@@ -82,7 +82,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/echo.c b/src/echo.c
index 8a6466e..d549cda 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -122,7 +122,7 @@ main (int argc, char **argv)
   atexit (close_stdout);

   if (allow_options)
-    parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+    parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                        usage, AUTHORS, (char const *) NULL);

   --argc;
diff --git a/src/hostid.c b/src/hostid.c
index dbcb98d..f3cabc4 100644
--- a/src/hostid.c
+++ b/src/hostid.c
@@ -68,7 +68,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/hostname.c b/src/hostname.c
index cf8e953..b325c27 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -85,7 +85,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/link.c b/src/link.c
index 1b09fe3..d155291 100644
--- a/src/link.c
+++ b/src/link.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/logname.c b/src/logname.c
index a71ac33..9cf0d9f 100644
--- a/src/logname.c
+++ b/src/logname.c
@@ -62,7 +62,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/nice.c b/src/nice.c
index 13033ec..ee8cc86 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -104,7 +104,7 @@ main (int argc, char **argv)
   initialize_exit_failure (EXIT_FAILURE);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);

   for (i = 1; i < argc; /* empty */)
diff --git a/src/nohup.c b/src/nohup.c
index 61f181d..3ff22ea 100644
--- a/src/nohup.c
+++ b/src/nohup.c
@@ -95,7 +95,7 @@ main (int argc, char **argv)
   initialize_exit_failure (NOHUP_FAILURE);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (NOHUP_FAILURE);
diff --git a/src/printenv.c b/src/printenv.c
index ecb6593..3033fd4 100644
--- a/src/printenv.c
+++ b/src/printenv.c
@@ -88,7 +88,7 @@ main (int argc, char **argv)
   initialize_exit_failure (PRINTENV_FAILURE);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (PRINTENV_FAILURE);
diff --git a/src/printf.c b/src/printf.c
index a9d5aa1..c509951 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -645,7 +645,7 @@ main (int argc, char **argv)

   posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);

   /* The above handles --help and --version.
diff --git a/src/pwd.c b/src/pwd.c
index 5038065..3c7b4fc 100644
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -293,7 +293,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/setuidgid.c b/src/setuidgid.c
index e910357..057002c 100644
--- a/src/setuidgid.c
+++ b/src/setuidgid.c
@@ -90,7 +90,7 @@ main (int argc, char **argv)
   initialize_exit_failure (SETUIDGID_FAILURE);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                       usage, AUTHORS, (char const *) NULL);
   {
     int c;
diff --git a/src/sleep.c b/src/sleep.c
index 4176977..0c11b8e 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -111,7 +111,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/sync.c b/src/sync.c
index 96dcf09..fccc6fb 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -61,7 +61,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/system.h b/src/system.h
index 4b8e58e..e88b1bb 100644
--- a/src/system.h
+++ b/src/system.h
@@ -115,6 +115,7 @@ you must include <sys/types.h> before including this file

 #include <stdbool.h>
 #include <stdlib.h>
+#include "version.h"

 /* Exit statuses for programs like 'env' that exec other programs.  */
 enum
@@ -466,7 +467,7 @@ enum

 #define case_GETOPT_VERSION_CHAR(Program_name, Authors)                        
\
   case GETOPT_VERSION_CHAR:                                            \
-    version_etc (stdout, Program_name, PACKAGE_NAME, VERSION, Authors, \
+    version_etc (stdout, Program_name, PACKAGE_NAME, Version, Authors, \
                  (char *) NULL);                                       \
     exit (EXIT_SUCCESS);                                               \
     break;
diff --git a/src/test.c b/src/test.c
index 833b254..1fe7da0 100644
--- a/src/test.c
+++ b/src/test.c
@@ -826,7 +826,7 @@ main (int margc, char **margv)
         to exit silently with status 0.  */
       if (margc < 2 || !STREQ (margv[margc - 1], "]"))
        {
-         parse_long_options (margc, margv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+         parse_long_options (margc, margv, PROGRAM_NAME, PACKAGE_NAME, Version,
                              usage, AUTHORS, (char const *) NULL);
          test_syntax_error (_("missing `]'"), NULL);
        }
diff --git a/src/timeout.c b/src/timeout.c
index 8449607..37bed3c 100644
--- a/src/timeout.c
+++ b/src/timeout.c
@@ -232,7 +232,7 @@ main (int argc, char **argv)
   initialize_exit_failure (EXIT_CANCELED);
   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                       usage, AUTHORS, (char const *) NULL);

   while ((c = getopt_long (argc, argv, "+s:", long_options, NULL)) != -1)
diff --git a/src/true.c b/src/true.c
index 12100bd..80940f0 100644
--- a/src/true.c
+++ b/src/true.c
@@ -70,7 +70,7 @@ main (int argc, char **argv)
        usage (EXIT_STATUS);

       if (STREQ (argv[1], "--version"))
-       version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, VERSION, AUTHORS,
+       version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,
                     (char *) NULL);
     }

diff --git a/src/tsort.c b/src/tsort.c
index 703b855..76865b9 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -538,7 +538,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/unlink.c b/src/unlink.c
index 36595c8..1b999d1 100644
--- a/src/unlink.c
+++ b/src/unlink.c
@@ -66,7 +66,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/uptime.c b/src/uptime.c
index b35e97a..a5c4fe5 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -230,7 +230,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/users.c b/src/users.c
index 19ffce8..c10dac6 100644
--- a/src/users.c
+++ b/src/users.c
@@ -128,7 +128,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/version.c b/src/version.c
new file mode 100644
index 0000000..1187ff0
--- /dev/null
+++ b/src/version.c
@@ -0,0 +1,2 @@
+#include <config.h>
+char const *Version = VERSION;
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 0000000..f6a1ed3
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1 @@
+extern char const *Version;
diff --git a/src/whoami.c b/src/whoami.c
index c3b709b..75bb9a6 100644
--- a/src/whoami.c
+++ b/src/whoami.c
@@ -70,7 +70,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
diff --git a/src/yes.c b/src/yes.c
index d72c5da..e2a5844 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -67,7 +67,7 @@ main (int argc, char **argv)

   atexit (close_stdout);

-  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
+  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
                      usage, AUTHORS, (char const *) NULL);
   if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
     usage (EXIT_FAILURE);
--
1.6.0.1.126.ga118


>From 5bf3e7ee96a0952e3b439e31ee6efa055fef897f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 14 Aug 2008 21:17:27 +0200
Subject: [PATCH] generate version.c and version.h

* 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      |    2 ++
 src/Makefile.am |   18 +++++++++++++++++-
 src/version.c   |    2 --
 src/version.h   |    1 -
 4 files changed, 19 insertions(+), 4 deletions(-)
 delete mode 100644 src/version.c
 delete mode 100644 src/version.h

diff --git a/.gitignore b/.gitignore
index 9190ce3..2db10a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,5 +67,7 @@ po/POTFILES
 po/checksums
 po/coreutils.pot
 po/stamp-po
+src/version.c
+src/version.h
 stamp-h1
 tests/*/*.log
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d59003..1eae015 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 address@hidden
        mv address@hidden $@

+BUILT_SOURCES += version.c
+version.c: Makefile
+       rm -f $@
+       printf '#include <config.h>\n' > address@hidden
+       printf 'char const *Version = "$(PACKAGE_VERSION)";\n' >> address@hidden
+       @chmod a-w address@hidden
+       mv address@hidden $@
+
+BUILT_SOURCES += version.h
+version.h: Makefile
+       rm -f $@
+       printf 'extern char const *Version;\n' > address@hidden
+       @chmod a-w address@hidden
+       mv address@hidden $@
+
+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
index 1187ff0..0000000
--- a/src/version.c
+++ /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
index f6a1ed3..0000000
--- a/src/version.h
+++ /dev/null
@@ -1 +0,0 @@
-extern char const *Version;
--
1.6.0.1.126.ga118




reply via email to

[Prev in Thread] Current Thread [Next in Thread]