On Friday 2026-04-03 16:18, R. Diez wrote:
>
> https://github.com/rdiez/DebugDue/blob/master/Project/Makefile.am
>
> If I change configure.ac and/or Makefile.am, the 'configure' script and/or the
> 'makefile' file are automatically regenerated.
> Automake rebuild source file if Makefile changes
> https://stackoverflow.com/questions/6551249/automake-rebuild-source-file-if-makefile-changes
>
> What is the best way to add a rule to Makefile.am so that a change in the
> generated 'makefile' file automatically triggers a full rebuild?
Is it really the Makefile that you are interested in?
If anything, it would rather be Makefile.am.
bin_PROGRAMS = foo
EXTRA_foo_DEPENDENCIES = Makefile.am
I have not tried, but I see it as a possibility that the use of
`AM_MAINTAINER_MODE([disable])` in configure.ac, or the use of
`./configure --disable-maintainer-mode` by a user, could interfere in
your desire for a rebuild, since those commands expressly disable
some regeneration.
> the object files are not automatically rebuilt. For example, if I add
> a compiler flag, no rebuilds take place.
That would actually be considered a feature (more so of /usr/bin/make
than automake).
Make's rebuild decisions depend on whether *prerequisites* are newer
than targets; *variables* are not part of that dependency graph. In
other words,
make all
touch foo.c
make all CFLAGS="-Og -g"
will only rebuild foo.o and subsequent targets with -Og/-g. Which is
actually quite useful if you have a large program and only need
symbols for one source file.
I always found it annoying that `make KCFLAGS=...` in the Linux
kernel source needlessy rebuilds everything that I'm not even
interested in rebuilding.