Sign in Join
Wiki copytemporary

IDE Macros in paths and filenames

Deutsch · English · Español · Français · Português · Русский

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.

text
$(macro-name)

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

text
lib/$(TargetCPU)-$(TargetOS)

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

text
$macro_name(parameters)

For example

text
$Ext(unit1.pas)

will give .pas.

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

text
 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/**''

text
$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.

Revision 3, last changed by Mattias2 .

Edited on wiki.freepascal.org by 16 people, 2006–2024

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Swen (minor)
Mattias2
Mattias2
Mattias2
Mattias2IDE Macros in CodeTools defines
Mattias2IDE Macros in CodeTools defines
Dblaszijk
AndrewHfixed typo (minor)
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
Mattias2
DoDiList reorganization (minor)
GgeldenhuysUsage example and better formatting
Mattias2General Purpose
Mattias2
Mattias2Filename Parts
Mattias2Paths and Parts
Mattias2Filename Parts
Mattias2Filename Parts
Mattias2
Mattias2
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Filename Parts
Mattias2Filename Parts
Mattias2Filename Parts
Mattias2General Purpose
Mattias2Paths and Parts
Mattias2Paths and Parts
Chronoscategory
Mattias2
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2
Mattias2Paths and Parts
Mattias2Filename Parts
BigChimpTypos, clarified Lazarus environment options to distinguish from OS environment variables; sorted macros
Mattias2
Mattias2Paths and Parts
Mattias2Paths and Parts
Jwdietrich
BigChimpdifference between symbols and macros
BigChimpclarify
Mattias2
Mattias2Environment
Mattias2Environment
Mattias2Paths and Parts
Mattias2Paths and Parts
Mattias2macro dependencies
Mattias2Environment
Mattias2Environment
Mattias2Paths and Parts
FTurtle
FTurtlecategory
PontiacIDE macro format (minor)
PontiacIDE macro format (minor)
Mattias2Paths and Parts
Mattias2Environment
Mattias2Pas2jsDsgn
TrevFilename Parts: OSX -> macOS (minor)
MartinGeneral Purpose
EdgardagerIDE macro format
MichaelProjectGroups
Mattias2Environment
N7800Paths and Parts: Clarifying the differences between "TargetFile" and "OutputFile"
Mattias2Environment

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.