Makefile while loop
Even after setting SHELL to bash instead of sh, the following does not work:
doc:
while read line; do \
eval echo "$$line" > $(DOC) \
done < $(DOC).templ
/bin/bash: -c: line 3: syntax 开发者_StackOverflow中文版error: unexpected end of file
What I'm trying to do is have a template file with bash parameter comprehensions and such ($()
, ${}
) and "build" it at compile time. Is there a better way to do this?
You are missing a semicolon before done:
doc:
while read line; do \
eval echo "$$line" > $(DOC); \
done < $(DOC).templ
This answer might come to late ;-), but I think another problem is that your output redirection is in the wrong position:
doc:
while read line; do \
eval echo "$$line"; \
done < $(DOC).templ > $(DOC)
精彩评论