Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify --no-print-directory within the Makefile itself

I'd like to run my makefile without the -w flag turned on by the recursive make calls. The flag to do that is --no-print-directory on the make command line.

Is it possible to specify that flag within the makefile itself?

I plan to make this flag dependent on a VERBOSE mode, perhaps something like

$(if $(VERBOSE),,MAKEFLAGS += no-print-directory))

Thanks, Dan

like image 653
dbbd Avatar asked Nov 06 '11 15:11

dbbd


People also ask

How do I print the current directory in makefile?

You can use shell function: current_dir = $(shell pwd) . Or shell in combination with notdir , if you need not absolute path: current_dir = $(notdir $(shell pwd)) .

What is Vpath in makefile?

The value of the make variable VPATH specifies a list of directories that make should search. Most often, the directories are expected to contain prerequisite files that are not in the current directory; however, make uses VPATH as a search list for both prerequisites and targets of rules.

Can a make target be a directory?

Yes, a Makefile can have a directory as target.

Where is the makefile located?

The makefile is a text file that contains the recipe for building your program. It usually resides in the same directory as the sources, and it is usually called Makefile .


1 Answers

Yes, just appending --no-print-directory to MAKEFLAGS should be enough, but you have to do that with conditional directives, not with conditional functions:

ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
like image 126
Eldar Abusalimov Avatar answered Sep 23 '22 02:09

Eldar Abusalimov