Search code examples
linuxmakefile

Makefile to do nothing


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?


Solution

  • 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