Reputation: 371
I have a (large) Fortran project under Git. There are different active branches, corresponding to features under development. I would like to find a convenient way of maintaining a compiled version of the code for each branch.
The code is currently compiled using Make and all the object files are kept in a separate folder (like build_branch1) along with the binaries. The directory structure is like this:
Makefile
./src
./build_branch1/objects
./build_branch1/bin
./build_branch2/objects
./build_branch2/bin
...
In principle, I can therefore compile all the branches like this:
git checkout branch1
make --prefix=build_branch1
git checkout branch2
make --prefix=build_branch2
etc...
Make compares the timestamps of the sources (freshly checked out by Git) with the object files in the build_branchN folder and recompiles those that have changed. The problem is that Git changes the timestamps of all the source files that differ between branch1 and branch2, so that many files are re-compiled when they wouldn't need to be. Since the code takes a long time to compile (up to 30 minutes), this can be a major inconvenience.
I was wondering what should be the best strategy in this case. I am thinking of updating the timestamps after each checkout, like in this post: What's the equivalent of use-commit-times for git? What would you recommend?
Upvotes: 3
Views: 468
Reputation: 1323963
Instead of modifying timestamp on each checkout, you could use a mechanism which wasn't around at the time of those answers (including mine): git notes
.
You could:
The idea is to record the information you need:
Upvotes: 3