Sign in Join
Wiki copytemporary

Revision 1 of 3, by Mattias2 on 3-28-2024. The page as it is now.

IDE Macros in paths and filenames

Types of Macros

There are various types of macros:

IDE macro format

IDE macros are used in the following format. Replace the macro-name part with one of the macros listed below.

$(macro-name)

For example: This "Unit Output directory" is often used for Lazarus Packages:

lib/$(TargetCPU)-$(TargetOS)

There are also some macro functions that use the following format:

$macro_name(parameters)

For example

$Ext(unit1.pas)

will give .pas.

Windows: Compiling to a RamDrive where each project gets its own unit directory (Project> Options> Unit Output Directory)

 R:\FPC\$NameOnly($(ProjFile))

MacOS: A more complex example but very useful, when you want to compile on its name $NameOnly($(ProjFile)) on a specific CPU target -$(TargetCPU)'' saving the compiled file on the package path**.app/Contents/MacOS/**''

$NameOnly($(ProjFile))-$(TargetCPU).app/Contents/MacOS/$NameOnly($(ProjFile))-$(TargetCPU)

General Purpose

Filename Parts

Paths and Parts

Environment

\

Macros in IDE addons

Here is an incomplete list of macros added by IDE packages:

Pas2jsDsgn

ProjectGroups

Delphi compiler tool


From the Free Pascal wiki, page "IDE Macros in paths and filenames", as it stood on 2024-03-28 after a change by Mattias2, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.