Michael A. Hess wrote 31 lines
Marc Weustink wrote:
>
> Hi,
> While addapting the makefiles I ran into the following problem:
>
> In the interface unit A uses B
> In the interface unit B uses C
> In the implementation unit C uses A
>
> When you compile A, unit B and C are created as well. If you compile A
> again unit B is recompiled, since the checksum for C is changed.
> This is IMO not correct, nothing is changed.
It shouldn't. If you compile A it used B so it depends on B being
compiled FIRST. When B tries to compile before A it determines that C
must be compile FIRST. So first C is compiled then this allows B to be
compiled which then allows A to be compiled. The lowest on in the chain
is always compiled first. If you make changes to unit A and try to
recompile it it will note that neither B or C has changed since A was
compiled last and will not recompile them.
Now that is at least HOW it should work. If you are seeing something
different then there is a problem.
If you compile A then the make file should never ask B or C to compile
since the date check will have determined that they were already
compiled by A.
What leads you to believe that this isn't working? I'm not say it is or
isn't or that your analysis isn't correct I just haven't seen this
problem yet.
I'm not talking about the creation order nor changingfiles nor using make.
As you confirmed, if you compile A, C and B are compiled first. Correct. If you don't change anything and you recompile A, B and C are still there and it shouldn't be necesary to recompile them.
What I see is that unit B is recompiled the second time I compile A. After that only a is compiled.
Try the example I've attached.
marc:~/fpc/lazarus/examples/test$ ppc386 a
Target OS: Linux for i386
Compiling a.pas
Compiling b.pas
Compiling c.pas
Compiling a.pas
Compiling b.pas
Assembling (pipe) b.s
Assembling (pipe) a.s
Assembling (pipe) c.s
57 Lines compiled, 0.0 sec
marc:~/fpc/lazarus/examples/test$ ppc386 a
Target OS: Linux for i386
Compiling a.pas
Compiling b.pas
Assembling (pipe) b.s
21 Lines compiled, 0.0 sec
marc:~/fpc/lazarus/examples/test$ ppc386 a
Target OS: Linux for i386
Compiling a.pas
6 Lines compiled, 0.0 sec
marc:~/fpc/lazarus/examples/test$
What I try to make clear is as long as this "recompilation" is the case we can't create an "indepandent" LCL, IE, a LCL with only compiled units. For every project, the compiler wants to rebuild the LCL (and that's something we don't want).
Marc