short answer: these are completely different programs. to compare them is pointless: they are not interchangeable.
slightly longer answer:
The make program is completely unrelated to compilers, and the ccache program is the compiler cache for C, C ++, Objective-C, and Objective-C ++ . The standard way to use it is to “substitute” the compiler (for example, by creating symbolic links of the form /usr/local/bin/cc ).
The basic idea is to detect when it was previously issued. (my free translation: the basic idea is to determine when you compile the same code a second time and use the result that is already ready ).
very simple, without nuances and details
in the compilation process creates a so-called. object module ( object file ) . for example, as a result of executing the cc -c файл.c will be received
which can later be used by the linker ( linker ) to create an executable file with the program.
quite often the executable file is composed of several object modules. and if we “head on” automate this process ( cc -c файл1.c && cc -c файл2.c && cc файл1.o файл2.o -o программа ), then each time you call this long command all will be compiled again and again source files, even if we made a change, for example, to only one of them.
To avoid recompilation of unchanged files, you can use, for example, the make program, which does not actually compile, but helps to avoid performing repeated actions where it is not required. well, if there are appropriate rules in the makefile , where the dependencies between the files and the ways of updating those files that need updating are described.
An example of such rules:
- if
файл.c newer than файл.o , then run the command cc -c файл.c - if the
файл.o newer программа , then run the cc файл.o -o программа command. The cc файл.o -o программа
All this works fine if we have one project (and the object files are not deleted after compilation). and if there are several projects, and in all of them (or at least some), the файл.c with identical content is used? the make program here does not help to avoid multiple compilations of the same file in different projects.
here, the ccache program mentioned above can help us (if we “replace” the cc program with it).
the algorithm is simple:
- if the transferred file has not yet been compiled, then compile it by calling the "real"
cc , and copy the result (object module) into the cache. - if the transferred file has already been compiled, then copy the ready object module from the cache.
It is not a problem to identify the cached output. (my free translation: to determine that the file is “the same”, hashing of various types of information is used, which should be unique for a given compilation, and these hash sums allow us to calculate which of the cached results should be used ).