How to use an anonymous fifo in a Makefile?

时间:2017-04-09 23:40:19

标签: bash makefile pandoc fifo

Is it possible to use an anonymous fifo in a Makefile?

I tried it the following way:

%.html: %.txt
        pandoc -o $@ <(sed 's%•%*%' $<)

but I get a syntax error from /bin/sh.

  1. How can I use an anonymous fifo in a Makefile?
  2. Is there a better solution to use a simple regex (or even a simple find and replace) filter for pandoc?

1 个答案:

答案 0 :(得分:2)

This make uses /bin/sh to execute commands, and /bin/sh does not understand the <(...) process substitution syntax.

Luckily, pandoc does not require a filename on its command line. If no filenames are specified then pandoc reads from its standard input stream, so you should be able to feed it the output of the sed command through an ordinary pipe, like this:

sed 's%•%*%' "$<" | pandoc -o "$@"