public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Christophe Lyon <christophe.lyon@linaro.org>,
	binutils@sourceware.org, gdb@sourceware.org, gcc@gcc.gnu.org
Subject: Re: [RFC] add regenerate Makefile target
Date: Thu, 14 Mar 2024 14:10:41 -0400	[thread overview]
Message-ID: <1eb529f2-3842-4090-a8e2-f713a28f2394@simark.ca> (raw)
In-Reply-To: <20240313080237.1143034-1-christophe.lyon@linaro.org>



On 2024-03-13 04:02, Christophe Lyon via Gdb wrote:
> Hi!
> 
> After recent discussions on IRC and on the lists about maintainer-mode
> and various problems with auto-generated source files, I've written
> this small prototype.
> 
> Based on those discussions, I assumed that people generally want to
> update autotools files using a script similar to autoregen.py, which
> takes care of running aclocal, autoheader, automake and autoconf as
> appropriate.
> 
> What is currently missing is a "simple" way of regenerating other
> files, which happens normally with --enable-maintainer-mode (which is
> reportedly broken).  This patch as a "regenerate" Makefile target
> which can be called to update those files, provided
> --enable-maintainer-mode is used.
> 
> I tried this approach with the following workflow for binutils/gdb:
> - run autoregen.py in srcdir
> - cd builddir
> - configure --enable-maintainer-mode 
> - make all-bfd all-libiberty regenerate -j1
> - for gdb: make all -C gdb/data-directory -j1
> - make all -jXXX
> 
> Making 'all' in bfd and libiberty is needed by some XXX-gen host
> programs in opcodes.
> 
> The advantage (for instance for CI) is that we can regenerate files at
> -j1, thus avoiding the existing race conditions, and build the rest
> with -j XXX.
> 
> Among drawbacks:
> - most sub-components use Makefile.am, but gdb does not: this may make
>   maintenance more complex (different rules for different projects)
> - maintaining such ad-hoc "regenerate" rules would require special
>   attention from maintainers/reviewers
> - dependency on -all-bfd and all-libiberty is probably not fully
>    intuitive, but should not be a problem if the "regenerate" rules
>    are used after a full build for instance
> 
> Of course Makefile.def/Makefile.tpl would need further cleanup as I
> didn't try to take gcc into account is this patch.
> 
> Thoughts?

My first thought it: why is it a Makefile target, instead of some script
on the side (like autoregen.sh).  It would be nice / useful to be
able to it without configuring / building anything.  For instance, the
autoregen buildbot job could run it without configuring anything.
Ideally, the buildbot wouldn't maintain its own autoregen.py file on the
side, it would just use whatever is in the repo.

Looking at the rule to re-generate copying.c in gdb for instance:

    # Make copying.c from COPYING
    $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copying.awk
           awk -f $(srcdir)/copying.awk \
               < $(srcdir)/../COPYING3 > $(srcdir)/copying.tmp
           mv $(srcdir)/copying.tmp $(srcdir)/copying.c

There is nothing in this code that requires having configured the source
tree.  This code could for instance be moved to some
generate-copying-c.sh script.  generate-copying-c.sh could be called by
an hypothetical autoregen.sh script, as well as the copying.c Makefile
target, if we want to continue supporting the maintainer mode.

Much like your regenerate targets, an autoregen.sh script in a given
directory would be responsible to re-generate all the files in this
directory that are generated and checked in git.  It would also be
responsible to call any autoregen.sh file in subdirectories.

There's just the issue of files that are generated using tools that are
compiled.  When experimenting with maintainer mode the other day, I
stumbled on the opcodes/i386-gen, for instance.  I don't have a good
solution to that, except to rewrite these tools in a scripting language
like Python.

Simon

  reply	other threads:[~2024-03-14 18:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13  8:02 Christophe Lyon
2024-03-14 18:10 ` Simon Marchi [this message]
2024-03-15  8:50   ` Christophe Lyon
2024-03-15 14:13     ` Eric Gallager
2024-03-15 14:25       ` Tom Tromey
2024-03-16 17:30         ` Simon Marchi
2024-03-18 17:28         ` Christophe Lyon
2024-03-20 15:11           ` Simon Marchi
2024-03-18 16:13       ` Christophe Lyon
2024-03-16 17:16     ` Simon Marchi
2024-03-18 17:25       ` Christophe Lyon
2024-03-19 17:11         ` Christophe Lyon
2024-03-19 18:03           ` Tom Tromey
2024-03-20 12:05             ` Eric Gallager
2024-03-20 15:34         ` Simon Marchi
2024-03-21 14:32           ` Christophe Lyon
2024-03-25 14:19             ` Christophe Lyon
2024-03-27 18:22               ` Christophe Lyon
2024-04-08  9:22               ` Christophe Lyon
     [not found]     ` <78f1d113-f8ac-4a76-8dea-9f92519c1a89@linux.ibm.com>
2024-03-27 18:14       ` Christophe Lyon
2024-03-28  8:55         ` Jens Remus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1eb529f2-3842-4090-a8e2-f713a28f2394@simark.ca \
    --to=simark@simark.ca \
    --cc=binutils@sourceware.org \
    --cc=christophe.lyon@linaro.org \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).