Aug 4

Say one stage in your build process is a tool that writes out a series of source files and config files. You might have a rule that looks a bit like this:

glue.c glue.h net_conf.xml error_list.config: application.config context.xml target.conf
        generate_glue.exe $^

The trouble is, this is exactly the same as specifying four rules, one for each of the goals. And, depending on the exact version of make you use, you may find that generate_glue.exe is run four times. If that takes more than 4 minutes then you’re going to get really mad. Especially if you have, say, 80 test applications to generate.

A pattern to get around this is to cause the dependency “tree” to reconverge around a marker that tells you when the generator was last run:

glue.c glue.h net_conf.xml error_list.config: glue_generated.touch
        # nothing here
glue_generated.touch: application.config context.xml target.conf
        generate_glue.exe $^
        touch glue_generated.touch

This way, glue_generated.touch gets checked for its age a bunch of times, but the generation action is only executed if some config file is newer than the touch file.

ISTR that this can fail too (maybe it’s if the time granularity is too large) because somewhere I ended up with a horrible bunch of macrology that actually tested the file age explicitly in order to avoid it STILL running the tool n times.

Anyhow. This doesn’t seem to be anywhere on the internets, so it is now.

Aug 4

No matter what a Celebrity Chef might advise, don’t eat stuff with “bane” in the name. That goes also for:

  • deadly nightshade
  • poison ivy
  • black-eyed susan
  • bleeding heart

There are subtle clues about these plants.

 

August 2008
S M T W T F S
« Jul   Sep »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Archives

Meta