Contents
General
Directives
Common Elements
General
Usage
The .gbs files form together with the directory structure the backbone of GBS.
They contain meta-data and are used to control the behaviour of GBS.
General Syntax
- Trailing white-space is ignored.
- Empty lines are ignored
- Lines beginning with '#' are considered comments and are ignored.
- The syntax is line-oriented.
- Leading white-space is significant.
- Lines ending with ' \' will be spliced with the next line.
WhiteSpace before the '\' and at the beginning of the next line will be
replaced by a single space.
- End-Of-Line Comment may be enabled/disabled using directives (see below)
- Lines may be skipped by the build-line-selection mechanism (see below)
- Lines starting with '.' are Directives (see below)
- Reserved words (keywords) are case sensitive
The usage of End-Of-Line Comments can be enabled and disabled by means of the .eol_comment directive.
Enabling the EOL Comments slows down parsing and should therefore be enabled with care.
It works similar as C and C++ // comments.
Syntax:
- line # comments
Semantics:
- #
- The # must be surrounded by at least 1 white-space on both sides
- The # , any characters following the # and any whitespace preceding the # will be removed.
- Possibly remaining empty line will be skipped
Example
- ENABLE = AKI # "Akiyama's criterion"
- results in:
- ENABLE = AKI
build-line-selection
The build-line-selection mechanism allows lines to be skipped depending on the current Build.
This mechanism is not enabled for all .gbs files.
Syntax:
- line operator wild-build-list
Semantics:
- line
- The line that will candidate for the selection
- operator
- == | !=
- wild-build-list
- The Build(s) for which the scope is valid (==) or not (!=)
- Wildcards are honoured
Example
- comp1:file.o != gnu
- Means: line will be skipped for Build gnu
- comp2:file.o = gnu
- Means: line will be included only for Build gnu
Note
It is practice to align the Build selections to the right of the lines.
Order of actions
- Skip empty lines and lines starting with '#'
- Remove EOL-Comments if enabled
Skip possibly resulting empty line
- Perform Build-Line-Selection and remove build-selection part
- Execute Directive / Line
Directives
.plugin
.include
.eol_comment
.builds
.exit
.end
.plugin
Purpose:
To define the plugin.
The plugin-directory associated with the defined plugin will be added to a possible include-path.
It is used to find the plugin directory with .include
Syntax:
- .plugin plugin_name
Semantics:
- plugin_name
- The plugin-directory must exist
.include
Purpose:
To include text from another .gbs file
Syntax:
- .include gbs_file
- .include "gbs_file"
- .include <plugin_gbs_file>
Semantics:
- gbs_file
- Absolute filepath is not allowed
- '../' is not allowed
- The file must be a .gbs file
- The search-path depends on the type of the .gbs file
- plugin_gbs_file
- Absolute filepath is not allowed
- '../' is not allowed
- The file must be a .gbs file
- The file will be taken from the plugin directory as specified by the .plugin directive
Purpose:
To enable/disable EOL (End-Of-Line) Comments
Syntax:
- .eol_comment enable
- .eol_comment disable
Semantics:
- General
- The state (enabled/disabled) is propagated through includes.
- Each main file starts in the disabled state.
.builds
Purpose:
To exclude generation of SRC files depending on the current Build
Only for glkbt files
Syntax:
- .builds[!]=wild-build-comma-list
Semantics:
- General
- glkbt files only
- The directive must be the first item in the file (after comments)
- The build step will not be executed if the condition is false. A dummy output file will be created.
- This is useful when a build step (like testing) should not be executed for specific Builds
- Note
- This mechanism works very similar to the build-line-selection, except no spaces are allowed.
.exit
Purpose:
To prematurely exit from a (included) file
Syntax:
- .exit
Semantics:
- General
- The rest of the file will be skipped
- This may be useful when testing a setup of a file and you do not want to comment out
the rest of the file
- You will get a warning.
.end
Purpose:
To prematurely exit from a (included) file
Syntax:
- .end
Semantics:
- General
- The rest of the file will be skipped
- This may be useful when you want to add extensive documentation and do not want it to slow down processing
of the file.
It also gives you the possibility of free-format text (without leading '#')
Common Elements
COMMAND
COMMAND
Purpose
Used to execute a script, executable or builtin command.
Available in the plugin descriptors: audit.gbs, build.gbs and tool.gbs.
Syntax:
-
- COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
Semantics:
- COMMAND
-
- pre_condition
- file_exists_condition | env_value_condition
- The command will only be executed if the condition is true.
- file_exists_condition
- [ ! ] exists file_spec
- env_value_condition
- variable_name_in_uppercase =|==|!= value
- ok_exit_values-comma-list
- Specifies the exit values for the command that are considered OK.
Range specification (e.g.: 3-5) allowed. Default is 0.
- command-definition
- command | @user_script |
>gbs_audit_script | .gbs_script
echo_command | set_command
- command
- Single line command
- user_script
- Search for in User-Audit and then GBS-Audit
- gbs_script
- Relative from the GBS plugin/plugin directory
- gbs_script
- Take from GBS_SCRIPTS_PATH
- echo_command
- ECHO any_text
- Prints any_text. EnvVars and positional parameters are replaced
- set_command
- SET variable_name_in_uppercase = any_value
- Sets the EnvVar. In any_value EnvVars and positional parameters are
replaced
Note that you can continue a long command on the next line by adding ' \' at the end.
The command may be called with parameters. Refer to the actual definition.
|