Adriaan pointed me at the --print-only option of gp, and I was wondering about its use in setting up a Makefile (which is probably pointless since gp does that anyway).
I haven't previously used gp, I've only used gpc with perl generate Makefiles.
So I figured I'd try using gp. But I'm running in to some problems.
First, gp never finished (well, the Makefile compiles everything in a bit over a minute, and gp was still going after 12 minutes, probably not making any progress, but possibly make progress very slowly). I turned on -v and it is endlessly listing out files "compiling implementation because target files not found or not up to date".
I use --unit-destination-path and --object-path to keep the source directory unpolluted, and possibly because the names have capitals in them, or perhaps the compile options are not identical, some combination of all that means that gp cannot find the .gpi or .o file when it looks at each source file. So it has to go and compile the source file.
But because it is "print only" the output of the compilation is not stored, so GPC has to compile each unit once for each unit it is included in, which is horrendous duplication.
The first problem can be resolved presumably by using gp instead of gpc to compile it, and then either the object-path/unit-destination-path will work for both saving them and finding them, or a bug will have to be noted and resolved.
But the second problem would appear to be challenging since it would always be the case after a clean rebuild. I don't quite see how this can be resolved, but I don't have a deep understanding of gp or the problem just yet.
Hmm, no, it seems worse than that, even without --print-only it is doing much the same thing, endlessly saying it cannot find things.
Ahh, hmm, interesting error. If I compile one of my base units, then it endlessly tries to compile GPCMacOSAll.pas - because it cannot find the .gpi or the .o, and so tries to compile it, but then it uses the unit in the unit, and dies recursively. Does --uses actually work in any useful way with gp? Because it appears if the --uses option is on, then gp does not find the pre-existing compiled unit, but you cannot compile it using gp with the --uses flag. So either way it does not seem to work.
And even if I remove the --uses option, and the --print-only option then the compilation still seems to be endlessly listing out files it jas to compile. It does seem to make very slow forward progress, but seems to be endlessly recompiling the lower level units, for example:
gpc -D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__APPLE__ -g -O2 --include=/Source/PNLLibraries/Prefix.GPC --unit-path=/Developer/Pascal/GPCPInterfaces:/Source/PNLLibraries:/Source/MacOSXSupport:/Users/peter/Interarchy/Project/Build/ --object-path=/Users/peter/Interarchy/Project/Build/Objects -I /Users/peter/Interarchy/Project/Build/Objects -I /Users/peter/Interarchy/Project/Build/Objects/ -I /Developer/Pascal/GPCPInterfaces -I /Source/PNLLibraries -I /Source/MacOSXSupport -I /Users/peter/Interarchy/Project/Build/ -I /Users/peter/Interarchy/Project/Build/Objects/ -I . -I /Developer/Pascal/gpc343d6/lib/gcc/powerpc-apple-darwin7/3.4.3/units -I /Source/MacOSXSupport/ --unit-path=/Source/MacOSXSupport/ -E -H /Source/PNLLibraries/MyCalcCRC.p #progress+# #progress-# #progress# /Source/PNLLibraries/MyLowLevel.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyAssertions.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyFileSystemUtils.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyMathUtils.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyMemory.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyStrings.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyExtraErrors.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyTypes.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyFSXSpecs.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyStrNums.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyAssertions.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyMathUtils.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyCStrings.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyTypes.p: compiling because target files not found or not up to date /Source/MacOSXSupport/MyUnixTypes.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyFSXSpecs.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyAssertions.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyMathUtils.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyUtils.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyLowLevel.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyGetString.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyTypes.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyLongStrings.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyAssertions.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyTypes.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyStartup.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyAssertions.p: compiling because target files not found or not up to date /Source/PNLLibraries/MyLowLevel.p: compiling because target files not found or not up to date...
So basically the same units are being compiled over and over again.
It is possible there are implementation unit cyclic dependencies, perhaps that is the problem? It's possibly because some of the units are not successfully compiling because of the lack of --uses since I can't get that to work.
So it may come back to the question of "can you use --uses" with gp successfully?
I know I need to go and build some smaller examples of the problem, but I figured I'd ask if any of these are known issues first.
Thanks, Peter.