This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Automatically update "aclocal_m4_deps" when updating gnulib


On 09/02/2018 10:21 PM, Sergio Durigan Junior wrote:
> When we update gnulib using our "update-gnulib.sh" tool, it doesn't
> automatically update the list of M4 files present at
> gnulib/Makefile.in:aclocal_m4_deps.  This patch extends the tool to do
> that.  It also puts "aclocal_m4_deps" in its own file (a Makefile
> fragment), so that it's easier to update it programatically.
> 
> Tested by generating the file and diff'ing the results against the
> current version of "aclocal_m4_deps".

Thanks for doing this.

Three remarks below.

> diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
> index 3dcafeb3e6..6c10c8a8c4 100755
> --- a/gdb/gnulib/update-gnulib.sh
> +++ b/gdb/gnulib/update-gnulib.sh
> @@ -167,3 +167,9 @@ if [ $? -ne 0 ]; then
>     exit 1
>  fi
>  
> +# Update aclocal-m4-deps.mk
> +cat > aclocal-m4-deps.mk <<EOF
> +aclocal_m4_deps = \\
> +	configure.ac \\
> +$(find import/m4 -type f -name "*.m4" | sed 's/^/\t/; s/$/ \\/; $s/ \\//g')
> +EOF

#1 

I'd find it a little better to make it so that the new file only includes
the M4 files, and leave adding configure.ac to Makefile.in.  I.e., put
the m4 files list in a different variable here and them do something like:

 # Fill in $m4_files
 include $(srcdir)/m4-files.mk

 aclocal_m4_deps = configure.ac $m4_files

in Makefile.in, or, tweak the rule to include configure.ac directly:

  $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ configure.ac $(m4_files)


#2 

I think it'll be good practice to generate the file to a temporary
name, and then use move-if-change to atomically update the destination,
in case someone Ctrl-Cs just while the script is halfway generated.

I.e.:

 cat > foo.mk.tmp <<EOF
 .....
 $(srcdir)/..../move-if-change foo.mk.tmp foo.mk


#3 

Could you also make the script emit a header in the new file that
reads:

  # THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:

That would make emacs and vi open the file in read-only mode.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]