bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU make troubleshooting


From: David Boyce
Subject: Re: GNU make troubleshooting
Date: Tue, 29 Aug 2023 09:44:37 -0400

A few thoughts, mostly on the shell/recipe end of things:

- I find it interesting that there's no mention of -n which seems like a bog-standard, POSIX-compliant, debugging method. It's also another way of getting around @. Simplistic but worth mentioning IMHO.

- I wonder why there's so much emphasis on $(info ...) since $(warning ...) will do the same job and also provide file:line so I prefer it for debugging purposes.

- In terms of "why does make insist on rebuilding this target", which is among the most common problems, ISTM that --debug=why or --trace is a simpler option than any messing with '@'. It cuts right to the chase and tells you what make is thinking.

- In an extreme case a user might want to try strace. E.g. create a script like this

$ cat ~/bin/tracesh
#!/bin/sh
exec strace -o /tmp/${0##*/}.log -e trace=process,chdir -fq /bin/sh "$@"

And run make with SHELL=tracesh. To keep the strace log manageable the SHELL assignment could be made target-specific. 

- There's the old "Ask Mr Make" columns by John Graham-Cumming with a bunch of clever (and advanced) debugging techniques but I don't know if those are collected anywhere.

- You may not want to get into listing third-party tools, since there's potentially no end to such a thing, but I've written something called the Make Diagnostic Shell (https://github.com/boyski/mdsh) which can do a lot of advanced analysis but only on the shell side of course, not the make-syntax side. There may be any number of other third-party make-helper tools.

David


On Sun, Aug 27, 2023 at 10:03 AM Alejandro Colomar <alx@kernel.org> wrote:
Hi Paul,

On 2023-08-27 15:52, Paul Smith wrote:
> On Sun, 2023-08-27 at 15:47 +0200, Alejandro Colomar wrote:
>> In fact, I'm going to define .SILENT always in the Linux man-pages,
>> since V=1 is just an unnecessary duplicate for --degub=print.
>> I'll make V=1 only have the effect of redirecting stderr of certain
>> programs.
>
> Just be aware that --debug=print is a new feature as of GNU Make 4.4.

Hmm.

>
> You shouldn't rely on users having access to it, unless you're willing
> to recommend that version (or higher).

Well, I'm the only one developing that Makefile.  I don't expect others
to need it often, as long as I don't break it too badly.  And since I
already require some latest versions of software for development,
requiring make-4.4 is not too much of a stretch.  I can live with it.

This reminded me that Debian still has make-4.3.  I've added the
maintainer to the thread, in case they hadn't noticed that there was a
new version.

Cheers,
Alex

>
> I reminded myself that the --trace option is a shortcut for
> --debug=print,why and so I will rework all this help text to just
> recommend this instead.  It gives you most of the information you would
> want.
>

--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]