1

The -j option of GNU Make is handy although you have to be careful about your dependencies. In my environment it has sped up build and test times 5-6 times. But I want to run my tests with coverage and this creates a problem since the gcov instrumentation does not handle concurrency well, basically trying to write to the same .gcda file simultaneously.

I've figured out how to steer coverage information into separate directories for each test, which works. However this incurs the penalty of post-processing all coverage information.

So I'm looking for a way to know if -j has been used in the invocation, to be able to automatically avoid the extra processing if it is not necessary. Is that possible?

thoni56
  • 3,145
  • 3
  • 31
  • 49
  • By default you should be able to access parameters used to call `make` throug `MAKEFLAGS` which is there essentially to know how `make` has been invoked and to allow propagating them into sub-make process(es). – Ondrej K. Sep 02 '20 at 10:50
  • Gaah, of course! Thanks. Make that an answer and I'll accept it. – thoni56 Sep 02 '20 at 10:52

1 Answers1

0

By default you should be able to access parameters used to call make through MAKEFLAGS which is setup automatically and is there essentially to know how make has been invoked and to allow propagating them into sub-make process(es).

Ondrej K.
  • 8,841
  • 11
  • 24
  • 39