bug-gnulib
[Top][All Lists]
Advanced

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

Re: add license to link-warning.h


From: Bruno Haible
Subject: Re: add license to link-warning.h
Date: Thu, 10 Dec 2009 12:37:21 +0100
User-agent: KMail/1.9.9

Eric Blake wrote:
> > Plus a useless use of cat, for a total of 3 processes?  Come on, we can do
> > better than that.

In Makefile rules that are executed exactly once per build, I focus on 
correctness
and maintainability, not on optimization.

> > sed -n '/GL_LINK_WARNING/,$$ p' $(top_srcdir)/build-aux/link-warning.h > 
> > address@hidden

I was betting that the file's body changes more frequently than the copyright
notice. You are betting that the copyright notice changes more frequently.
Let's see...

> +       sed -n '/GL_LINK_WARNING/,$$p' \
> +         $(top_srcdir)/build-aux/link-warning.h > address@hidden && \

Well, as a matter of readability, I use a '-e' (or '-f') option in every 'sed'
invocation. And also because often one needs to augment an existing invocation.
More than once I changed something like
   sed s/^/--/
to
   sed s/^/--/ -e 's/$/ /'
and got an error message.


2009-12-09  Bruno Haible  <address@hidden>

        Use sed with option -e.
        * gnulib-tool (func_version, func_emit_copyright_notice,
        func_emit_initmacro_end, func_import, func_create_testdir): Pass
        option -e to sed.
        * modules/link-warning (Makefile.am): Likewise.

--- gnulib-tool.orig    2009-12-10 12:17:09.000000000 +0100
+++ gnulib-tool 2009-12-10 12:16:48.000000000 +0100
@@ -252,7 +252,7 @@
     fi
     version=
   fi
-  year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'`
+  year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed -e 's,^.* 
,,'`
   echo "\
 gnulib-tool (GNU $package $date)$version
 Copyright (C) $year Free Software Foundation, Inc.
@@ -267,10 +267,10 @@
 # outputs to stdout a header for a generated file.
 func_emit_copyright_notice ()
 {
-  sed -n '/Copyright/ {
-            p
-            q
-          }' < "$self_abspathname"
+  sed -n -e '/Copyright/ {
+               p
+               q
+             }' < "$self_abspathname"
   echo "#"
   echo "# This file is free software, distributed under the terms of the GNU"
   echo "# General Public License.  As a special exception to the GNU General"
@@ -1177,7 +1177,7 @@
     if test -n "$prereqs"; then
       autoconf_minversion=`
         for version in $prereqs; do echo $version; done |
-        LC_ALL=C sort -nru | sed 1q
+        LC_ALL=C sort -nru | sed -e 1q
       `
     fi
   fi
@@ -2433,7 +2433,7 @@
   echo "    if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
   echo "      # Remove the extension."
   echo "      sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
-  echo "      for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo 
\"\$i\"; done | sed \"\$sed_drop_objext\" | sort | uniq\`; do"
+  echo "      for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo 
\"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
   echo "        ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs 
\$i.\$ac_objext\""
   echo "        
${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs \$i.lo\""
   echo "      done"
@@ -3399,7 +3399,7 @@
     esac
     echo "gl_LOCAL_DIR([$relative_local_gnulib_dir])"
     echo "gl_MODULES(["
-    echo "$specified_modules" | sed 's/^/  /g'
+    echo "$specified_modules" | sed -e 's/^/  /g'
     echo "])"
     test -z "$incobsolete" || echo "gl_WITH_OBSOLETE"
     echo "gl_AVOID([$avoidlist])"
@@ -3524,7 +3524,7 @@
                 -e "$sed_replace_build_aux"
         if test "$module" = 'alloca' && test "$libtool" = true; then
           echo 'changequote(,)dnl'
-          echo 'LTALLOCA=`echo "$ALLOCA" | sed '"'"'s/\.[^.]* /.lo 
/g;s/\.[^.]*$/.lo/'"'"'`'
+          echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo 
/g;s/\.[^.]*$/.lo/'"'"'`'
           echo 'changequote([, ])dnl'
           echo 'AC_SUBST([LTALLOCA])'
         fi
@@ -4001,7 +4001,7 @@
     test -d "$testdir/$testsbase" || mkdir "$testdir/$testsbase"
     # Viewed from the $testsbase subdirectory, $auxdir is different.
     saved_auxdir="$auxdir"
-    auxdir=`echo "$testsbase/"|sed 's%[^/][^/]*//*%../%g'`"$auxdir"
+    auxdir=`echo "$testsbase/" | sed -e 's%[^/][^/]*//*%../%g'`"$auxdir"
     # Create $testsbase/Makefile.am.
     use_libtests=false
     destfile="$testsbase/Makefile.am"
@@ -4471,7 +4471,7 @@
       m4dirs=
       m4dirs_count=0
       if test -f "$destdir"/Makefile.am; then
-        aclocal_amflags=`sed -n 's/^ACLOCAL_AMFLAGS[    ]*=\(.*\)$/\1/p' 
"$destdir"/Makefile.am`
+        aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[         
]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
         m4dir_is_next=
         for arg in $aclocal_amflags; do
           if test -n "$m4dir_is_next"; then
--- modules/link-warning.orig   2009-12-10 12:17:09.000000000 +0100
+++ modules/link-warning        2009-12-10 12:10:31.000000000 +0100
@@ -14,8 +14,9 @@
 # build-aux/link-warning.h, except that it has the copyright header cut off.
 link-warning.h: $(top_srcdir)/build-aux/link-warning.h
        $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n '/GL_LINK_WARNING/,$$p' \
-         $(top_srcdir)/build-aux/link-warning.h > address@hidden && \
+       sed -n -e '/GL_LINK_WARNING/,$$p' \
+         < $(top_srcdir)/build-aux/link-warning.h \
+         > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += link-warning.h link-warning.h-t
 




reply via email to

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