emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b6af279: Simplify lib-src version printing


From: Paul Eggert
Subject: [Emacs-diffs] master b6af279: Simplify lib-src version printing
Date: Thu, 20 Jun 2019 11:57:31 -0400 (EDT)

branch: master
commit b6af27927c2f06c5a091fbc1b04e819a70e0e2a2
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Simplify lib-src version printing
    
    * lib-src/Makefile.in (etags_cflags): Remove.
    All uses replaced by a simple ‘-o $@’.
    (ebrowse${EXEEXT}, emacsclient${EXEEXT}, emacsclientw${EXEEXT}):
    Omit -DVERSION= option.
    * lib-src/ebrowse.c (VERSION):
    * lib-src/emacsclient.c (VERSION):
    * lib-src/etags.c (EMACS_NAME, VERSION): Remove.
    All uses replaced by PACKAGE_NAME and PACKAGE_VERSION.
    * lib-src/ebrowse.c (version):
    * lib-src/etags.c (print_version):
    Use fputs to output the version info, since that’s fputs_unlocked.
    * lib-src/etags.c (PROGRAM_NAME): New macro.
    (print_version): Use it.
---
 lib-src/Makefile.in   | 12 +++++-------
 lib-src/ebrowse.c     | 16 +++++-----------
 lib-src/emacsclient.c |  6 +-----
 lib-src/etags.c       | 19 ++++++++-----------
 4 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 4022217..9cb733d 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -362,23 +362,21 @@ TAGS: etags${EXEEXT} ${tagsfiles}
        $(MAKE) -C ../lib all
 
 etags_deps = ${srcdir}/etags.c $(NTLIB) $(config_h)
-etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
 etags_libs = $(NTLIB) $(LOADLIBES)
 
 etags${EXEEXT}: ${etags_deps}
-       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
+       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
 
 ## ctags.c is distinct from etags.c so that parallel makes do not write two
 ## etags.o files on top of each other.
 ## FIXME?
 ## Can't we use a wrapper that calls 'etags --ctags'?
 ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
-       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
+       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(etags_libs)
 
 ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
                    $(config_h)
-       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
-         $< $(NTLIB) $(LOADLIBES) -o $@
+       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -o $@ $< $(NTLIB) $(LOADLIBES)
 
 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
@@ -395,12 +393,12 @@ pop.o: ${srcdir}/pop.c ${srcdir}/pop.h 
${srcdir}/../lib/min-max.h $(config_h)
 
 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
-          -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) \
+          $(NTLIB) $(LOADLIBES) \
           $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
 
 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) 
$(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
-          -DVERSION="\"${version}\"" $(LOADLIBES) \
+          $(LOADLIBES) \
           $(LIB_WSOCK32) $(LIB_EACCESS) $(LIBS_ECLIENT) -o $@
 
 NTINC = ${srcdir}/../nt/inc
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 938b405..aaa0893 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -3573,21 +3573,15 @@ usage (int error)
 }
 
 
-/* Display version and copyright info.  The VERSION macro is set
-   from config.h and contains the Emacs version.  */
-
-#ifndef VERSION
-# define VERSION "21"
-#endif
+/* Display version and copyright info.  */
 
 static _Noreturn void
 version (void)
 {
-  char emacs_copyright[] = COPYRIGHT;
-
-  printf ("ebrowse %s\n", VERSION);
-  puts (emacs_copyright);
-  puts ("This program is distributed under the same terms as Emacs.");
+  fputs (("ebrowse " PACKAGE_VERSION "\n"
+         COPYRIGHT "\n"
+         "This program is distributed under the same terms as Emacs.\n"),
+        stdout);
   exit (EXIT_SUCCESS);
 }
 
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index fd56007..4da532b 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -84,10 +84,6 @@ char *w32_getenv (const char *);
 #include <min-max.h>
 #include <unlocked-io.h>
 
-#ifndef VERSION
-#define VERSION "unspecified"
-#endif
-
 /* Work around GCC bug 88251.  */
 #if GNUC_PREREQ (7, 0, 0)
 # pragma GCC diagnostic ignored "-Wformat-truncation=2"
@@ -546,7 +542,7 @@ decode_options (int argc, char **argv)
          break;
 
        case 'V':
-         message (false, "emacsclient %s\n", VERSION);
+         message (false, "emacsclient %s\n", PACKAGE_VERSION);
          exit (EXIT_SUCCESS);
          break;
 
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 6bd04d1..d2395ce 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -867,21 +867,18 @@ For detailed help on a given language use, for example,\n\
 etags --help --lang=ada.");
 }
 
-#ifndef EMACS_NAME
-# define EMACS_NAME "standalone"
-#endif
-#ifndef VERSION
-# define VERSION "17.38.1.4"
+#if CTAGS
+# define PROGRAM_NAME "ctags"
+#else
+# define PROGRAM_NAME "etags"
 #endif
 static _Noreturn void
 print_version (void)
 {
-  char emacs_copyright[] = COPYRIGHT;
-
-  printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
-  puts (emacs_copyright);
-  puts ("This program is distributed under the terms in ETAGS.README");
-
+  fputs ((PROGRAM_NAME " (" PACKAGE_NAME " " PACKAGE_VERSION ")\n"
+         COPYRIGHT "\n"
+         "This program is distributed under the terms in ETAGS.README\n"),
+        stdout);
   exit (EXIT_SUCCESS);
 }
 



reply via email to

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