2 level dependencies in Makefiles

"[email protected]" <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization http://groups.google.com
Message-ID <[email protected]>
Imagine the following Makefile:

***********BEGIN
all: 1.a

1.a: 1.o
        cat 1.o >> 1.a

1.o: 1.c
        cat 1.c >> 1.o
***********END


Then, if I have file "1.c", this is
what happens:


john@tokio:~$ make
cat 1.c >> 1.o
cat 1.o >> 1.a

john@tokio:~$ ls
1.a  1.c  1.o  Makefile


Nothing new up to this point.

If I now delete "1.o"  and type "make" again,
this is what happens:

john@tokio:~$ rm 1.o
john@tokio:~$ make
cat 1.c >> 1.o
cat 1.o >> 1.a

That is, everything is rebuilt.

However I don't want everything to be rebuilt. Even
if the intermediate "1.o" file has changed, the final
result is going to be the same one.

Is there anyway I can tell gmake about this ?

The idea is to keep ".a" libraries in the CVS together
with the source code (but NOT the object files also)
and only compile source files when at least one of them
is newer than the CVS library.

Thanks !!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.