Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing make target name

Tags:

makefile

Is it possible to make gnu make process output target name that is being executed? That would help debug build process a lot.

> make a
building b
building c
building a

Prefer not to add echo $@ statements inside each target.

like image 512
aisbaa Avatar asked Apr 16 '15 10:04

aisbaa


1 Answers

You can set desired debug level via command-line. In your case it looks like basic should suffice:

$ make --debug=b
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
 File 'all' does not exist.
   File 'foo' does not exist.
  Must remake target 'foo'.
  Successfully remade target file 'foo'.
   File 'bar' does not exist.
  Must remake target 'bar'.
  Successfully remade target file 'bar'.
   File 'baz' does not exist.
  Must remake target 'baz'.
  Successfully remade target file 'baz'.
Must remake target 'all'.
Successfully remade target file 'all'.

See GNU Make options.

like image 131
barti_ddu Avatar answered Sep 23 '22 09:09

barti_ddu