LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2012, 01:06 AM   #1
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
A way to force GNU 'make' to always echo ?


Hello,

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.

Thanks in advance.
 
Old 11-29-2012, 02:48 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
see here: http://www.gnu.org/software/make/man...ptions-Summary
--debug=<something>
 
Old 11-29-2012, 03:52 AM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Original Poster
Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by pan64 View Post
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.
 
Old 11-29-2012, 06:30 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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.
 
Old 11-29-2012, 06:48 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Original Poster
Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by pan64 View Post
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).
 
Old 05-04-2020, 07:26 AM   #6
eullerborges
LQ Newbie
 
Registered: May 2020
Posts: 1

Rep: Reputation: Disabled
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.
 
3 members found this post helpful.
Old 05-04-2020, 09:06 AM   #7
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,863
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
I usually use this command between `./configure` and `make all`
Code:
find . -name Makefile | while read M; do
    sed -i "$(printf 's;^\t@;\t;')" "$M"
done
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make/echo problem JohnGraham Programming 3 11-30-2011 07:08 PM
How to make libata.force=1.5G work without reboot? sscn Linux - Software 2 06-07-2011 04:24 AM
grep | xargs -I echo $(foo; bar; echo $(fee; fi; fo; fum)) == questionable output.. GrapefruiTgirl Programming 11 12-07-2010 07:02 PM
GNU Make and GNU GCC DEBUG vs RELEASE compiler options aryan1 Programming 1 01-12-2010 12:29 PM
How to make DOS' echo on in bash script? Dims Linux - Newbie 2 06-01-2009 01:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration