Marten Jan de Ruiter wrote:
However, currently I am compiling a FE program using the automake option, and it turns out that the build is recursively. Creating a log file (using gpc -v and editing a bit) yields the following result:
1 /tmp/ccAHxoUT.i 2 ch_const.p 3 general.p 4 NODES/nodes.p 5 MATERIAL/constitution.p 6 NODES/nodes.p 7 MATERIAL/constitution.p 8 ELEMENTS/elements.p 9 NODES/nodes.p 10 MATERIAL/constitution.p 11 NODES/nodes.p 12 MATERIAL/constitution.p 13 ELEMENTS/elements.p 14 global.p 15 NODES/nodes.p 16 NODES/SCAL/scalnode.p ...
The main program uses the units ch_const, general, initnode, ... where initnode uses nodes, constitution, elements, ... whele elements uses nodes, constitution, ... Looking at the log file, NODES/nodes.p is compiled multiple times due to the recursive nature of automake.
I can't reproduce this. If I create the attached files according to this description, and look for `gpc1', each of the 7 files is compiled exactly once.
Invocations of `gpcpp' do not always mean compilation. Some of them are needed to find possible include files which must be taken into account when deciding whether to recompile. It's possible that this happens more often (here: 13 times in the worst case I found), though I'd be surprised if it's more than quadratic since indirect imports shouldn't be considered. If you can show me such an example (maybe just the import structure of your project without the actual code), I'll try to fix it.
In the future, the internal automake mechanism will be replaced by an external tool which can "oversee" things better and save unnecessary gpcpp invocations, much like you suggested.
That this really is a problem can be seen from the fact that, according to top, the size of gpc1 is 611M, and running for 2920min, whereas a previous version of gpc only took minutes.
This looke like another kind of problem since the number of compiler invocations should not have much influence on the size of a single one.
Is one of the generated gpi files very large? If so, you might want to try building the gpidump utility (in p/utils in the GPC sources) and apply it to that file to see if there's a problem there (such as the same imports listed again and again).
Frank