I'm working on SpiderMonkey project, which is a large scale project with a lot of .h and .cpp files. Despite of I know I changed only file or two files, each time I make a change on the project, I have to run the make
command and compile the whole project again to get the executable ./js
file.
So, my question is that is there any solution to avoid compiling all files and compile only specific files to get the new executable ./js
file?
make
utility has a meaning of target and dependency. Target is only rebuilt if any dependency is changed, otherwise it is considered up to date (a bit simplified explanation). The following Makefile will cause target to be rebuilt only if any object file is changed, and object file will be rebuilt only if source/header is changed:Having said that, you should probably review project's Makefile and check if dependencies are properly defined. Complicated build systems (e.g. autotools/automake) use $(CC) -M or -MM to build list of dependencies for sources.
P.S. Check that your source/header files dates are correct and not in the future -
make
usually issues warning on that case since it cannot correctly determine dependency changes. This might be especially important for NFS files, which are edited on one computer and compiled on another.