On Sat, 2007-11-03 at 23:00 +0100, Felix Fietkau wrote:
> Bernd Petrovitsch wrote:
> > On Sat, 2007-11-03 at 18:00 +0100, Felix Fietkau wrote:
> > [....]
> >> with certain make versions, running make in the olsr directory loops
> > Which version(s)? On which OS/systems/...?
> OpenWrt, Linux, Make 3.81

Any special options etc. for make there?

> >> forever rebuilding a dependency file. This is caused by a bogus .PHONY
> > That sounds quite strange. Rebuilding it 2 times (or so) may be possible
> > (due to multiple dependency resolutions) but I doubt that it will last
> > infinitely?
> > Any log file?
> It prints
> Entering directory <build dir>...
> Leaving directory <build dir>...
> in an endless loop.

Extremely strange, I never saw that anywhere AFAIR (not only for olsrd
but in my whole life).
Hmm, `make -d` output is probably enormous (even if you stop quite
early).

> >> statement (which is erroneously used on a real file target).
> > Actually this file purposely always generated to reflect the build time
> > of the daemon (and compiling the beast from CVS-HEAD several times a day
> > requires to put the time and build host in).
> Maybe it would help to give it a different file extension. The problem

Why not if it makes life easier?
A similar question is if it wouldn't be more portable to not rely on
default make rules?
Somewhat current GNU-`make`s probably don't have a problem (since we
don't use any too fancy features IMHO) but I don't know about BSDs and
their default `make`. Or is there everyone using `gmake`?

And while I'm at it (and have another `make` guru here;-): There is
another dependency problem which I couldn't solve yesterday evening.
How to reproduce:
- `make clean_all; make build_all` just to build everything.
- edit oparse.y and `make build_all`
You will get a compile error afterwards. And you will see that a/the
default rule is used to create the .c file out of the .y file for the .d
file generation (and not the one in olsrd-current/src/cfgparser/Makefile).
Hmmm, I have to add a .SUFFIXES line to reduce the output on `make
-d`  ....

> seems to come from the interaction between a build-always rule and the
> automatic dependency generation. It jumps back and forth between generating
> the .c and the .d file.

Well, the .d files are checked and possibly build or rebuild if and only
if `make` encounters the "include *.d" statement.
That may trigger the rebuild of every included file once and shouldn't
do a "make -C " or something.

Then the contents is include'd.

And then the "normal" dependency check is done and targets rebuild.

And if `make` encounters recursive dependencies, they are detected and
cut (possibly not giving a correct or working solution - PEBKAC, write
better, unambiguous rules! - but at least avoiding infinite loops).

So actually while I'm believing you, I have absolutely no idea why this
could loop forever.

Yes, in a perfect world, we wouldn't use recursive make but ....

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



