tags:

views:

30

answers:

1

Hi there,

I'm trying to get GNU make to produce multiple outputs from a single input. The most simple example I can demonstrate is:

a b : test
    cp $< $@

which, I believe, should copy the file test to the files name a and b. However, it only makes the file a, which seems to me to be contrary to the instructions listed here:

http://www.gnu.org/software/automake/manual/make/Multiple-Targets.html

Am I doing something wrong?

Thanks, Tom

+1  A: 

If you run a rule that depends on a, it will run your rule with $< as test and $@ as a. If you run a rule that depends on b, $@ will be b instead. If you make a rule above your current rule like:

all: a b

It will run the rules for a and b, which is that same rule twice. Otherwise, if your rule is the first in the file it will run it with the first target only, which is a

Michael Mrozek
That works! Thank you very much!
Tom Sharp
@Tom [Accepting answers](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work/5235#5235)
Michael Mrozek