0

I use linux and filter doxygen output as follows:

doxygen 2> >(grep "Arguments.h") 1> /dev/null 

which is just to concentrate on failures within Arguments.h. Now i want to put all that in a minimal makefile for GNU Make 4.3

doc: doxygen 2> >(grep "Arguments.h") 1> /dev/null 

of course later to replace Arguments.h by some other file. But this does not work: reply is

doxygen 2> >(grep "Arguments.h") 1> /dev/null /bin/sh: -c: line 0: syntax error near unexpected token `>' /bin/sh: -c: line 0: `doxygen 2> >(grep "Arguments.h") 1> /dev/null' make: *** [makefile:2: doc] Error 1 

as far as i know make... one has to escape sth, but no idea what... Any specialists which can help?

1 Answer 1

1

This is not related to escaping etc. This is related to which shell is being used.

GNU make (as with all versions of make) always invokes /bin/sh to run recipes, and that is a POSIX standard shell (or some proximity to it). The command you're using is definitely not supported by the POSIX standard, it appears to be using many features available only as enhancements in the bash shell.

If you want to write your recipes using bash features you have to tell make that it should be using bash as the shell, not /bin/sh. You can add this to your makefile:

SHELL = /bin/bash 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, worked just fine.. I love bash shell.. I should have known because make tells me which shell is used. On the other hand... How can this be done with posix conform shell? The requirement would be to pass the error output to grep and the rest to /dev/null
It's much simpler with POSIX than using the fancy bash features :) Just : doxygen 2>&1 >/dev/null | grep "Arguments.h" Note that order matters when using redirection! The bash features are very powerful but they aren't needed for this simple thing.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.