diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-04-04 13:56:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-04-04 13:56:32 +0200 |
commit | 2f0610acbc056052a108e4a46911fc21d0dca2ab (patch) | |
tree | f8f680efdfa08c0acd76e3fd62e5408a1f9e460e /gcc/config/aarch64 | |
parent | 88cffa1a07d04187be1975238dfdca51a8ef5d65 (diff) | |
download | gcc-2f0610acbc056052a108e4a46911fc21d0dca2ab.zip gcc-2f0610acbc056052a108e4a46911fc21d0dca2ab.tar.gz gcc-2f0610acbc056052a108e4a46911fc21d0dca2ab.tar.bz2 |
aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144]
Normally updates to the source directory files are guarded with
--enable-maintainer-mode, e.g. we don't regenerate configure, config.h,
Makefile.in in directories that use automake etc. unless gcc is configured
that way. Otherwise the source tree can't be e.g. stored on a read-only
filesystem etc.
In gcc/Makefile.in we use @MAINT@ for that but that works because
gcc/Makefile is generated by configure. In config/*/t-* files we need to
check $(ENABLE_MAINTAINER_RULES):
# The following provides the variable ENABLE_MAINTAINER_RULES that can
# be used in language Make-lang.in makefile fragments to enable
# maintainer rules. So, ENABLE_MAINTAINER_RULES is 'true' in
# maintainer mode, and '' otherwise.
@MAINT@ ENABLE_MAINTAINER_RULES = true
On Mon, Apr 04, 2022 at 11:10:14AM +0100, Richard Sandiford wrote:
> I guess the risk is that it will become even easier to forget
> to commit an updated aarch64-tune.md. Perhaps we should have a
> non-maintainer rule to build aarch64-tune.md locally and check it
> against the source-directory version, and fail the build if there's
> a mismatch. Or maybe we should just generate aarch64-tune.md in the
> build directory and remove the source directory version.
I've tried if aarch64-tune.md will be read from the build dir, but it is
not. The gen* files can use -I options to add additional directories, but
they don't use them.
Here is a variant patch which will complain and fail if there is a change
and --enable-maintainer-mode is not enabled.
2022-04-04 Jakub Jelinek <jakub@redhat.com>
PR target/105144
* config/aarch64/t-aarch64 (s-aarch64-tune-md): Do move-if-change
only if configured with --enable-maintainer-mode, otherwise compare
tmp-aarch64-tune.md with $(srcdir)/config/aarch64/aarch64-tune.md and
if they differ, emit a message and fail.
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r-- | gcc/config/aarch64/t-aarch64 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index a421d26..ba74abc 100644 --- a/gcc/config/aarch64/t-aarch64 +++ b/gcc/config/aarch64/t-aarch64 @@ -30,8 +30,18 @@ s-aarch64-tune-md: $(srcdir)/config/aarch64/gentune.sh \ $(SHELL) $(srcdir)/config/aarch64/gentune.sh \ $(srcdir)/config/aarch64/aarch64-cores.def > \ tmp-aarch64-tune.md +ifneq ($(strip $(ENABLE_MAINTAINER_RULES)),) $(SHELL) $(srcdir)/../move-if-change tmp-aarch64-tune.md \ $(srcdir)/config/aarch64/aarch64-tune.md +else + @if ! cmp -s tmp-aarch64-tune.md \ + $(srcdir)/config/aarch64/aarch64-tune.md; then \ + echo "aarch64-tune.md has changed; either"; \ + echo "configure with --enable-maintainer-mode"; \ + echo "or copy tmp-aarch64-tune.md to $(srcdir)/config/aarch64/aarch64-tune.md"; \ + exit 1; \ + fi +endif $(STAMP) s-aarch64-tune-md s-mddeps: s-aarch64-tune-md |