David James wrote:
I've never really been clear on where units from the RTS are intended to be placed, and I'm even more uncertain now that I'm migrating from GPC 19991030 to GPC 20010306 ...
Suppose I have a program that 'uses gpc' (one of the units from the GPC RTS). Where should gpc.o and gpc*.gpi be (this is under Linux)? And should they have been placed there by the make install when I built the compiler?
I'd like to be able to say gpc prog.p and have it automatically find the gpc unit at compile time and at link time. At the moment I've put gpc.o and gpc*.gpi in the same directory as the program, and am specifying gpc.o in the command line, but there must be a neater way of doing it ...
The source of the units should remain in the directory where they're installed, i.e. <prefix>/lib/gcc-lib/<target>/<gcc-version>/units. If GPC was built correctly, it should find them there automatically (try `gpc --print-file-name=units' if not).
The object and GPI files can be put basically anywhere. I prefer to have a directory set apart for them (~/objects, with subdirectories for debug (compiled with extra checks) and release (compiled with optimization) versions, and subdirectories for various platforms, since I do a lot of cross-building), and when there are any problems with old GPI files (like after a compiler upgrade), I just remove that directory entirely.
Some useful options are:
--automake compile units when necessary and link their object files automatically, so you won't have to specify gpc.o on the command line
--unit-path=DIR:DIR:... search path for other units, i.e. not those shipped with GPC (they should be found automatically) and not in the current directory -- e.g., I keep my personal and 3rd party units which are not project-specific in ~/units and have set this as my default unit path
--unit-destination-path=DIR where to put (and find) the object and GPI files (for me: ~/objects/{debug,release}/<platform>)
--executable-path=DIR where to put the executable
--executable-file-name name the executable like the source file (foo.pas -> foo[.exe])
Frank