Multithreading parsing concludes (-j N)

I have many source directories in a shared directory. When I start doing, issuing the command:

make -j 4

I get a lot of lines from creating threads along with called instances of the gcc compiler. To parse the errors, I have to run make twice, the second time with one thread:

make -j 1

so i can parse make output correctly.

Is there a way to run multi-threaded make once and correctly decide which error is associated with which project (source directory)?

Thank!

+3
source share
3 answers

make ( ) -j, Make script, .

$ cat M
#!/bin/bash
PREFIX=$$:
exec -a $0 make "$@" 2>&1 | sed "s/^/$PREFIX/"

, make ${MAKE} , ./M make.

$ ./M -j --no-print-directory target
28720:/home/user/M -fa.mak
28720:/home/user/M -fb.mak
28720:/home/user/M -fc.mak
28720:/home/user/M -fd.mak
28720:/home/user/M -fe.mak
28720:32484:gcc blah...
28720:31936:/home/user/M -fanother.mak
28720:32484:gcc blah...
28720:31936:gcc blah...
28720:31936:gcc blah...
28720:31936:56781:echo blah...

( make). M , .

+6

, pmake?

PMake (source)

+1

If you are using some kind of meta-assembly system (e.g. CMake), try using Ninja to actually start the assembly.

It solves this problem as well as much faster.

+1
source

Source: https://habr.com/ru/post/1781994/


All Articles