Re: [dev] Automatic C header dependency tracking for the redo build-system

From: Georg Lehner <>
Date: Mon, 6 Jun 2022 15:13:13 +0200


The topic of header dependency tracking is already addressed since the
inception of redo by DJB.

The Appenwarr documentation offers a fairly simple answer in the form of
an "implicit" .do file for object files.

cat > <<EOF
redo-ifchange $2.c
gcc -MD -MF $2.d -c -o $3 $2.c
read DEPS <$2.d
redo-ifchange ${DEPS#*:}
1. check the dependency on the source file $2.c.
2. build the  object file and generate a make-style one-line include 
dependency on all header files with the compiler itself.
3. read the rule into the variable DEPS.
4. check the dependency on all header files.
The second line and the fourth line are one of the special things about 
redo: *after* building the target you can check *again* if it needs to 
be rebuilt.
Best Regards,
On 9/7/21 19:50, Thomas Oltmann wrote:
> Hi everybody!
> redo is a pretty well-designed family of build-systems
> that enjoys a certain popularity among people on this mailing list.
> Its recursive nature makes it well-suited to projects comprising a
> large amount of files.
> However, unlike comparable build-systems like make or tup, it lacks provisions
> to automatically track C #include dependencies, which is sorely needed
> for projects
> with many source files.
> To overcome this, I wrote a simple companion tool that integrates
> fairly seamlessly with redo.
> This tool is able to parse the dependency-only Makefiles that modern C
> compilers can
> produce during compilation, and feed these dependencies into redo (via
> 'redo-ifchange').
> It should work with pretty much any redo implementation
> (other than maybe apenwarr's *minimal do*, because that one doesn't implement
> 'redo-ifchange' as a separate executable).
> You can find it here:
> Any feedback is appreciated.
> Cheers,
>            Thomas Oltmann
> P.S.: My sincere apologies if this post if considered off-topic, as
> redo is not under the suckless banner.
> I considered posting on the redo mailing-list instead, but that one
> seems very obscure and inactive,
> plus I recognize some of the posters there as being regulars on the
> suckless mailing lists as well.
Received on Mon Jun 06 2022 - 15:13:13 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 06 2022 - 15:24:08 CEST