Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Just adding some documentation triggers recompilation: Is there a solution?

Sometimes, when I look through my header files I'd like to add something little to the (doxygen) documentation. That might be a quick note about the use of some function parameter, or just fixing a little typo.

But then I think: Oh no, that'll trigger a recompile on the next make call! And for certain basic headers the whole project would recompile, which can take a long time. So, nevermind!

Is there a solution to this dilemma? Are there approaches where the functions/classes are documented not directly in the headers? Or are there (plans for) a smart make that would notice that only some comment has changed, but no recompilation is necessary?

like image 455
Frank Avatar asked Nov 21 '25 08:11

Frank


1 Answers

You could shorten the compile times using ccache, possibly with the CCACHE_UNIFY environment option set.

ccache hashes the pre-processor output, and serves the previously compiled object if no changes were detected.

Man page section about CCACHE_UNIFY

CCACHE_UNIFY

If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor output if -g is not used in the compile. The unifier is slower than a normal hash, so setting this environment variable loses a little bit of speed, but it means that ccache can take advantage of not recompiling when the changes to the source code consist of reformatting only. Note that using CCACHE_UNIFY changes the hash, so cached compiles with CCACHE_UNIFY set cannot be used when CCACHE_UNIFY is not set and vice versa. The reason the unifier is off by default is that it can give incorrect line number information in compiler warning messages.

like image 112
Hasturkun Avatar answered Nov 23 '25 22:11

Hasturkun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!