bug-gnulib
[Top][All Lists]
Advanced

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

Re: maintainer-makefile: catch uses of $< in non-implicit rules


From: Bernhard Voelker
Subject: Re: maintainer-makefile: catch uses of $< in non-implicit rules
Date: Fri, 19 Jul 2019 09:30:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Hi Akim,

On 5/18/19 11:51 AM, Akim Demaille wrote:
> commit 2e801e81bb362429d0e252d076233bfdac20e367
> Author: Akim Demaille <address@hidden>
> Date:   Sat May 18 08:46:00 2019 +0200
> 
>     maintainer-makefile: catch uses of $< in non-implicit rules
>     
>     * top/maint.mk (sc_prohibit_magic_number_exit): New.

Wrong sc rule - it should have been this:

     * top/maint.mk (sc_prohibit_gnu_make_extensions_awk_): New.
     (sc_prohibit_gnu_make_extensions): New.

Do we fix the ChangeLog in cases like this?

Thanks & have a nice day,
Berny

> 
> diff --git a/ChangeLog b/ChangeLog
> index 1918041f0..8d5a4ca6e 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-05-18  Akim Demaille  <address@hidden>
> +
> +     maintainer-makefile: catch uses of $< in non-implicit rules
> +     * top/maint.mk (sc_prohibit_magic_number_exit): New.
> +
>  2019-05-14  Paul Eggert  <address@hidden>
>  
>       close-stream, closein, closeout: simplify
> diff --git a/top/maint.mk b/top/maint.mk
> index e9d5ee7d4..3dbe9c378 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -408,6 +408,41 @@ sc_prohibit_magic_number_exit:
>       halt='use EXIT_* values rather than magic number'               \
>         $(_sc_search_regexp)
>  
> +# Check that we don't use $< in non-implicit Makefile rules.
> +#
> +# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
> +# miss the Makefiles that are not under VC control (e.g., symlinks
> +# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
> +# too delicate.
> +#
> +# Use GNU Make's --print-data-base to normalize the rules into some
> +# easy to parse format: they are separated by two \n.  Look for the
> +# "section" about non-pattern rules (marked with "# Files") inside
> +# which there are still the POSIX Make like implicit rules (".c.o").
> +sc_prohibit_gnu_make_extensions_awk_ =                                       
> \
> +  BEGIN {                                                            \
> +      RS = "\n\n";                                                   \
> +      in_rules = 0;                                                  \
> +  }                                                                  \
> +  /^\# Files/ {                                                              
> \
> +      in_rules = 1;                                                  \
> +  }                                                                  \
> +  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {            \
> +      print "Error: " file ": $$< in a non implicit rule\n" $$0;     \
> +      status = 1;                                                    \
> +  }                                                                  \
> +  END {                                                                      
> \
> +     exit status;                                                    \
> +  }
> +sc_prohibit_gnu_make_extensions:
> +     (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |      \
> +       tr ' ' '\n' |                                                 \
> +       $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |                      \
> +       while read m; do                                              \
> +         $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |              \
> +           awk -v file=$$m -e '$($@_awk_)' || exit 1;                \
> +       done
> +
>  # Using EXIT_SUCCESS as the first argument to error is misleading,
>  # since when that parameter is 0, error does not exit.  Use '0' instead.
>  sc_error_exit_success:



reply via email to

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