9

I'm testing a proect, and due to testing purposes, it must include a Makefile, and the first test command will be 'make'. However I don't need the makefile to do anything. The problem is that if I leave it empty, it prints a line in the shell:

make: *** No targets.  Stop.

I need it to not print anything when called in the shell - not even an empty line (again, due to tests format which I don't control). Is that possible?

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
blz
  • 403
  • 6
  • 12

5 Answers5

10

This should do it (i.e. nothing):

null:
    @:
Beta
  • 96,650
  • 16
  • 149
  • 150
9

If you define an empty target

 Nothing:

the make command will tell

$ make
make: Nothing to be done for 'Nothing'.

Then, just add a .SILENT target

# A makefile
Nothing:

all: twist again

.SILENT:

See link GNU Make silent by default

Michel Billaud
  • 1,758
  • 11
  • 14
3

Try the following complete makefile:

all :
.PHONY : all 
Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271
2

This recipe do nothing.

.DEFAULT:
    @echo -n ""
0

In GNU Make, -s will suppress printing which commands are executed:

   -s, --silent, --quiet
        Silent operation; do not print the commands as they are executed.
qwr
  • 9,525
  • 5
  • 58
  • 102