Tutorial :Make install causes recompiles



Question:

I am writing a master makefile to compile and install multiple autoconf based libraries, which depend on each other. All works well for the first go. The issue is: if I am working on one of these libraries individually and do "make && make install" header files in the prefix folder are overwritten (even if they are untouched). This causes all dependent libraries to compile from scratch.

Is there a way to avoid the unnecessary recompiles without hacking into the makefiles?


Solution:1

Maybe the solution is a little late, but

./configure INSTALL="install -p"  

fixes the recompilation problem. This flag makes GNU install set the timestamps of the installed files to the timestamps of the built files.


Solution:2

You could use sentinel files that exist only to establish your dependency graph. For eg.

prefix := /usr/local    .PHONY: all  all: libx-built    libx-built \    : libx.tar.gz \    ; tar xzvf $@ \    && cd libx \    && ./configure --prefix=$(prefix) \    && make && make install \    && touch $@  

Then, you'd make a dependent liby build only when libx-built is new.

liby-built \    : liby.tar.gz libx-built \    ; ...  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »