简体   繁体   中英

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?

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

This should do it (ie nothing):

null:
    @:

Try the following complete makefile:

all :
.PHONY : all 

This recipe do nothing.

.DEFAULT:
    @echo -n ""

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM