[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU make troubleshooting
From: |
Paul Smith |
Subject: |
Re: GNU make troubleshooting |
Date: |
Mon, 10 Jul 2023 14:53:34 -0400 |
User-agent: |
Evolution 3.48.3 (by Flathub.org) |
I want to prefix this by saying that there's no question that make's
traceability could be improved: I'm not saying nothing needs to be
done.
On Mon, 2023-07-10 at 20:32 +0200, Bruno Haible wrote:
> 1) Print the total of the Makefile and all included Makefiles.
> Like what "gcc -E" does with C code.
This has been requested before, but note that it's not really as useful
as people often think it will be because a lot of the internal database
of make is constructed dynamically, not directly from content in
makefiles.
I find the output of "make -p" helpful as it tells you where every rule
and variable was defined.
> This would also answer a question on #gnu today:
> "Is there a way to figure out where the rule is coming from? The
> main
> issue is "target file 'clean' has both : and :: entries. Stop."
> But
> I'm unable to figure out where the last clean: target is coming
> from."
The "last" one is the one that's referenced in the output. Finding the
"first" one is not as easy; the error message can be improved here. In
other similar types of messages we do show both the old and new
locations.
$ cat Makefile
all: ;
all:: ;
$ make
Makefile:2: *** target file 'all' has both : and :: entries. Stop.
^ line number if last target
Showing the "macroexpanded make sources" is difficult because make
doesn't just expand an entire line then parse it. Makefile syntax is
context-sensitive so you can't know how or if to expand parts of a line
until you've already expanded other parts. Of course make could keep
track of this for generating this kind of output.
> 2) Where is the Makefile source for each command that gets executed?
Have you tried using the --trace option? This was added specifically
to provide this kind of information:
$ cat Makefile
all: ; @echo hi
$ make --trace
Makefile:1: update target 'all' due to: target does not exist
echo hi
hi
> 3) Single-stepping or tracing function execution.
Tracing is possible although if we just enable tracing for all variable
expansion you'll get a TON of output. Maybe the user could ask to
trace expansion of certain things only.
I'm not interested in implementing an "interactive" mode for single-
stepping GNU Make. Maybe someone else wants to do it but my suspicion
is that the code changes needed would be massively disruptive.
> There is an option --eval=STRING, but I don't think it fulfils the
> need.
No, this has nothing to do with that.
- GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Paul Smith, 2023/07/10
- Re: GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Paul Smith, 2023/07/10
- Re: GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Paul Smith, 2023/07/10
- Re: GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Bruno Haible, 2023/07/10
- Re: GNU make troubleshooting, Paul Smith, 2023/07/10
Re: GNU make troubleshooting,
Paul Smith <=
Re: GNU make troubleshooting, Jeffrey Walton, 2023/07/10