Difference between revisions of "Variable expansion"

From Code::Blocks
Line 1: Line 1:
 +
[[Category:Code::Blocks features]]
 +
[[Category:Development]]
 
== Scope ==
 
== Scope ==
 
This article refers to builtin variables to be used in during the build process,
 
This article refers to builtin variables to be used in during the build process,

Revision as of 15:01, 6 February 2006

Scope

This article refers to builtin variables to be used in during the build process, using Code::Blocks revision 1581 and newer.
Older versions may not support all of the listed types.

Syntax

Code::Blocks treats the following functionally identical character sequences inside pre-build, post-build, or build steps as variables:

$VARIABLE, $(VARIABLE), ${VARIABLE}, and %VARIABLE%


Variable names must consist of alphanumeric characters and are not case-sensitive. Variables starting with a single hash sign (#) are interpreted as global user variables. The names listed below are interpreted as builtin types.

Variables which are neither global user variables nor builtin types are replaced with a value provided in the project file, or with an environment variable if the latter should fail. Per-target definitions have precedence over per-project definitions.

List of available builtins

$(PROJECT_FILENAME) $(PROJECT_FILE) $(PROJECTFILE)
The filename of the currently compiling project.

$(PROJECT_NAME)
The name of the currently compiling project.

$(PROJECT_DIR) $(PROJECTDIR) $(PROJECT_DIRECTORY)
The common top-level directory of the currently compiling project.

$(CODEBLOCKS) $(APP_PATH) $(APPPATH) $(APP-PATH)
The path to the currently running instance of Code::Blocks

$(DATAPATH) $(DATA_PATH) $(DATA-PATH)
The 'shared' folder of the currently running instance of Code::Blocks

$(PLUGINS)
The plugins folder of the currently running instance of Code::Blocks

$(ACTIVE_EDITOR_FILENAME)
The filename of the file opened in the currently active editor.

$(ALL_PROJECT_FILES)
A string containing the names of all files in the current project.

$(MAKEFILE)
The filename of the makefile.

$(FOOBAR_OUTPUT_FILE)
A specific target's output file.

$(FOOBAR_OUTPUT_DIR)
A specific target's output directory.

$(TARGET_OUTPUT_DIR)
The current target's output directory.

$(TARGET_NAME)
The current target's name.

$(LANGUAGE)
The system language in human readable form.

$(ENCODING)
The character encoding in human readable form.

$(ACTIVE_EDITOR_FILENAME)

$(TDAY)
Current date in the form 20051228

$(TODAY)
Current date in the form 2005-12-28

$(NOW)
Timestamp in the form 2005-12-28-07.15

$(NOW_L)
Timestamp in the form 2005-12-28-07.15.45

$(WEEKDAY)
Human-readable day of the week ("Wednesday")

$(TDAY_UTC) $(TODAY_UTC) $(NOW_UTC)
$(NOW_L_UTC) $(WEEKDAY_UTC)
These are identical to the preceding types, but are expressed relative to UTC.