Makefile:7: target ( given more than once in the same rule
c++, makefile
Solution
parse ${parameters}:
./prog.out ${parameters}
The above makefile snippet creates a target named `parse` and one for each word in the expansion of the variable `parameters`.
So in your invocation `make parse parameters="aaa bbb ccc"` the line expands to `parse aaa bbb ccc:` and you end up defining four targets `parse`, `aaa`, `bbb` and `ccc`.
With the invocation `make parse parameters="( d , ( d , ( d , d ) ) )"` it expands to `parse ( d , ( d , ( d , d ) ) ):` and you define the targets `parse,`d`,`(`,`,`and`)`with`d`being listed four times,`,`three times,`(`three times` and `)` three times. (Which is why make complains about the targets being redefined.
If you just want `parameters` used as a variable in the command that is run then you don't need it in the target line at all.
parse:
./prog.out "${parameters}"
and then use
make parse parameters="aaa bbb ccc
or
make parse parameters="( d , ( d , ( d , d ) ) )"
Problem
im not familiar with make system. when i tried to execute the program like below, there is no problem: ``` ./prog.out arg1 arg2 arg3 ``` when i decided to it with make, i added the following script to makefile ``` parse ${parameters}: ./prog.out ${parameters} ``` its strange when the this works well; ``` make parse parameters="aaa bbb ccc" ``` and these characters: '(' and ')' generates errors! ``` make parse parameters="( d , ( d , ( d , d ) ) )" Makefile:7: target `(' given more than once in the same rule. Makefile:7: target `d' given more than once in the same rule. Makefile:7: target `,' given more than once in the same rule. Makefile:7: target `(' given more than once in the same rule. Makefile:7: target `d' given more than once in the same rule. Makefile:7: target `,' given more than once in the same rule. Makefile:7: target `d' given more than once in the same rule. Makefile:7: target `)' given more than once in the same rule. Makefile:7: target `)' given more than once in the same rule. ./prog.out ( d , ( d , ( d , d ) ) ) /bin/sh: 1: Syntax error: "(" unexpected make: *** [parse] Error 2 ``` but this works well; ``` ./prog.out "( d , ( d , ( d , d ) ) )" ``` the make version is 3.81 any idea?