[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU make troubleshooting
From: |
Alejandro Colomar |
Subject: |
Re: GNU make troubleshooting |
Date: |
Sun, 27 Aug 2023 13:17:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 |
Hi Paul,
On 2023-08-26 18:48, Paul Smith wrote:
> I added a new appendix to the GNU make manual for troubleshooting help;
> I haven't pushed it yet. See below. Comments welcome.
>
> I think the outline you provided earlier, Bruno, has the problem that a
> lot of it isn't really about troubleshooting per se, it's about how to
> write makefiles in general. I tried to restrict this specifically to
> describing the types of problems you might see and the steps you might
> take to troubleshoot them.
>
> I'm thinking of adding another chapter on hints and tips for writing
> good makefiles.
>
> -----------------
> Appendix C Troubleshooting Make and Makefiles
> *********************************************
>
> Troubleshooting 'make' and makefiles can be tricky. There are two
> reasons: first, makefiles are not procedural programs and many users are
> used to procedural languages and scripts. Second, makefiles consist of
> two different syntaxes in one file: makefile syntax, that 'make' reads,
> and shell syntax, which is sent to a shell program for parsing and
> execution.
>
> If you have problems with GNU Make, first consider the type of
> problem you are having. Problems will generally be in one of these
> categories:
>
> * A syntax or other error was reported when 'make' attempted to parse
> your makefiles.
>
> * A command that 'make' invoked failed (exited with a non-0 exit
> code).
>
> * The command that 'make' invoked was not the one you expected.
>
> * 'make' was not able to find a rule to build a target.
>
> * 'make' rebuilds a target that you didn't think was out of date.
>
> * Or, 'make' did not rebuild a target that you expected it to build.
>
> The strategies for troubleshooting differ for different types of
> problems. For issues related to how makefiles are parsed, strategies
> include:
>
> * Using the '-p' option to show the makefile database, after
> evaluation (*note Summary of Options: Options Summary.).
>
> * Using the 'info' function to understand how elements of the
> makefile are expanded (*note Functions That Control Make: Make
> Control Functions.).
>
> For issues related to how rules are applied, strategies include:
>
> * Removing the '@' prefix from recipes, so you can see the commands
> make is invoking to rebuild the target (*note Recipe Echoing:
> Echoing.).
>
> * Using the '--trace' option to explain which rules 'make' invokes
> and why (*note Summary of Options: Options Summary.).
>
> * Using the '--debug=v,i' or '-d' options to show how 'make' is
> determining which recipes should be used, or why targets do not
> need to be rebuilt (*note Summary of Options: Options Summary.).
>
> * Menu:
>
> * Parse Error:: Syntax errors when parsing makefiles.
> * Command Failure:: Recipe commands exit with error codes.
> * Wrong Rule:: 'make' chooses the wrong rule.
> * No Rule Found:: No rule was found to build a target.
> * Extra Rebuilds:: Targets are rebuilt unnecessarily.
> * Missing Rebuilds:: Out-of-date targets are not rebuilt.
> * Troubleshooting Strategies:: Strategies used for troubleshooting issues.
>
>
> C.1 Errors When Parsing Makefiles
> =================================
>
> This type of error is the simplest to resolve. The error output you
> will see will have a format like this:
>
> Makefile:10: *** missing separator. Stop.
>
> This message gives you all the information you need to address the
> error: it gives the name of the makefile (here 'Makefile') and the line
> number (here '10') in that makefile where GNU Make's parser failed.
> Following that is a description of the error. Further explanations of
> these error messages can be found in *note Errors Generated by Make:
> Error Messages.
>
When using .SECONDEXPANSION, this becomes a bit more tricky. It would
be interesting to recommend to put an $(info $(SUSPECT_VARIABLE)) right
before lines where you don't see the issue at first glance.
You already mention $(info) in the overview above, but I think a
reminder here might be useful.
Cheers,
Alex
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
OpenPGP_signature
Description: OpenPGP digital signature
- Re: GNU make troubleshooting, (continued)
- Re: GNU make troubleshooting, Paul Smith, 2023/08/27
- Re: GNU make troubleshooting, Paul Smith, 2023/08/27
- Re: GNU make troubleshooting, Alejandro Colomar, 2023/08/27
- Re: GNU make troubleshooting, Alejandro Colomar, 2023/08/27
- Re: GNU make troubleshooting, Paul Smith, 2023/08/27
- Re: GNU make troubleshooting, Alejandro Colomar, 2023/08/27
- Re: GNU make troubleshooting, David Boyce, 2023/08/29
- Re: GNU make troubleshooting, Paul Smith, 2023/08/29
- Re: GNU make troubleshooting, Eli Zaretskii, 2023/08/27
- Re: GNU make troubleshooting, Paul Smith, 2023/08/27
Re: GNU make troubleshooting,
Alejandro Colomar <=