groff-commit
[Top][All Lists]
Advanced

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

[groff] 09/12: [libgroff]: Build more quietly and robustly.


From: G. Branden Robinson
Subject: [groff] 09/12: [libgroff]: Build more quietly and robustly.
Date: Thu, 21 Oct 2021 07:07:44 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit a8f0155a10f54f0b62a78aa631ad8741b044a439
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Thu Oct 21 20:59:48 2021 +1100

    [libgroff]: Build more quietly and robustly.
    
    * src/libs/libgroff/libgroff.am: Build more quietly and robustly.
    
      (src/libs/libgroff/version.cpp): Drop progress-reporting `echo` in
      favor of prefixing final rule command with `$(AM_V_GEN)`.  Prefix
      earlier rule commands with `$(AM_V_at)`.  Use `printf` instead of
      `echo` to build the file, and create a temporary file at first so that
      we don't race with the compiler on parallelized builds.  Drop
      nilpotent sed-transformation of a single closing brace (and newline);
      this looks like a relic of past times when we'd drop a trailing ".0"
      from the version number stored in the C symbol `Version_string`.
    
      (charset.alias, ref-del.sed, ref-add.sed): Prefix rule command
      with `$(AM_V_GEN)`.
    
    Also wrap long lines and tweak legal notice formatting.
    
    [Relic details: the sed-powered stripping appears to have gotten damaged
    in commit a23c589e4e0fbc9a22042b6771e990b2f9cc3278, 2014-08-17, when
    groff's build system was Automake-ified.  The stripping itself dates
    back over 20 years, beyond which I did not chase it.]
---
 ChangeLog                     | 16 +++++++++++++
 src/libs/libgroff/libgroff.am | 53 +++++++++++++++++++++++--------------------
 2 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 945f1e5..b6188e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2021-10-21  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * src/libs/libgroff/libgroff.am: Build more quietly and
+       robustly.
+       (src/libs/libgroff/version.cpp): Drop progress-reporting `echo`
+       in favor of prefixing final rule command with `$(AM_V_GEN)`.
+       Prefix earlier rule commands with `$(AM_V_at)`.  Use `printf`
+       instead of `echo` to build the file, and create a temporary file
+       at first so that we don't race with the compiler on parallelized
+       builds.  Drop nilpotent sed-transformation of a single closing
+       brace (and newline); this looks like a relic of past times when
+       we'd drop a trailing ".0" from the version number stored in the
+       C symbol `Version_string`.
+       (charset.alias, ref-del.sed, ref-add.sed): Prefix rule command
+       with `$(AM_V_GEN)`.
+
+2021-10-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        * src/devices/xditview/xditview.am: Build more quietly.
        (src/devices/xditview/GXditview-ad.h): Drop progress-reporting
        `echo` in favor of prefixing rule command with `$(AM_V_GEN)`.
diff --git a/src/libs/libgroff/libgroff.am b/src/libs/libgroff/libgroff.am
index c9f5c20..bd6c7d8 100644
--- a/src/libs/libgroff/libgroff.am
+++ b/src/libs/libgroff/libgroff.am
@@ -4,11 +4,11 @@
 #
 # groff is free software; you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free
-# Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
 #
-# groff is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 # for more details.
 #
@@ -97,20 +97,22 @@ CLEANFILES += \
   ref-add.sed \
   ref-del.sed
 
-# .o files have a 'libgroff_a-' prefix because we set libgroff_a_CPPFLAGS
+# .o files have a 'libgroff_a-' prefix because we set
+# libgroff_a_CPPFLAGS.
 src/libs/libgroff/libgroff_a-device.$(OBJEXT): defs.h
 src/libs/libgroff/libgroff_a-fontfile.$(OBJEXT): defs.h
 src/libs/libgroff/libgroff_a-macropath.$(OBJEXT): defs.h
 src/libs/libgroff/libgroff_a-relocate.$(OBJEXT): defs.h
 
 src/libs/libgroff/version.cpp: $(top_srcdir)/.version
-       @echo Making version.cpp
-       @echo const char \*version_string = 
\"$(MAJOR_VERSION).$(MINOR_VERSION)\"\; >$@
-       @echo const char \*revision_string = \"$(REVISION)\"\; >>$@
-       @echo extern \"C\" { >>$@
-       @echo const char \*Version_string = \"$(VERSION)\"\; >>$@
-       @echo } >>$@ \
-         | sed -e 's/\.0\"/\"/' >>$@
+       $(AM_V_at)printf 'const char *version_string = "%s.%s";\n' \
+         $(MAJOR_VERSION) $(MINOR_VERSION) > $@.tmp
+       $(AM_V_at)printf 'const char *revision_string = "%s";\n' \
+         $(REVISION) >> $@.tmp
+       $(AM_V_at)printf \
+         'extern "C" {\nconst char *Version_string = "%s";\n}\n' \
+         $(VERSION) >> $@.tmp
+       $(AM_V_GEN)mv $@.tmp $@
 
 # Data for localcharset.c.  Taken from libiconv/libcharset.
 
@@ -119,18 +121,21 @@ LIBGROFF_PACKAGE = groff
 all: charset.alias ref-add.sed ref-del.sed
 
 charset.alias: $(libgroff_srcdir)/config.charset
-       $(SHELL) $(libgroff_srcdir)/config.charset '$(HOST)' > t-$@
-       mv t-$@ $@
-
-ref-add.sed : $(libgroff_srcdir)/ref-add.sin
-       sed -e '/^#/d' \
-           -e 's/@''PACKAGE''@/$(LIBGROFF_PACKAGE)/g' 
$(libgroff_srcdir)/ref-add.sin > t-$@
-       mv t-$@ $@
-
-ref-del.sed : $(libgroff_srcdir)/ref-del.sin
-       sed -e '/^#/d' \
-           -e 's/@''PACKAGE''@/$(LIBGROFF_PACKAGE)/g' 
$(libgroff_srcdir)/ref-del.sin > t-$@
-       mv t-$@ $@
+       $(AM_V_GEN)$(SHELL) $(libgroff_srcdir)/config.charset \
+           '$(HOST)' > t-$@ \
+         && mv t-$@ $@
+
+ref-add.sed: $(libgroff_srcdir)/ref-add.sin
+       $(AM_V_GEN)sed -e '/^#/d' \
+           -e 's/@''PACKAGE''@/$(LIBGROFF_PACKAGE)/g' \
+           $(libgroff_srcdir)/ref-add.sin > t-$@ \
+         && mv t-$@ $@
+
+ref-del.sed: $(libgroff_srcdir)/ref-del.sin
+       $(AM_V_GEN)sed -e '/^#/d' \
+           -e 's/@''PACKAGE''@/$(LIBGROFF_PACKAGE)/g' \
+           $(libgroff_srcdir)/ref-del.sin > t-$@ \
+         && mv t-$@ $@
 
 install-data-local: install_charset_data
 install_charset_data:



reply via email to

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