OT: concatenating targets for python with (eg.) Gnu make

Carl Banks pavlovevidence at gmail.com
Mon Nov 12 14:09:57 EST 2007


On Nov 12, 1:22 pm, Jon Nicoll <j... at nicorp.co.uk> wrote:
> My question is, how can I specify a makefile rule so that *all* of the
> changed .A files are invoked on the AtoB command line - ie if 1.A, 2.A
> and 3.A are newer than 1.B, 2.B, 3.B, I want make to invoke
>
> AtoB.py 1.A 2.A 3.A 4.A
>
> rather than
>
> AtoB.py 1.A
> AtoB.py 2.A
> AtoB.py 3.A
>
> Thanks for your thoughts.


The typical idiom is to do something like this (where .Bstamp is an
empty file that timestamps the latest time AtoB was run):

AFILES = 1.A 2.A 3.A

.Bstamp: $(AFILES)
    AtoB.py $(AFILES)
    touch .Bstamp

It's a little bit harder if you want to run AtoB on just the files
that changed, but all the ones that changed in one command.


Now, since you asked an off-topic question here, I am forced to bring
the thread somewhat back on topic by suggesting Scons, which is
written in Python.  I find it to be more robust and versatile than GNU
Make for complex builds, though it's a little bit to learn at first.


Carl Banks




More information about the Python-list mailing list