c++ - Makefile:7: target ( given more than once in the same rule -
im not familiar make system. when tried execute program below, there no problem:
./prog.out arg1 arg2 arg3
when decided make, added following script makefile
parse ${parameters}: ./prog.out ${parameters}
its strange when works well;
make parse parameters="aaa bbb ccc"
and these characters: '(' , ')' generates errors!
make parse parameters="( d , ( d , ( d , d ) ) )" makefile:7: target `(' given more once in same rule. makefile:7: target `d' given more once in same rule. makefile:7: target `,' given more once in same rule. makefile:7: target `(' given more once in same rule. makefile:7: target `d' given more once in same rule. makefile:7: target `,' given more once in same rule. makefile:7: target `d' given more once in same rule. makefile:7: target `)' given more once in same rule. makefile:7: target `)' given more once in same rule. ./prog.out ( d , ( d , ( d , d ) ) ) /bin/sh: 1: syntax error: "(" unexpected make: *** [parse] error 2
but works well;
./prog.out "( d , ( d , ( d , d ) ) )"
the make version 3.81
any idea?
parse ${parameters}: ./prog.out ${parameters}
the above makefile snippet creates target named parse
, 1 each word in expansion of variable parameters
.
so in invocation make parse parameters="aaa bbb ccc"
line expands parse aaa bbb ccc:
, end defining 4 targets parse
, aaa
, bbb
, ccc
.
with invocation make parse parameters="( d , ( d , ( d , d ) ) )"
expands parse ( d , ( d , ( d , d ) ) ):
, define targets parse,
d,
(,
,and
)with
dbeing listed 4 times,
,three times,
(three times
, )
3 times. (which why make complains targets being redefined.
if want parameters
used variable in command run don't need in target line @ all.
parse: ./prog.out "${parameters}"
and use
make parse parameters="aaa bbb ccc
or
make parse parameters="( d , ( d , ( d , d ) ) )"
Comments
Post a Comment