I'm on Debian 12 writing a Makefile to simplify some tasks:
todo:
su - user -c "/mypath/dothis"
Now I can see the standard output from that task if run with:
make todo
I've checked in man make and found -s silent: but this hide only the command, is there a way suppress output or this is the only way:
make todo >> /dev/null 2>&1
The simple way would be to make the recipe output to /dev/null
:
todo_quiet:
@su - user -c "/mypath/dothis" > /dev/null 2>&1
and then run make todo_quite
You could also do a command line parameter as so:
Q := $(if $(V),,@)
Q_SUFFIX := $(if $(V),,> /dev/null 2>&1)
.PHONY: todo
todo:
$(Q)su - user -c "/mypath/dothis" $(Q_SUFFIX)
Where you would run make todo
to compile quietly, and make todo V=1
to do it verbosely. If you want to suppress all output from any make recipe, you would have to pipe make's output to /dev/null
...