ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
as from time to time I'm debugging build failures, I need to see which commands with all their arguments are executed by 'make'.
Some Makefles are written smartly, e.g. they have, for example, a 'V' variable, and if it is set to TRUE on 'make' command line, command lines are printed.
I am aware of 'remake' and I am widely using it, but it still it doesn't show me command lines from constructs like
Code:
define foo
commands_here
endef
when 'foo' is called as
Code:
@$(foo)
- per GNU 'make' documentation '@' suppresses echoing.
So, my question is: is there a way to temporarily "remove" all '@' in order to make all commands executed by 'make'.
I went through GNU 'make' documentation and did some web search, but didn't find an answer. In fact, since some Makefiles are smartly built with the above mentioned 'V' variable, I think there is no way.
But I want to make sure. If one knows a manpage on the web which prove me wrong, just give a link to it.
I looked at the options. I gave a specific case when it does not work, that's why I asked. It doesn't even work with 'remake' which is a Makefile debugger. Only removing '@' showed me the command lines being executed.
sorry guy, it looks like gmake has no such option. usually -v is used to do that (verbose, and it will print all commands), but unfortunately it does not work with gmake. You can try -n to display what should be executed, but it will not execute anything, just print the commands.
sorry guy, it looks like gmake has no such option. usually -v is used to do that (verbose, and it will print all commands), but unfortunately it does not work with gmake. You can try -n to display what should be executed, but it will not execute anything, just print the commands.
From 'man make':
Code:
--debug[=FLAGS]
Print debugging information in addition to normal processing. If the FLAGS are omitted, then the behavior is the same as if -d was specified. FLAGS may be a for
all debugging output (same as using -d), b for basic debugging, v for more verbose basic debugging, i for showing implicit rules, j for details on invocation of
commands, and m for debugging while remaking makefiles.
- I tried 'j', it worked on "regular" stuff, but not on what GNU documentation calls "canned recipes" (the "define ..." stuff).
Posting here as none of the answers worked for me.
What you're looking for is most probably '--trace':
Quote:
‘--trace’
Show tracing information for make execution. Prints the entire recipe to be executed, even for recipes that are normally silent (due to .SILENT or ‘@’). Also prints the makefile name and line number where the recipe was defined, and information on why the target is being rebuilt.
Using '--trace --debug=v' works particularly well giving you an insight into what rule is being run and what are the commands run inside the rules, printing even otherwise silent rules.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.