The content of this blog is my personal opinion only. Although I am an employee - currently of Imagination Technologies's MIPS group, in the past of other companies such as Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Sunday, June 03, 2012

A make pattern

test: run-test1 run-test2

.PHONY: run-test1
run-test1: test1.x
test1.x: test1.cpp ...
        gcc -o test1.x test1.cpp ...
Of course, in a decent build system, this is a macro Build_Targets_For("foo.cpp"), rather than having to write them all out by hand. Scons may not be the best, but it avoids much clutter.


Andy "Krazy" Glew said...

Observe the meta-pattern: Define individual actions, but have them registered with a bigger action that runs all the actions of a type.

Andy "Krazy" Glew said...

Flip side: make pattern to only run the tests if there is reason to expect that they have changed. Note that we want both: sometimes tests are dependent on time, etc. Want to rerun if the surrounding environment has changed.