[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(no subject)
From: |
Maciej Walezak |
Subject: |
(no subject) |
Date: |
Fri, 29 Mar 2002 11:24:26 +0100 |
Hi there,
In my system I have a number (about 200) so called "packets" which act as a
sort of libraries. Each packet foo resides in directory foo and consists of
files:
foo.h
foo.c
tfoo.c
As a result of building a packet foo.h goes to $(idir) (is copied), foo.o to
$(odir) (after compilation) and tfoo to $(tdir) (after compilation and
linkage). The trouble is that in order to completly build a packet many other
packets must be build first, so that dependencies of foo.c, tfoo.c (.h files)
and of tfoo (.o files) are satisfied. The net of dependencies is so
complicated that is is virtually impossible to guess the correct order of
compilation.
So I have written a "master" makefile wich looks like this (in real makefile
all files are prepended by paths):
all: foo.h foo.o sth.h sth.o junk.h ...
foo.h foo.o: bar.h junk.h sth.h bar.o junk.o sth.o
command-to-build-packet foo
sth.h sth.o: other.h junk.h other.o junk.o
command-to-build-packet sth
the command-to-build-packet is just 'make -C <packet> all install'
Now where is the problem:
Supposing packet sth has been build from scratch by hand, then sth.o and sth.h
are the newest of all file. Running this makefile causes make to invoke 'make
-C foo all install' for foo packet, which is all right now -everything is
recompiled. But second execution of make cause make also to invoke command to
build packet foo. It is because foo.h in its destination dir depends on foo.h
in foo dir and nothing else. So the make for packet foo does nothing.
Sometimes after touching a single file several dozens of commands are invoked
that do not nothing, which is very annoying.
But I must to write the rules this way, as command-to-build-packet creates all
the files, not only the one for which it has been invoked.
So, without writing dependencies for foo.h the command-to-build-packet will
fail, as the compilation of foo.c will fail due to unsatisfied dependencies.
What I need is: how to write such "master" makefile that would know all the
dependencies and would build packets in proper order without any redundancies.
I hope I made myself clear (my english isn't perfect). I was trying to devise
some better solution for this but I did't manage to. You are my last resort.
thanks in advance
--
Maciej Walezak
-GDN-
- (no subject),
Maciej Walezak <=