[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
27.11 Debugging Make Rules
The rules and dependency trees generated by automake
can get
rather complex, and leave the developer head-scratching when things
don't work as expected. Besides the debug options provided by the
make
command (see (make)Options Summary section `Options Summary' in The GNU Make Manual), here's a couple of further hints for debugging makefiles
generated by automake
effectively:
-
If less verbose output has been enabled in the package with the
‘silent-rules’ option (see section Changing Automake's Behavior), you can use
make V=1
to see the commands being executed. -
make -n
can help show what would be done without actually doing it. Note however, that this will still execute commands prefixed with ‘+’, and, when using GNUmake
, commands that contain the strings ‘$(MAKE)’ or ‘${MAKE}’ (see (make)Instead of Execution section `Instead of Execution' in The GNU Make Manual). Typically, this is helpful to show what recursive rules would do, but it means that, in your own rules, you should not mix such recursion with actions that change any files.(7) Furthermore, note that GNUmake
will update prerequisites for the ‘Makefile’ file itself even with ‘-n’ (see (make)Remaking Makefiles section `Remaking Makefiles' in The GNU Make Manual). -
make SHELL="/bin/bash -vx"
can help debug complex rules. See (autoconf)The Make Macro SHELL section `The Make Macro SHELL' in The Autoconf Manual, for some portability quirks associated with this construct.