Hi Michael,

In order to process
files/packages in the correct order, you need to specify the
dependencies correctly. This requires rigourous analysis of the
source files (uses clauses and include directives) with all the
correct defines in place etc.


I hit a similar requirement for pasbuild. But my solution ended up
being pretty straight forward. For an application project,
that's easy, as you only need the program unit to kick off the
dependency tree. I let FPC handle that.

However, when you compile a framework/library, like fpGUI for example,
there is no program unit, and there is no single "starting unit"
because of the complex dependencies. In the end, my solution was
pretty simple: as I'm scanning the src tree, I track all
*.pas,*.pp,*.lpr files and their directories for the FPC -Fu argument.
At the same time, I also track *.inc files and the directories they
are in, so I can build up the -Fi arguments.

PasBuild then simply generates a bootstrap program unit in the
'target' output directory, and I tell FPC to compile that with all the
-Fu and -Fi arguments I collected. FPC happily (and luckily) does all
the heavy lifting in calculating the dependency tree. :)


Regards,
- Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to