0

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.

Community
  • 1
  • 1
gTcV
  • 2,446
  • 1
  • 15
  • 32

1 Answers1

1

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.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148