Hi,

> : foreach *.c |> gcc -Wall -Wextra -std=c11 -c %f -o %o |> %B.o {ALL_OBJS}
> : foreach Test_*.o |> gcc {ALL_OBJS} -o %o |> %B.exe {TEST_EXES}
> : foreach {TEST_EXES} |> ./%f |>
> 
> What I am trying to do here is to re-link test executables only if its
> link-time dependencies change by over-specifying (specifying all the
> object files that were generated from the compile step). I am hoping Tup
> figures out which ones are actually read by the linker and that only the
> appropriate tests are re-linked if a certain object file changes.

You probably want to use a static library with the ^o^ flag, like this:

    : foreach Test_*.o | library.a |> ^o^ gcc -o %o %f library.a |> %B.exe 
{TEST_EXES}

The ^o^ flag tells tup to compare the linker output against the previous run,
so when library.a changes all your tests will be relinked but only the ones
using symbols from object files that have been modified will be re-run.

(http://gittup.org/tup/manual.html#lbAH)

This relies on the linker returning identical output when the symbols a program
actually uses haven't changed, which does seem to work from limited testing with
the gcc linker. But if the linker /isn't/ completely deterministic wrt the 
subset
of symbols actually used, some tests might be run unnecessarily.

Regards,
Neil

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to