Jakub Jelinek <ja...@redhat.com> writes:
> Hi!
>
> 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
>
> This is incremental patch does that, tested again on aarch64-linux and
> x86_64-linux (cross in that case), ok for trunk?
>
> 2022-04-04  Jakub Jelinek  <ja...@redhat.com>
>
>       PR target/105144
>       * config/aarch64/t-aarch64 ($(srcdir)/config/aarch64/aarch64-tune.md,
>       s-aarch64-tune-md, s-mddeps): Only enable the rules if
>       $(ENABLE_MAINTAINER_RULES) is non-empty.

OK.  But 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.

That's all future work though.  The patch is still an improvement
of the status quo.

Thanks,
Richard

>
> --- gcc/config/aarch64/t-aarch64.jj   2022-04-04 10:14:30.256323070 +0200
> +++ gcc/config/aarch64/t-aarch64      2022-04-04 10:32:55.591651822 +0200
> @@ -24,6 +24,7 @@ OPTIONS_H_EXTRA += $(srcdir)/config/aarc
>                  $(srcdir)/config/aarch64/aarch64-fusion-pairs.def \
>                  $(srcdir)/config/aarch64/aarch64-tuning-flags.def
>  
> +ifneq ($(strip $(ENABLE_MAINTAINER_RULES)),)
>  $(srcdir)/config/aarch64/aarch64-tune.md: s-aarch64-tune-md; @true
>  s-aarch64-tune-md: $(srcdir)/config/aarch64/gentune.sh \
>       $(srcdir)/config/aarch64/aarch64-cores.def
> @@ -35,6 +36,7 @@ s-aarch64-tune-md: $(srcdir)/config/aarc
>       $(STAMP) s-aarch64-tune-md
>  
>  s-mddeps: s-aarch64-tune-md
> +endif
>  
>  aarch64-builtins.o: $(srcdir)/config/aarch64/aarch64-builtins.cc $(CONFIG_H) 
> \
>    $(SYSTEM_H) coretypes.h $(TM_H) \
>
>       Jakub

Reply via email to