Holger Hoefling <hhoef...@gmail.com> writes: > I have a problem/request for org-mode and was looking for help. I am > using org-mode to write source code files and tangle them out. I want > to compile them using make. My problem now is that org-mode overwrites > the old files every time I tangle them out, therefore also updating > the time stamp - even if nothing has changed. Subsequently, when I run > make, everything gets recompiled, not just the changed source code > files as all time stamps have changed.
Make really doesn't have the smarts to deal with builds that it doesn't fully control. In your case, the actual source aren't the tangled files, but really (parts of) an orgmode file. With a bit of clever organization it should be possible to employ git to keep track of the "sources" for make. In a nutshell, you'd check in the sources into a repository and only compile those that are different from the last commit. After the successful compile you autocommit the tangled files. Since you will probably don't need version control of the tangled files (although that might be useful for debugging of the tangling process itself), you could either amend each commit or just periodically chop the repository and do a garbage collect. Putting the smarts into orgmode to keep track of each tangle block looks complicated in the general case; while possible is a bit of a stretch IMHO. It would also produce false positives for a lot of cases that I'd consider useful (splitting or fusioning tangle blocks without changing the result). But the solution outlined above could be used if the content of each file to be tangled was always available in full in a buffer before writing to the tangled file. The buffer could just be dropped if the SHA1 of the file on disk and the buffer content is identical. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Terratec KOMPLEXER: http://Synth.Stromeko.net/Downloads.html#KomplexerWaves