From: Jakub Jelinek Date: Mon, 4 Apr 2022 11:56:32 +0000 (+0200) Subject: aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144] X-Git-Tag: basepoints/gcc-13~330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f0610acbc056052a108e4a46911fc21d0dca2ab;p=thirdparty%2Fgcc.git 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 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. --- diff --git a/gcc/config/aarch64/t-aarch64 b/gcc/config/aarch64/t-aarch64 index a421d26f31a4..ba74abc0a436 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