views:

22

answers:

1

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?

A: 

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 \
  ; ...
Ken Smith
I think this does not really cover all the cases. If a user updates his/her sources from svn and does a make -since sentinel files are not touched- nothing will be built. Am I wrong?The goal is to build but to avoid unnecessary builds.
l.thee.a
That is correct. But since we're talking about autoconf based libraries, I figured they were a bunch of third party packages you need to install and so they would only change when you decided to upgrade. If that is the case, then you can hack the DAG using a trick like this. If not, then maybe give me a concrete example of what you're doing and I'll modify my suggestion.
Ken Smith