CBFalconer wrote:
Frank Heckenbach wrote:
... snip ...
Which should be hidden from the user. For now, a Makefile is one way to do it. In the future, we can think about integrating it into the gp utility (which might be a good place for all such kinds of things).
Which brings up a point. To me, it is entirely unclear how to use a makefile with gpc. There may well be something hidden away in the docs which I have not found. At any rate, an example using GNU make on a reasonably complex system would be useful. This should include more or less the gamut of 10206 modularization. A second example might implement Borland style units.
Either use automake, then you don't need much of a makefile at all (at least not for compilation which is done with a single GPC invocation; you might, of course, want to use a makefile for installation, building documentation and whatever).
Otherwise, do it basically like in C, i.e. compile all you units/modules and the main program with `-c' and link everything at the end. You'll have to add all dependencies yourself. For a program/unit/module that uses some unit/module, make it dependent on the object or gpi file of the latter. In case of circular unit/module dependencies, you have to compile one with `--interface-only' first (I haven't tried to teach this to a Makefile, but it should be possible using dependencies on the gpi file for the interface and the object file for the implementation or so).
In my previous example with the dispatcher, I'd still use automake, something like this (where $(SRC) contains a list of all source files):
dispatcher.pas: $(SRC) make-dispatcher -o $@ $(SRC)
myprog: $(SRC) dispatcher.pas gpc --automake ...
Frank