Automatically rebuild everything when the makefile changes

"R. Diez" <[email protected]> Fri, 3 Apr 2026 16:18:03 +0200
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <[email protected]>
Hi all:

I am using Automake together with Autoconf here:

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.

However, the object files are not automatically rebuilt. For example, if I add a compiler flag, no rebuilds take place.

I am not the first person to realise that this is a problem:

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?

In my particular case, I tried the following:

$(firmware_elf_OBJECTS): Makefile

The trouble is, the xxx_OBJECTS variables are not documented (as far as I can tell), and therefore subject to change without notice.

Besides, I just realised that I forgot to do the same to the following library in my project:

noinst_LIBRARIES += libAtmelSoftwareFramework.a

So it is very easy to forget that manual dependency on 'makefile' whenever you add new sources or libraries. So I am hoping there is a better way, like some automatic dependency injection for everything.

Thanks in advance,
   rdiez