On Monday, September 03 2018, Pedro Alves wrote: > 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. Thanks for the review. > 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 <> +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) Done. > 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 < ..... > $(srcdir)/..../move-if-change foo.mk.tmp foo.mk Done. > #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. Done. Here's the updated version of the patch. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/