On Mon, 2022-06-06 at 15:13 +0200, Georg Lehner wrote:
> Hi,
> 
> The topic of header dependency tracking is already addressed since
> the 
> inception of redo by DJB.

About C header dependencies, you can actually do it using POSIX Make
(in the next version, the -include statement is not available yet but
widely supported).

SRCS= foo.c bar.c baz.c
OBJS= ${SRCS:.c=.o}
DEPS= ${SRCS:.c=.d}

.c.o:
    ${CC} -o $@ -MMD -c $< ${CFLAGS}

all: hello

-include ${DEPS}

hello: ${OBJS}
    ${CC} -o $@ ${OBJS}

And you're done. On a fresh directory the -include ${DEPS} will
silently fail and rebuild everything. Then .d files will be generated
and touching any file will rebuild exactly what should be.

The only non portable thing is the -MMD option (gcc and clang support
though).

HTH

-- 
David

Reply via email to