This describes intent and purposes of the fakefile file settings.
All files specified are relative to the project root.
The reserved Section Names are defined as follows:
-
settings:Any configuration specific to this fakefile is stored here.
This includes the declaration of define and parameter IKI variable substitution values.
If multiple Objects of the same name exist and that Object only supports a single value, then only the Content from the last same named Object is used.
The build settings may also be specified in the Settings Section.
The following settings are available (in addition to the build settings):
-
compiler:-
This represents the name of the compiler program to use, such as
gcc.The programs
gccandclangare known to work.Many of the parameters in the settings file can be changed if using a non-GCC, but there may be certain hard-coded functionality that may need to be changed.
When specified and
load_buildistrue, then this will override thebuild_compilerspecified in the loaded build settings.
-
-
define:-
This represents an environment variable to define on run.
The environment variable name is case-sensitive.
This replaces the value of any existing environment variable with this name.
-
-
environment:-
This represents all environment variables that are exposed when executing sub-programs.
This is not auto-populated for environment variables defined in the
definesetting.When defined with no Content, then this means that no environment variables are exposed.
When not defined at all, then all environment variables are exposed.
Environment variables may still be exposed if
load_buildistrueand the build setting file defines any environment variable names.
-
-
fail:-
Designates the fail mode when running external programs, such as through the
runorshelloperations.There are three options:
exit: Designates to exit the program on failure, printing an error message.warn: Designates to continue on and if in verbose mode then print a warning.ignore: Designates to do nothing.
The return code for programs can still be retrieved through using the reserved IKI vaiable
return.
-
-
indexer:-
This represents the name of the indexer program to use, such as
ar.An indexer is often called a linker.
Similar to
build_compiler, any linker that supports thearprogram parameters is effectively supported.When specified and
load_buildistrue, then this will override thebuild_indexerspecified in the loaded build settings.
-
-
indexer_arguments:-
This represents arguments needed to build an archive file from object files, such as
rcs.These arguments are placed immediately before the object files passed to the
indexerprogram.
-
-
load_build:-
This represents whether or not to load the load the build settings file.
The first Content value may be
trueto load the build settings andfalseto not load the build settings file.
-
-
parameter:-
This defines an IKI variable name to substitute with the value.
This replaces the value of any existing environment variable with this name.
The first Content value represents the IKI variable name.
All Content values after the first represent the values the matching IKI variable is replaced with.
The parameter variable name
returnis used to store the return result of arunorshelloperation.Setting this here only sets the default
returnparameter variable value.
-
-
stage:-
This defines a name that is added to the build stage files to help uniquely identify build stages associated with this file.
This name must only have valid characters for a particular file system.
The variables allowed are different from file system to file system and so special characters should generally be avoided.
To help prevent problems with paths, slashes (forward slash and backward slash) are not allowed in the stage name.
-
-
-
main:This is the main entry point when processing the fakefile.
This is processed top-down until the end of the list is reached.
The following operations are available:
-
and:A special type of an
ifoperation.May only be specified following a valid
if,and, ororoperation.This is executed only if the previous
ifoperation result is true.When executed, this performs the test and returns true or false as appropriate.
When not executed, this passes through the result of the previous
if,and, ororoperation. -
build:Run the fake build operation as if
fake buildwas run instead offake make.Command line arguments are automatically passed to the fake build operation.
Accepts an optional Content that is a file name to a build settings file to use instead of the default.
This file name is relative to the data build directory (which can be changed by -D/--data parameter).
If the optional file name Content is specified, then it also supports additional modes to use instead of the default mode.
When no additional Content after the
buildis specified, then the default (or program supplied) settings file and modes are used.When the first Content after the
buildis specified as an empty string, then the default (or program supplied) settings file is used.When the second Content after the
build(and there is no third Content), then no modes are used. -
break:Perform an exit from the current make operation.
This only exists the current depth.
If the depth is at the top (aka: 0), then this is identical to the
exitsection operation.The second Content may be either 'succeed' or 'fail' to designate on whether or not to exit as success or failure.
When set to
failurethis will trigger any failure (with message), depending on the current fail state. -
clean:Run the fake clean operation as if
fake cleanwas run instead offake make.Command line arguments are automatically passed to the fake build operation.
-
clone:Copy all files (and directories), preserving all properties, into the last content.
If there are more than one file (or directory) being copied, then the final path must be a directory.
All Content, except last, represents the files to clone.
The last Content represents the destination file (or directory) to clone to.
-
compile:Execute the compiler program, such as
gcc.All Content are passed as arguments to the respective
gccprogram. -
copy:Copy all files (and directories) into the last content.
If there are more than one file (or directory) being copied, then the final path must be a directory.
All Content, except last, represents the files to copy.
The last Content represents the destination file (or directory) to copy to.
-
define:This represents an environment variable to define on run.
The environment variable name is case-sensitive.
This replaces the value of any existing environment variable with this name.
-
delete:Delete one or more files or directories.
All Content must be the file or directory to be deleted.
If the path is a directory and is not empty, then this will not delete the directory.
-
deletes:Identical to
delete, except that when the path is a directory and is not empty, then this will delete the directory. -
else:Performs a programmatic
elsecondition.Must be specified following a valid if operation (and the operation it affects).
This has no Content.
An else operation may not follow this.
An if operation may immediately follow to represent an
else ifcondition. -
exit:Perform an exit from the entire make operation.
This always exits completely, regardless of the operation depth.
The second Content may be either 'success' or 'failure' to designate on whether or not to exit as success or failure.
When set to
failurethis will trigger a failure message.When set to
failure, the fail state will be forcibly changed tofailregardless of the current fail state. -
fail:Toggle how the to handle an operation failure.
The first Content may be one of the following:
exit: Set failure handler to exit on failure.warn: Set failure handler to print a warning on failure but continue on.ignore: Set failure handler to continue on regardless of failure.
-
group:Change the group role for a given file.
The first Content represents the group to assign.
The second Content represents the file to assign the group to.
-
groups:Identical to group operation, except this will recursively apply the mode to all files within the given file, if that file is a directory file path.
-
if:Performs a programmatic
ifcondition.May be specified following a valid
elseoperation.The Content represents a set of conditions to perform.
The
ifoperation may be used in conjunction with theand,or, and theelseoperations.The conditional logic is different from normal logic found in most software programs.
There is only one order of operation, a top-down design where the current operation relates to the previous operation.
This is mostly relevant when
ifoperation is followed by anandor anoroperation.Consider the following:
if parameter xxx or parameter yyy and parameter zzz print first else if parameter www print second else print third
The resulting logic is as follows:
- If
xxxis defined, then... - If result from (1) is TRUE or if
yyyis defined, then... - If result from (2) is TRUE and if
zzzis defined, then... - If result from (3) is FALSE, then...
- If result from (4) is TRUE, then...
- If result from (5) is FALSE, then...
For all conditions that rely on numbers, only whole numbers are (currently) supported.
conditions:
-
== "left" "right":Compare all parameters to be equal.
Requires 2 or more after the
==.For example,
if == 'a' 'b' 'c' 'd'would test:'a' == 'b' && 'b' == 'c' && 'c' == 'd'.This performs only string-based comparisons.
-
> "left string" "right string":Compare
lefttorightfor greater than.Requires 2 or more after the
>.For example,
if > 0 1 2 3would test:0 > 1 && 1 > 2 && 2 > 3.This performs only number-based comparisons.
-
< "left string" "right string":Compare
lefttorightfor less than.Requires 2 or more after the
>.For example,
if < 0 1 2 3would test:0 < 1 && 1 < 2 && 2 < 3.This performs only number-based comparisons.
-
>= "left string" "right string":Compare
lefttorightfor greater than or equal to.Requires 2 or more after the
>=.For example,
if >= 0 1 2 3would test:0 >= 1 && 1 >= 2 && 2 >= 3.This performs only number-based comparisons.
-
<= "left string" "right string":Compare
lefttorightfor less than or equal to.Requires 2 or more after the
>=.For example,
if <= 0 1 2 3would test:0 <= 1 && 1 <= 2 && 2 <= 3.This performs only number-based comparisons.
-
<> "left" "right":Compare all parameters to be not equal.
Requires 2 or more after the
==.For example,
if <> 'a' 'b' 'c'would test:'a' <> 'b' && 'b' <> 'c' && 'a' <> 'c'.This performs only string-based comparisons.
-
define "some define name":Test if one or more names are defined as an environment variable.
For example,
if define PWD SHELLwould test if both thePWDand theSHELLvariables are defined via the environment variables. -
exist "file path":Test if file exists.
For example,
if exist "a.txt" "b.txt"would test if both the filea.txtandb.txtexist. -
failure:Test if the previous section operation failed.
-
group "some mode" "some file":For example,
if group friends a.txt b.txtwould test if both filea.txtandb.txthave a group namedwe. -
is block character directory fifo link regular socket for "file path":Test if one or more files exist and if each file is any of the given types.
The given types must be followed by
forto designate where the the file paths begin.For example,
if is regular directory for "a.txt" "b.txt"would test if both the filea.txtandb.txtexist and are either of typeregularor typedirectory. -
mode is/has "some mode" "some file":Test if one or more files has the exact mode (
is) or has at least the given modes (has).For example,
if mode is u+r a.txt b.txtwould test if both filea.txtandb.txtonly have owner set to read.For example,
if mode has u+r a.txt b.txtwould test if both filea.txtandb.txthas owner set to read, and all other modes can be anything. -
not:Perform the test expecting a false result rather than a true result.
This is to be immediately followed by a valid if condition as well as all appropriate valid content associated with that if condition.
Only the following if conditions are supported:
define.exist.group.is.mode.owner.parameter.
Examples:
if not parameter workif not exist documentation.txt
-
owner "some mode" "some file":Test if one or more files has the given owner.
For example,
if owner me a.txt b.txtwould test if both filea.txtandb.txthave an owner namedme. -
parameter "some parameter name":Test if one or more names are defined as a
parametervariable.For example,
if parameter verbose silentwould test if both theverboseand thesilentvariables are defined via theparametersetting.Reserved parameters that represent program arguments, three forms are available.
For example, the program argument -w/--work has the reserved word
workand has three forms:work.work:option.work:value.
In the case of form 1, the
if parameter workwould be true if the argument is passed to the program or a default is provided.In the case of form 2, the
if parameter work:optionwould be true if the argument is passed to the program.In the case of form 3, the
if parameter work:valuewould be true if the argument is passed to the program and has a non-zero value.Some reserved parameters, such as the
verbosity, has novalueand in this case would always return false forif parameter verbosity:value.The following are reserved parameters:
build: Associated with-b/--buildparameter.color: Associated with+d/++dark,+l/++light, and+n/++no_colorparameters.current: The absolute path to the current working directory (present working directory) (Always has a trailing forward slash).data: Associated with-D/--dataparameter.define: Associated with-d/--defineparameter.fakefile: Associated with-f/--fakefileparameter.mode: Associated with-m/--modeparameter and possibly with the build settings default modemodes_default.process: Associated with-p/--processparameter.return: Contains the return value of a previous operation that produces a return code.settings: Associated with-s/--settingsparameter.sources: Associated with-S/--sourcesparameter.top: The absolute path to thetopdirectory, which is the base project directory (Always has a trailing forward slash).verbosity: Associated with+Q/++quiet,+E/++error,+N/++normal,+V/++verbose, and+D/++debugparameters.work: Associated with-w/--workparameter.
-
succeed:- Test if the previous section operation succeeded.
- If
-
index:Execute the linker program, such as
ar.All Content are passed as arguments to the respective
arprogram. -
link:Create a symbolic link from some point to some target.
The first Content, when there are more than 2 arguments, may be either
forceorstrict.The second to last Content represents the target file.
The last Content represents the point file.
The
forceContent designates that the point file will be overwritten if the file already exists.The
strictContent requires that the target file already exists. -
mode:Change the mode permissions for a given file.
The first Content represents the mode to assign.
The second Content represents the file to assign the mode to.
-
modes:Identical to mode operation, except this will recursively apply the mode to all files within the given file, if that file is a directory file path.
-
move:Move all files (and directories) into the last content.
If there are more than one file (or directory) being copied, then the final path must be a directory.
All Content, except last, represents the files to move.
The last Content represents the destination file (or directory) to move to.
-
operate:Begin execution of another Section.
The first Content represents the name of the Section Object to execute.
This may be neither the
settingsSection no themainSection.Recursion is prohibited, a Section that is already on the operation stack may not be called again.
Once the operation is off the stack, it can then be called again.
-
or:A special type of an
ifoperation.May only be specified following a valid
if,and, ororoperation.This is executed only if the previous
ifoperation result is false.When executed, this performs the test and returns true or false as appropriate.
When not executed, this passes through the result of the previous
if,and, ororoperation. -
owner:Change the owner role for a given file.
The first Content represents the role to assign.
The second Content represents the file to assign the role to.
-
owners:Identical to owner operation, except this will recursively apply the mode to all files within the given file, if that file is a directory file path.
-
parameter:This represents a variable defined within the scope of the fakefile.
This is not exported as an environment variable and is therefore not visible to any executed programs or scripts.
This replaces the value of any existing parameter variable with this name.
The reserved parameter variable names (see IKI vocabulary context section below) may not be changed by this.
-
pop:Pop a directory path of the path stack, thereby changing to the previous directory on the stack.
This is a change directory command similar to a back button in a browser.
This has no Content.
This does not generate an error if the path stack is empty.
If the directory popping to no longer exists, then an error occurs.
-
print:Print the content to the output screen.
This always prints a newline at the end.
All Content is printed, and if no Content is provided, an empty line is printed.
The following escape sequences are supported for printing special characters:
\f: Form Feed.\n: New Line.\r: Carriage Return.\t: Tab.\v: Vertical Tab.\: Backslash Character (may require additional slashes in certain circumstances.)\0: NULL Character.\U+: Unicode Sequence (followed by a valid Unicode sequence with a minimum 4 hexidecimal digits and a maximum of 6 hexidecimal digits).\!: Non-printing separator, allowing for\U+000A\!5to be equivalent to\n5.
If the Unicode is invalid, then nothing is printed for that character (the invalid character is skipped when printing).
Example Unicodes:
\U+000A: Prints a new line, equivalent to\n.\U+2E19: Prints the Unicode feather-like character⸙.
Only ASCII alpha-numeric hexidecimal digits are allowed in the Unicode sequence (upper or lower case).
Invalid or unknown escape sequences are not printed.
-
run:Manually execute a remote program or script.
This program must be in the appropriate PATH environment or otherwise automatically detected when calling without a specific path to the program or script.
The first Content represents the program or script name.
All Content after the first are passed to the program or script when running.
After this executes the return result is made available via the
returnparameter variable name.Any existing value associated with
returngets replaced. -
shell:Manually execute a remote program or script using a specific path to the program or script.
This does not require the program to exist in PATH, but the path to the program or script must be relative to the project path.
The first Content represents the program or script name.
All Content after the first are passed to the program or script when running.
After this executes the return result is made available via the
returnparameter variable name.Any existing value associated with
returngets replaced. -
skeleton:Run the fake skeleton operation as if
fake skeletonwas run instead offake make.Command line arguments are automatically passed to the fake skeleton operation.
-
to:Change to the directory within the project root path tree, pushing the previous directory onto the path stack.
The previous path is saved onto the path stack and may later be
poppedoff.The first Content represents the path to change directory into.
-
top:Change to the project root path, clearing the directory path stack.
This has no Content.
If the project root path no longer exists, then an error occurs.
-
touch:Manually create a new file or a directory within the project root or update its last changed timestamp if the file already exists.
The first Content must be either
fileordirectory.The remaining Content must be a path to the file.
-
write:Write strings to a file within the project root.
The Content after the first Content is appended to the file.
The first Content represents the file to write to.
If there is no Content beyond the first, then the file is truncated (all content within the file is deleted).
In all cases, if the file does not exist, the file is created.
When only the first Content exists, this acts similar to the
touchoperation.The major difference between the two is that the
touchoperation does not alter the content within the file.This does alter the content within the file.
A single space is printed between each argument.
To preserve spaces, wrap the message in quotes (single or double).
The following escape sequences are supported for printing special characters:
\f: Form Feed.\n: New Line.\r: Carriage Return.\t: Tab.\v: Vertical Tab.\: Backslash Character (may require additional slashes in certain circumstances.)\0: NULL Character.\U+: Unicode Sequence (followed by a valid Unicode sequence with a minimum 4 hexidecimal digits and a maximum of 6 hexidecimal digits).\!: Non-printing separator, allowing for\U+000A\!5to be equivalent to\n5.
\U+000A: Prints a new line, equivalent to\n.\U+2E19: Prints the Unicode feather-like character⸙.
If the Unicode is invalid, then nothing is printed for that character (the invalid character is skipped when printing).
Example Unicodes:
Only ASCII alpha-numeric hexidecimal digits are allowed in the Unicode sequence (upper or lower case).
Invalid or unknown escape sequences are not printed.
-
The IKI vocabulary context is supported and is further clarified as follows:
-
context:-
The context Object represents a name representing simple context or complex combination of context.
Context should wrap some text such that if some text begins with some context, the context should be reset at the end.
The most basic context is color context, such as:
context:"notice" This is emphasized text context:"reset".The use of IKI in this way is acceptable but it is not perfect.
IKI is not designed to be a replacement to markup.
The markup
<strong>Example</strong>vs the IKIcontext:"notable" Example context:"notable"has obvious differences in the spaces.The IKI by design cannot be used like this:
context:"notable"Examplecontext:"notable"because the wordExampleand the wordcontextcollide.This context will respect the programs
++light,++dark, and++no_colorparameters.The following context are available:
error: Designate as an error, often printed in red.important: Designate as important.normal: Explicitly designate normal text.notable: Designate as notable (similar tostrongorboldin HTML).reset: Remove the context.standout: Designate to make notable (similar toitalicoremphasisin HTML).success: Designate as a success, often printed in bright green.title: Designate as a title.warning: Designate as a warning, often printed in some shade of orange.
-
-
define:The define Object represents environment variables passed to the program or created by the program.
The value represents the environment variable name and is case-sensitive.
This IKI variable gets substituted with the environment variable's value or NULL if not defined.
The
settingslist supports declaring custom environment variables (which overwrite any existing environment variable with the same name). -
parameter:The parameter Object represents a variable that is to be substituted.
The value represents the variable name and is case-sensitive.
This IKI variable gets substituted with the value defined in the
settingslist or NULL if not defined.The value may contain an additional
:optionor:valueat the end of the name to designate getting only part of the parameter.The following are reserved parameter variable names:
-
build:This variable holds the
buildprogram parameters, such as-b build/.This supports both
:optionand:value. -
color:This variable holds the color related program parameters, such as
+n.This supports both
:optionand:value(value is always an empty string). -
data:This variable holds the
dataprogram parameters, such as-D data/.This supports both
:optionand:value. -
define:This variable holds the
dataprogram parameters, such as-d define/.This supports both
:optionand:value. -
fakefile:This variable holds the
fakefileprogram parameters, such as-f fakefile.This supports both
:optionand:value. -
mode:This variable holds the
fakefileprogram parameters, such as-m monolithic.This supports both
:optionand:value. -
process:This variable holds the
processprogram parameters, such as-p process_name.This supports both
:optionand:value. -
return:This variable holds the return status from a previously run user-space applications, which happens with the
runandshellsection operations.This does not represent the return code for each line, just only those lines that run user-space applications.
-
settings:This variable holds the
settingsprogram parameters, such as-s settings.This supports both
:optionand:value. -
sources:This variable holds the
dataprogram parameters, such as-S sources/.This supports both
:optionand:value. -
verbosity:This variable holds the verbosity related program parameters, such as
+V.This supports both
:optionand:value(value is always an empty string). -
work:This variable holds the
workprogram parameters, such as-w work/.This supports both
:optionand:value.An example of getting just the
:optionor:valuepart of a parameter for theworkparameters:-
work:option:This variable holds the option part of the
workprogram parameters, such as-w. -
work:value:This variable holds the value part of the
workprogram parameters, such aswork/.
-
-
The Content no_dereference may be specified in certain cases relating to files.
These cases operate on a file that can be a link itself or the link target.
The default behavior is normally to dereference the link target.
For example, consider a symbolic link, called some_file, that points to a file that does not exist (which means that the link in question is a broken link).
The Operation if exist some_file would return false.
The Operation if no_dereference exist some_file would return true.
This is because the symbolic link itself, some_file, does exist but the file it is pointing to does not.
The no_dereference is ignored for conditions that do not need it.