Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Makefile to do nothing

Tags:

linux

makefile

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?

like image 762
blz Avatar asked Oct 09 '17 11:10

blz


People also ask

What is the target in makefile?

A simple makefile consists of "rules" with the following shape: target ... : dependencies ... command ... ... A target is usually the name of a file that is generated by a program; examples of targets are executable or object files.

What is a makefile used for?

Makefile sets a set of rules to determine which parts of a program need to be recompile, and issues command to recompile them. Makefile is a way of automating software building procedure and other complex tasks with dependencies. Makefile contains: dependency rules, macros and suffix(or implicit) rules.

What is make and makefile?

Make is Unix utility that is designed to start execution of a makefile. A makefile is a special file, containing shell commands, that you create and name makefile (or Makefile depending upon the system).


Video Answer


1 Answers

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

like image 148
Michel Billaud Avatar answered Sep 23 '22 15:09

Michel Billaud