gTcV
gTcV

Reputation: 2504

Static pattern rules with multiple %

Assume I have a code producing output depending on a single input variable, which I want to run for a range of input values. Following what is proposed here, I can do this with a makefile as follows:

out1 out2 out3: out%: a.out
    ./a.out $* > $@

Can this be generalized to more than one parameter? I.e. something like

out1_1 out1_2 out2_1 out2_2: out%_%: a.out
    ./a.out $*{1} $*{2} > $@

The $*{i} should refer to what the ith % matched.

Upvotes: 0

Views: 250

Answers (1)

Etan Reisner
Etan Reisner

Reputation: 80941

No, make only supports a single % in a target/prerequisite pattern.

To do what you want you would need to stem the entire #_# bit and then munge/parse that in shell.

Upvotes: 1

Related Questions