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

J

Jon Nicoll

Hi all
I'm looking for a feature or technique in GNU make - I'm not sure
what it might be called, and it might be achievable only in conjunction with
other techniques. This is OT except that (a) I'm doing this in conjunction
with a Python program, and (b) this newsgroup is full of people who might
well know the answer ;-)

Basically, I want to concatenate a series of targets in the parameters
of a rule command. As a f'rinstance: If I have a set of .A files, and
a (python!) script AtoB which generates .B files, such that

AtoB.py 1.A # creates 1.B
AtoB.py 2.A # creates 2.B

and

AtoB.py 1.A 2.A 3.A 4.A # creates 1.B, 2.B, 3.B and 4.B

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.

Jon N
 
C

Carl Banks

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
 
J

Jon Nicoll

Hi Carl

[...]

Thanks for the idea. I will have a go with this.

I do know about Scons and will use your prod to remind me to have another
look at it. Last time I looked it was for a complicated project where I
couldn't justify the translation time; this one is much simpler and it
might be a good time to have another go in learning mode.

Thanks
Jon N
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top