Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-08

Unit output directory

9 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Under Lazarus I can specify the unit output directory as follows: ../../lib/$(TargetCPU)-$(TargetOS)

I'm trying to do the same thing from the command line (without Lazarus), but FPC doesn't know about the TargetCPU or TargetOS macros. Is there something else or similar I can use in my custom extrafpc.cfg file to get the same result?

-------------[ extrafpc.cfg ]----------------
......

# Unit output path
-FU../lib/$(TargetCPU)-$(TargetOS)

......
----------------------- END -----------------

if I run the following from the command line:
fpc @extrafpc.cfg gui/fpgui_package.pas -dRELEASE -dX11

I get the following errors:

Compiling ./corelib/x11/x11_xft.pas
x11_xft.pas(161,1) Error: Can't create object file: ../lib/$(TargetCPU)-$(TargetOS)/x11_xft.o
x11_xft.pas(161,1) Fatal: Can't create object
../lib/$(TargetCPU)-$(TargetOS)/x11_xft.o
Fatal: Compilation aborted
Error: /opt/fpc_2.1.5/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

Regards,
- Graeme -

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 10 lines
Hi, Under Lazarus I can specify the unit output directory as follows: ../../lib/$(TargetCPU)-$(TargetOS) I'm trying to do the same thing from the command line (without Lazarus), but FPC doesn't know about the TargetCPU or TargetOS macros. Is there something else or similar I can use in my custom extrafpc.cfg file to get the same result?

User's manual, section 5.3 "Variable substitution in paths".

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
User's manual, section 5.3 "Variable substitution in paths".

That obvious!! ;-) Thanks Michael. It works perfectly now.

PS:
Not sure if I told you, but tiOPF Core is now GUI free! At last true non-gui apps can be written. I've also already ported the GUI Mediators (MGM pattern) to fpGUI making most fpGUI controls object-aware (if required).

Graeme.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: User's manual, section 5.3 "Variable substitution in paths". Michael.
Michael Van Canneyt wrote
> User's manual, section 5.3 "Variable substitution in paths".

Another question... (sorry). I read the whole chapter 5 and looked at the fpc parameters and couldn't find any hints.

I now specify a unit output path as follows:

-Fu../lib/$fpctarget

Again trying to compile my project I got a problem. Under Linux on my system the above equates to: ../lib/i386-linux
...which is what I want, but if the $fpctarget directory doesn't exist before the compile, the compiler still gives a error.

How can I force the compiler to create the output directory if it doesn't exist? Is there another parameter for that?

If all else fails, I guess I can always just use a generic '../lib' unit output path for fpGUI.

Regards,
- Graeme -

Show quoted text 5 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Jonas Maebe
to Graeme Geldenhuys
Graeme Geldenhuys wrote
I now specify a unit output path as follows: -Fu../lib/$fpctarget

I guess you mean -FU...

How can I force the compiler to create the output directory if it doesn't exist? Is there another parameter for that?

No, the compiler does not create directories, only files. Creating such directories is the job of whoever (user)/whatever (IDE, Makefile) calls the compiler.

Jonas

Reply by email

Graeme Geldenhuys
to Jonas Maebe
Jonas Maebe wrote
I guess you mean -FU...

Ah yes. That's what I meant.

Show quoted text 6 lines
> How can I force the compiler to create the output directory if it > doesn't exist? Is there another parameter for that? No, the compiler does not create directories, only files. Creating such directories is the job of whoever (user)/whatever (IDE, Makefile) calls the compiler.

Ummm... damn. I was hoping to get away from Makefile's (for CLI users) and instead use a custom extrafpc.cfg file in each of the important directories. I guess it's back to reading the manual on Makefile.fpc and fpcmake.

Thanks to everybody who replied....

Graeme.

Reply by email

Jonas Maebe
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Ummm... damn. I was hoping to get away from Makefile's (for CLI users) and instead use a custom extrafpc.cfg file in each of the important directories. I guess it's back to reading the manual on Makefile.fpc and fpcmake.

Using custom fpc config files has its own issues, see http://www.freepascal.org/mantis/view.php?id=9450

The config file handling was simply not designed with this purpose in mind. fpcmake really is quite easy to use.

Jonas

Reply by email

Graeme Geldenhuys
to Jonas Maebe
Jonas Maebe wrote 6 lines
Using custom fpc config files has its own issues, see http://www.freepascal.org/mantis/view.php?id=9450 The config file handling was simply not designed with this purpose in mind. fpcmake really is quite easy to use.

Funny that. It's from Lars's PSP product that I got the idea to use custom config files. :-)

I'll have a look at fpcmake again... Just be warned - I might start asking even more questions. ;-)
But I'll read the manual again, before I do.

Graeme.

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys: That obvious!! ;-) Thanks Michael. It works perfectly now. PS: Not sure if I told you,…
Graeme Geldenhuys wrote 13 lines
On 30/08/2007, Michael Van Canneyt wrote: > > User's manual, section 5.3 "Variable substitution in paths". > That obvious!! ;-) Thanks Michael. It works perfectly now. PS: Not sure if I told you, but tiOPF Core is now GUI free! At last true non-gui apps can be written. I've also already ported the GUI Mediators (MGM pattern) to fpGUI making most fpGUI controls object-aware (if required).

No, you didn't tell me yet. This is excellent news :)

Michael.

Reply by email