[fpc-devel] Re: Fpc Target directory function

Peter Vreman peter at freepascal.org
Wed Jan 30 11:39:04 CET 2008

> is the most ugliest crap I've seen in Pascal code, which is why I made
> the FpcTargetDir function.
> FpcTargetDir is simply cleaner and more elegant.
>> And there is no generic rule that says that you need to encode
>> TargetDir like cpu-os for every program.
> Not for every program.. but never make assumptions about what people use
> fpc for ;-)

The RTL should be kept lean and mean and not overloaded with nice-to-have for a couple of users.
And  in my opinion that you create create your personal

function FpcTargetDir:string
result:={$I %FPCTARGETCPU%}+'-'+{$I %FPCTARGETOS%};

is a clean solution. An other user might code it like:

function FpcTargetDir:string
if result='' then
  result:={$I %FPCTARGETCPU%}+'-'+{$I %FPCTARGETOS%};

It all depends on the personal preference of the user. And the end-result is just a syntax issue
and asking for an extension. There have been numerous of discussions about this that just a
shorter syntax is not a reason to extend FPC.

> Fpc is a cross platform compiler and me I am working on stuff to
> clean the i386-win i386-linux style directories. I am also working
> on something to ship a binary Exe demos for windows, bsd, linux,
> all in one zip package. And my Exe and Elf need to be put in folders.
> FpcTargetDir folder is perfect to notify people what platform the Exe
> is for.
> It should also come in handy for FPMAKE or you must have a function in
> use like that already.
> So someone else has already found a need for it (me) along with fpmake
> authors (must have used a similar function?).
> I will keep it in my own units.. but sometimes I wonder why I have all
> these useful functions that could be shipped with fpc so the public
> could use it, since you never know what the public is using fpc for.
> Who would have thought, for example, someone used FPC as a make build
> system. Never assume.

Maybe you should look into the sources more closely before talking programs you didn't create. The
fpmake system can't use {$I %FPCTARGETCPU%}. It needs to retrieve the information from the
compiler to support cross compiling.


More information about the fpc-devel mailing list