c - How to keep two related files in sync? -


suppose have makefile containing similar this:

program.revision: smaug     git rev-parse head > program.revision  program: $(obj)     $(cc) -o $@ $^ $(ldflags) 

the aim clear: want program.revision always mirror revision of source created program.

but wrote , realized not adequately cover needs nor concerns:

  1. if compile of program fails half-way, old (working) version of program left behind, or deleted?

  2. related point 1, how make sure if program deleted, program.revision deleted well? , similarly, if old build survives, old program.revision remains intact?

  3. how make sure program.revision in sync, if execute make program opposed plain make?

  4. i realize problem made considerably simpler deleting old files prior building them, important minimize chance program ends missing due failed build.

how handle situation?

edit:

after writing this, realized problem might not think is. aim have build of program know revision created with, maybe answer isn't in makefile , program.revision file, instead in finding way compile information executable. hmm..


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -