Call boolean make commands

Is there a way to register commands, make calls to compile a program? I know the -n and -p options, but they either do not allow if-conditions, but simply print them. Or they don’t work when there are calls to β€œmake” themselves in the Makefile.

+7
makefile
source share
5 answers

You can find what you are looking for in annotated build logs created by SparkBuild . This includes commands for each rule executed in the assembly, regardless of whether "@" was used to prevent printing from the command line.

Your comment on if-conditions is somewhat confusing, though: are you talking about shell designs or are you creating designs? If you mean shell designs, I don't think you have any way to get exactly what you need, except using strace, as described by others. If you mean make constructs, then the result you see is the result of a permitted conditional expression.

+1
source share

it

 make SHELL="sh -x" 

will invoke the shell (which calls the shell constructs) to print information about what it does, letting you see how any conditional expressions in shell commands are evaluated.

+7
source share

Records every command it executes in the console, so

 make 2>&1 | tee build.log 

will create a log file called build.log as a side effect that contains the same material that was recorded on the screen. ( man tee for more details.)

2>&1 combines standard output and errors into a single stream. If you did not enable this, regular output will go into the log file, but errors will only go to the console. ( make only writes stderr when the command returns an error code.)

If you want to completely disable output in favor of logging to a file, this is even simpler:

 make 2>&1 > build.log 

Since they just capture console output, they work great with recursive make .

+2
source share

You can try logging into execve log using strace

 strace -f -e execve make ... 
+1
source share

Have you tried using the -d (debug) option?

Please note that you can control the amount of information with --debug. For example, --debug = a (same as -d), or --debug = b to show only basic information ...

0
source share

All Articles