Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool to analyse makefiles?

I want to analyse some parameters of C makefiles, e.g. compiler flags and what are the requirements to set this flag. Is there a tool helping me to analyse makefiles in this manner?

UPDATE

I am looking for what command line will be executed in which circumstances (e.g. different optimization for specific architectures, ...), especially what compiler flags are set in which circumstances.

like image 318
Maximilian Avatar asked Jan 08 '23 03:01

Maximilian


1 Answers

Yes and no.

Yes there are Makefile Analysis tools available:

SYMake provides a symbolic evaluation algorithm that processes Makefiles and produces a single symbolic dependency graph (SDG) to represent all possible build rules and dependencies among files via commands.

MAKAO provides the following features:

  • Visualization of the build dependency graph
  • Querying of build targets and dependencies for their build commands and variables
  • Filtering of the build dependency graph using Prolog rules to reduce clutter or to identify build idioms
  • Verification of the presence of bad smells in the build dependency graph

remake is an enahanced version of GNU Make that adds improved error reporting, better tracing, profiling and a debugger.

No in the sense that these tools don't spell out which targets are executed and when, and they don't optimize for specific architectures, although cmake is known to be useful when dealing with multiple platforms. You can determine this by - get ready for the disappointing answer - looking at your Makefile.

You can manually debug your Makefile using make -n and make -np, and make -nd(gmake specific) when you build.

Also here, and here are some more links to help debug

like image 183
wizurd Avatar answered Jan 31 '23 05:01

wizurd