GBS Logo






Release RMC-06.02
(2024-04-29)








Randy Marques, Netherlands



GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Home Bottom Doc. Button
Thank you for using Generic Build Support (GBS), the generic build environment created by Randy Marques, Netherlands.

Generic Build Support is a way of setting up a directory structure combined with generic scripts to accommodate Build Automation for almost any kind of software project.
Building information is kept in dedicated files enabling automatic generation of make files, independent of platform or SCMS.

The key aspect of GBS is the directory structure.
Its strict[1] nature makes sure that everything has its place so that it can be easily retrieved and it is assured that any GBS command will run on any SubSystem created according to the GBS Directory Structure rules.
This directory structure makes it possible to swap and/or share software between projects (interchange ability) and ensures an unified way of working.
And yes: where needed there is all the freedom you need!
You can run GBS parallel on Windows 10, Windows 10 WSL and Linux systems, sharing the same physical directory structure.

GBS depends only on Perl (Version 5.16.3 or later, preferably with PerlTkx). No extra packages are required when using ActiveState Perl
This version was developed on Windows 10 using Perl 5.16.3 from ActiveState (with PerlTkx)
It was tested on Windows 10, Windows 10 WSL 1 and Ubuntu 22.04 - GNOME. (On VirtualBox 7.0)
Many thanks to Martin Smiths of the Netherlands who did the beta-testing on Manjaro 18.04 - Xfce.
Although not tested: There is no reason why GBS should not run on Unix or Windows 7
No clue if it works on Windows 11.

For a simple project you can start using GBS quickly and keep in mind that everything has its place.
I strongly suggest reading the 'Getting Started' part of the documentation.
Following the instructions in Create a GBS-WA/System will quickly set you on track.

The power of GBS lies in its concept.
So on the long run this means that in order for you to use GBS to its full extent, you must understand the concept of GBS and use it as intended. Rest assured: it is very simple.
Understand GBS by:
GBS is OpenSource under the MIT License and as such free to use:
  • You are not allowed to modify released code.
  • You are, however, allowed to download the code, modify it and create your own release.
  • You should use GBS as intended.

Note: The free and OpenSource versions of GBS are not compatible with pre version 2.00 releases

Before you start using GBS, please take a moment to read the Terms and Conditions
[1] Strict really means that no deviations are allowed.

Important Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

This document is just what it is named. A User Manual.
It does not describe the background, concepts or philosophy of GBS.
It therefore cannot be used to determine whether GBS is usable in a particular environment or project.
It certainly cannot be used to assess the full potential and usability of GBS.
For above purposes the interested user should read the GBS Concepts (PDF).

Features Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

  • Fits perfectly in an Agile environment
  • Fully portable and relocatable directory structure
  • Multiple platform support: Windows 10, Windows WSL 1 & Linux (Windows 7, Unix)
  • Same physical directory structure used for all platforms (on shared network-drives)
  • Generated, full compliant 'make' files
    • 100% reliable (incremental) builds
    • Generated Files Cross Reference
  • Allows subdivision into SubSystems and Components
  • Any number of SubSystems and/or Components
  • Any number of libraries and/or executables per Component
  • Strict applicable scoping rules
  • Support for embedded generation of 3rd party software
  • Integrated support for any compiler
  • Integrated support for SCA tools like QAC/QAC++, PC-Lint and C++Test
  • Support for multi-site environments
  • Command-line oriented
    • Support for GUI integration (e.g. Visual Studio, Slick Edit, Eclipse, Crimson Editor, Notepad++, gedit)
  • Comprehensive GUI covering all GBS commands
  • Automated directory creation and structure setup
  • Independent from Software Configuration Management System (SCMS)
    • SCMSs supported (for automated structure creation): Git and Subversion.
  • Built-in Parallel generation
  • Background generation ('at' jobs) with extensive log files
  • Prepared for tools like SoftFab, BuildForge, Hudson and CruiseControl
  • Uniform way of working
  • Simple in use. Easy to learn. Powerfully due to simplicity and consistency
  • Suitable for small, medium and large systems
  • Only dependent on Perl (Version 5.16.3 or later, preferably with PerlTkx)
    • Note that for GBS Perl need not be in the PATH, so any use of other Perl versions is not disturbed
  • No, repeat No user written scripts

Documentation Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

General

GBS Release Notes
Contains up-to-the-minute release information about GBS.

GBS FAQ
Frequently Asked Questions

Installation Notes

Windows and Linux

index.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Quick Start Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Environment Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

OS / Shell

GBS runs on:

WSL Considerations

You will need:
  • X server (e.g. Xming)
  • Additional bash commands:
    • xterm
    • at
  • Optionally a Desktop environment (e.g.: GNOME, Xfce, KDE, etc)
More information: Install Notes→Environment→WSL

Linux considerations

On some Linux distributions some necessary bash commands are not installed. You will need:
  • xterm
  • at
More information: Install Notes→Environment→Linux

Perl

GBS is based on Perl-scripts.
Perl must be installed and the perl command must be either in the PATH or specified via an Environment-Variable (GBS_PERL_PATH).
You need at least Perl version 5.16.3.
More information on installing Perl for GBS can be found in Install Notes→Environment

Install Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

GBS can be installed in two ways:
  • Single User:
    GBS will be installed in your environment.
    Setup (make this version current) is optional.
    A Local Shortcut will be created to run the Setup.
  • Multi User:
    GBS will be installed in a System area or on another global accessible location (E.g.: network drive).
    A System Shortcut will be created for individual users to Setup this version.
    Elevated privileges are required. (Linux: sudo -E, Windows: Run as Administrator).
If GBS is pre-installed (local or on a network drive) you will then only need to do the Setup as explained below.

If you need to install GBS yourself:
  • Obtain the GBS Installation file (.zip)
  • Unzip the file to a temporary location
    Follow the instructions in the ReadeMe.txt file.
    Do not unzip the file at the location where you want to install GBS!
  • Run Install as explained in the ReadMe file
    - Defaults are fine for QuickStart!
  • You will need to provide a Site-ID and a Company name
More info on Install: Install Notes→Install

Setup Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To setup GBS:
If setup was not executed by Install:
  • Use the 'GBS Setup [version]' shortcut to start the Setup.
    It may be on your Desktop and/or the Programs Folder.
    If it is not present (maybe you do not have a desktop or deleted it...):
    • [ Inquire at your GBS Administrator where GBS is installed. ]
    • Navigate to the directory where the wanted GBS-version is installed.
      e.g.: Q:\Tools\RMC\GBS\2.02
    • You may need to open a Terminal there
    • Execute:
      _gbssetup.bat  (Windows) (Mind the '_'!) or
      . _gbssetup.sh (Linux) (Mind the dot, the space and the '_'!)
  • Answer the questions.
    - Defaults are fine for QuickStart!
    - Possible values are between ( )
    - Default value is between [ ]
    - Enter ! to quit processing safely
    Lines beginning with a '|' (vertical bar) are grouped in a 'form' with an 'OK?' question at the end. (N will repeat the questions, E will Cancel)
What happens on Windows:
  • Some internal stuff is setup
  • A GBS Startup and a GBS Help shortcut are placed on your Desktop and in the 'All Programs' menu.
What happens on Linux:
  • Some internal stuff is setup
  • An alias gbsstartup is added to your ~/.bashrc or ~/.bash_aliases file
  • On systems with a Desktop (e.g. GNOME, Xfce, KDE, etc) a GBS Startup and a GBS Help shortcut are placed on your Desktop and in the 'All Programs' menu.
More info on Setup: Install Notes→Setup

Startup Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Startup GBS

Use the 'GBS Startup [cur]' shortcut to startup GBS.
It may be on your Desktop and/or the Programs Folder.
If it is not present (maybe you do not have a desktop or deleted it...):
  • On Linux you should have a gbsstartup alias.
    • Open a Terminal
    • Enter: gbsstartup
  • else
    • [ Inquire at your GBS Administrator where GBS is installed. ]
    • Navigate to the directory where the wanted GBS-version is installed.
      e.g.: Q:\Tools\RMC\GBS\2.02
    • You may need to open a Terminal there
    • Execute:
      _gbsstartup.bat  (Windows) (Mind the '_'!) or
      . _gbsstartup.sh (Linux) (Mind the dot, the space and the '_'!)
You will be presented a choice of functions.

Enter: gbs
The general GBS command line interface is started.

The first time you startup GBS you may need to give its some additional information:
Just answer the questions.

Define your own editor

In GBS you use the gbsedit command to edit (GBS) files. Sometimes other GBS functions may invoke the editor
The gbsedit command has a lot of builtin knowledge of .gbs files.
It will also aid you in editing your code.
By default GBS uses Notepad on Win32 and gedit on Linux.
You may want to change that to your favourite editor:
gbssettings → Change Config settings → Edit Editor
Make sure you use an editor that startup fast after multiple invocations (or stays alive).

Use a different Terminal type

By default GBS uses CMD Console on Win32 and xterm on Linux.
To change the current Terminal:
gbssettings → Change Config settings → Edit Terminal
Supported Terminals:
  • Win32: CMD Console, Windows Console
  • Linux: gnome-terminal, konsole, uterm, xterm (, WSL Console)

GBS Manual Page

To obtain current information on all implemented GBS commands enter: gbsman

GBS Help

To obtain extensive Help in HTML format (including this page) enter: gbshelp

Getting Started Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Organising your GBS-WAs / Systems

You can place a GBS-WA/System anywhere you want. You can also have them all on totally different locations. They do not need to be grouped in one directory, although that is a good idea.
The default for the GBS WorkArea Path is:
  • Win32: %MyDocuments%\GBSWA
  • Linux: ~/Documents/GBSWA

SystemName and SystemId

The SystemName is the generic name of your project.
The SystemId is the parent-directory of your GBS WorkArea.
It is important that SystemId reflects the SystemName:
  • For the main (trunk) version: The SystemName
  • For different versions: The SystemName followed by '_' and the version number
Toplevel Directory
Remember that GBS does not like spaces in directory and filenames and that they are case sensitive!
Yes, also on Win32!

Connect to an existing GBS System (--add)

  • Create the SystemId directory
  • Checkout the SCM workarea under that directory
  • cd to that directory (if you are not already there)
  • Enter swr --add and answer the questions.
    Note that you can only --add a System if it was originally created with swr --new (below)

Create a new GBS-WA/System (--new)

You enter swr --new.
Creating a new GBS-WA is serious business.
You can find out how to do it in Create a GBS-WA/System
A good understanding of the concept and principles of GBS is needed.
Once done however, things get extremely simple, convenient and fast.

Commands Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Use GBS to navigate through your directories

After you have once set them GBS 'remembers' the following 'currencies'
  • Current System (per User)
  • Current SubSystem (per System)
  • Current Component (per SubSystem)
  • Current Build (per System)
  • Current Audit (per System)
  • Current Tool (per System)

Displaying Currencies

To display your currencies just enter: gbs

Currency commands

swr Switch System: set/change the current System (and SubSystem (and Component))
sws Switch SubSystem: set/change the current SubSystem (and Component)
swc Switch Component: To set/change the current Component. This command ends with an explicit cdsrc
swb Switch Build: set/change the current Build

Basic commands

gbsedit Create/Edit a file (you can define your own editor with gbssettings )
gbsbuild Compile, Link, etc. one or more files
gbssysbuild Compile, Link, etc. the whole System (Runs in batch - with logfile)

Navigation commands

cdlog cd to the log directory as specified by GBS_LOG_PATH (or $HOME)
 
cdsystem cd to current System
cddoc cd to the doc of the current System
cddev cd to the dev of the current System
cdext cd to the ext of the current System
cdres cd to the res of the current System
cdsys cd to the sys of the current System
cdsysbuild cd to the sysbuild of the current System
cdsysaudit cd to the sysaudit of the current System
cdsystool cd to the systool of the current System
cdsilo cd to the silo of the current System
cdtmp cd to the tmp of the current System
 
cdsub cd to the current SubSystem directory
cdbuild cd to the build directory of the current SubSystem
cdaudit cd to the audit directory of the current SubSystem
cdtool cd to the tool directory of the current SubSystem
cdcomp cd to the comp of the current SubSystem
cdimport cd to the import of the current SubSystem
cdexport cd to the export of the current SubSystem
 
cdapp cd to the app directory of the current Non GBS SubSystem
 
cdsrc cd to the src directory of the current Component
cdinc cd to the inc directory of the current Component
cdloc cd to the loc directory of the current Component
cdbld cd to the bld directory of the current Component
cdbuild cd to the bld/Build directory of the current Component / Build
cdaud cd to the aud directory of the current Component
cdopt cd to the opt directory of the current Component
cddat cd to the dat directory of the current Component
cdsav cd to the sav directory of the current Component

Other GBS commands

Note that all GBS-commands accept --h for short help and --help for long help

gbsbuild, gbssysbuild

Commands to compile, link, etc directly

gbsmake, gbssysmake

Commands to compile, link, etc using 'make'

gbsaudit, gbssysaudit

Commands to run Audit programs like QAC and QAC++

gbsmaint

This command enables you to select and execute a number of GBS maintenance functions.
Like:
  • Clear all 'bld' directories
  • Fix/Repair the SubSystem directory structure. (add missing directories)
  • Define compilers, builders
  • Define Audits (QAC, PCLINT, C++Test, etc)
  • Maintain Component 'owner's' file
  • More...

gbssettings

This command enables you to define your customizations. (Beeps on/off, Define Editor, etc.)

gbsscm

This command enables you to select and execute SCM-related functions in GBS.

There are a lot more command in GBS. They can be found at All Commands.

General notes on the GBS command-line environment Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

In a prompt, possible values are embedded in parenthesis
e.g.:
GBS: Are you sure? (y/n):

In a prompt, the default value is embedded in square brackets
e.g.:
GBS: Are you sure? (y/n)[y]:

Entering a single '!' will quit the script.
Entering a single '?' will give you some additional help (if available)

In general, options for GBS-commands start with -- (double hyphens).
This is to be able to discern options for GBS and options for applications (like QAC)
All GBS-commands accept --h for short help and --help for long help
More in The Command-line Interface

quickstart.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
GBS Release Notes - Release 6 (Current) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Release Notes for GBS 6.00
Release Notes for Previous Releases

Release Notes for GBS 6.00 Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Interface changes since 5.00 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The following major changes were implemented:
  1. You must run at least Perl version 5.16.3
  2. gbsmaint 3 (Map network paths): Linux <-> Windows file mapping now resides in a separate file.

When you run gbsmaint 7 9 (Upgrade), all your files will be updated accordingly

Build RMC-06.02: 2024-04-29 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

New/Changed Functionality

  1. gbssettings: (Linux) Added support for konsole Terminal.
  2. Redesign of Install mechanism
  3. Implemented version-limit for backup files (<file>.nnnn.sav)
    - Keep first and last 5
  4. Redesign of profile.(bat|sh) (split to config.ini)
    The following Profile entries were stripped of 'GBS_' and moved from profile.(bat|sh) to config.ini:
    • GBS_NOTIFY
    • GBS_EDITOR
    • GBS_BROWSER
    • GBS_VIEWER
    • GBS_NAVIGATOR
    • GBS_TERM (renamed to TERMINAL)
    • GBS_ADMINISTRATOR
    • GBS_INTEGRATOR
    They are not available as EnvVars anymore
    Added: COMPANY
    SKIPTYPES renamed to IGNORES
    Default for GBS_HOME_PATH is now MyDocuments for Linux also.
  5. sys.gbs removed.
    'Ignores' content (SKIPTYPES) moved to config.ini.
    GBS_APP_* moved to site.gbs and switch.gbs
  6. EnvVars GBS_VERSION, GBS_SCM_SKIPTYPES and GBS_WA_PLUGIN_PATH removed
  7. gbsuninstall renamed to gbsmanage
  8. gbssettings:
    • Added support for windows-terminal
    • 'Switch GBS Version' and 'Move GBS_BASE_PATH' moved to gbsmanage
    • 'Change GBS_ROOT_PATH' functionality is not available anymore.
      For the 'Change GBS_ROOT_PATH' you will have to reinstall the wanted GBS version
  9. gbsnav: Now takes 1 argument: path
  10. gbsaudit: You cannot specify --audit and/or --build anymore
  11. gbsbuild and gbsmake: You cannot specify --build anymore
  12. gbssysall, gbssysaudit, gbssysbuild, gbssysmake and gbssystool: Option --jobs replaced by --threads
  13. Improved gbsdebug interface.
  14. Adjustments for move to OpenSource
    • gbshelp: No use of HTML frames anymore. TOC is now part of page.
    • All occurrences of 'Randy Marques Consultancy' replaced by COMPANY value from config.ini
    • Install: New option: --company
    • _gbssetup.(bat|sh): New option: --company

Problems solved

  1. Install as Administrator did not work properly.
  2. gbsdebug added to gbshelp: All Commands

Build 06.01: 2021-03-20 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

New/Changed Functionality

  1. gbssub script files renamed to subsys.gbs
  2. .gbs files are not superseded by .usr files anymore.
    Check your .usr files!
  3. gbssettings: New EnvVar GBS_NOTIFY
    (Linux) Added support for gnome-terminal and uxterm.
  4. gbssysall, gbssysaudit, gbssysbuild and gbssysmake and gbssystool: Now accept 'CUR' as first parameter indicating Current SubSystem & Audit/Build/Tool.
  5. pgrep: -n now defaults to -n+
  6. Support for the Red 'GBS Beta Install' terminated
  7. Improved Install and gbsmanage
  8. wsudo: New command (Windows only)
  9. gbssudo: New command
  10. New gbssetup functionality: Setup GBS after Install (with Shortcut)
  11. Command gbssetup has been renamed to gbssettings
    Total redesign.
  12. Use Fuzzy logic to determine some defaults.
  13. Improved GBS startup
  14. Better support for User-defined Plugins. (requires gbsmaint 7 9 Upgrade)
    Each $GBS_SYSTEM_PATH/sys* directory now contains a plugins directory
    A plg.gbs file in that directory defines the plugin together with an audit.gbs, build.gbs or tool.gbs file.
  15. Added documentation for Notepad++ Integration
  16. gbsswr, gbssws, gbsswc, gbsswa, gbsswb and gbsswt now all handle the --delete option.
  17. gbsmaint 7 1 (Administrator Tools → Plugins Handling) has a new layout with more functionality
  18. gbsnav: New: Start the Navigator at the Current Working Directory (CWD)
  19. gbshelp: Improved the layout of 'Constraints' in All Commands. E.g.: swr.
  20. gbsedit: Now also checks glkbt files
  21. glkbt: Improved error-messages
  22. gbssysall: added option: --current
  23. gbsall(.bat/.sh) replaced by broadcast.gbs and site.gbs(.bat/.sh)
  24. Development: New Helpfile page

Problems solved

  1. gbsswr: switch to old releases did not always work
  2. gbswhich: failed when no current System
  3. gbssystool: Solved a problem with multiple tools being unaffected by --tools=...

Build 6.00: 2020-03-05 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

New/Changed Functionality

  1. The concept/naming of Root/System has changed.
    Now only System is used.
    As a consequence The EnvVar GBS_ROOT_PATH has been replaced by GBS_SYSTEM_PATH.
    swr still remains. We already have sws for SubSystems.
  2. Support for WSL (Windows Subsystem for Linux)
    • New command gbsbash to open a GBS WSL bash window
  3. New EnvVars
  4. Changes in gbssetup: Change Profile Settings
  5. gbsmaint 3 (Map network paths): Linux <-> Windows file mapping now resides in a separate file.
    Run gbsmaint 7 9 (Upgrade) to fix this
  6. gbssysall, gbssysaudit, gbssysbuild, gbssysmake and gbssystool do not support the 'send mail' option anymore.
    This is a security issue.
    If you still want to send a mail, you can use the GBS_BG_NOTIFIER EnvVar.
  7. Performance improvements: Extensive reduction of subprocess depths
    • gbsbuild: The following options are not supported anymore: --mm (makemake) and -export
    • gbsmake: The following options are not supported anymore: --smm (start_makemake), --mm (makemake) and -export
    So in interactive mode you will have to call gbsmakemake and gbsexport separately...
  8. pgrep: New functionality:
    • Read from STDIN is now supported
    • New context options -B, -A and -C
    • -R defaults to *.p? files
  9. GLT files may now have a ^timeout=seconds directive.
    Default is 60 seconds
  10. pgrep: New option: -s
  11. gbssystool: New option: --tools
  12. Templates: Improved. There are now separate templates for files in GBS (gbs.*) and outside GBS (any.*)
  13. swr: New option: --delete
  14. export.gbs: Improved chmod handling

Problems solved

  1. None specific

Release Notes for Previous Releases Bottom Doc. Button Top Document Button Blank Up Section Button

Please note that not all links may work correctly

release_notes.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Install Notes Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Environment Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

OS / Shell

GBS runs on:

WSL Considerations

General

File locations
In WSL bash you can access Windows directories/files.
In Windows you cannot access WSL bash local directories/files (e.g.: ~/).
Therefore all GBS directories/files must be placed at a location accessible by Windows.
e.g.: MyDocuments or D:\Work
Install GBS on Windows
Before starting GBS on WSL you need to install it on Windows.
GBS will use the same physical installation for both Windows and WSL. So you will need WSL 1.
You need to install Perl AND GBS on Windows. For more info on installing Perl and GBS look below.

Install WSL

Documentation can be found at: WSL Installation Guide for Windows 10
  1. Enable WSL
    • Open PowerShell as Administrator and run:
      Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
      This may take a while...
    • Restart computer
  2. Install your Linux Distribution of Choice
    • Open Microsoft Store in start menu
    • Search for 'Linux'
    • Select wanted distro (e.g.: Ubuntu)
  3. Initialize the new distro
    • Launch from Start menu
    • Setup a new Linux user account
  4. Regularly Update & upgrade your distro's packages:
    sudo apt update && sudo apt upgrade

Install X Server

Documentation can be found at: Running Graphical Programs on Windows Subsystem on Linux
  1. Select an X server. E.g.: Xming and Xming fonts
    GBS was tested with Xming.
  2. Download & Install both
  3. Add export DISPLAY=localhost:0.0 to your ~/.bashrc file
    Use an editor (gedit/vim) or enter echo 'export DISPLAY=localhost:0.0' >> ~/.bashrc
    Mind the double >> !!!

Install commands using X server

  • gedit
    Enter: sudo apt install gedit (takes a long time, especially at 10%)

Additional bash commands

Refer to the Linux Considerations below for additional bash commands.

Linux considerations

On some Linux distributions some necessary bash commands are not installed.

xterm

Open a 'Terminal'
Note: A 'Terminal' is not always an xterm
To try: enter xterm -h
To install: enter sudo apt install xterm

at

Open a 'Terminal'
To try: enter at -h
To install: enter sudo apt install at
Make sure the atd daemon runs: enter sudo atd

Install Perl Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

GBS is based on Perl-scripts.
Perl must be installed and the perl command must be either in the PATH or specified via an Environment-Variable (GBS_PERL_PATH).
You need at least Perl version 5.16.3

If Perl (or the proper Perl version) is not in the PATH, define an environment variable GBS_PERL_PATH to point to the top-level directory where the proper Perl is installed.
e.g.: export GBS_PERL_PATH=/opt/ActivePerl-5.26

Perl can be obtained for free via GBS was developed and tested on Windows 10 with the Perl Distributions from ActiveState

Install

After download From ActiveState:
  • Windows:
    MSI Installer
    • Run the downloaded .msi file
      Answer the questions
      Note the Note below on install location
  • Linux:
    AS Package (Gzipped Tarball)
    • Copy the downloaded .gz file to an empty temporary directory
    • cd to that directory
    • tar zxf downloaded-file
      Creates a directory (tree) in the same directory
    • cd ActivePerl-5.26.version
      (The created directory)
    • ./install.sh
      Answer the questions
    • Adjust PATH or define GBS_PERL_PATH
More information: Installing ActivePerl 5.26.x

Note: There is a bug in core Perl on Windows that doesn't set up @INC correctly if Perl is installed into a directory that starts with the letter '5'. Your problem should go away if you install into something like C:\MyPrograms\perl\v5.10 instead.
This bug is at least 10 years old and somewhat related to finding additional site_lib directories when you are using the versioned directory layout scheme where multiple Perl versions share site_lib directories.
Found in Perl Monks

Missing Perl Modules

Missing Perl modules can be installed via CPAN. More info: How to install CPAN modules

Install GBS Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Pre-Installed

If GBS is pre-installed (local or on a network drive) your GBS Administrator will be able to tell you where GBS is installed.
You will then only need to do the Setup as explained below.

Where to Install

Several versions of GBS can be installed in a GBS_SCRIPTS_ROOT directory.
They are installed using the Hard versioned directories method.
The latest build of a version is always installed under the plain version> directory. E.g: RMC-06.02
This is called the Current Build of a version. It will be overwritten with every install of the same version.
Specific Builds are installed under version_build directory. E.g.:

Toplevel Directory
GBS can be installed in two ways:
  • Single User:
    GBS will be installed in your environment.
    Setup (make this version current) is optional.
    A Local Shortcut will be created to run the Setup.
  • Multi User:
    GBS will be installed in a System area or on another global accessible location (E.g.: network drive).
    A System Shortcut will be created for individual users to Setup this version.
    Elevated privileges are required. (Linux: sudo -E, Windows: Run as Administrator).
If GBS is pre-installed (local or on a network drive) you will then only need to do the Setup as explained below.

The Install scripts only installs GBS (possibly on a central location).
To be able to use GBS, each user must 'Setup' GBS as explained below.
This tells GBS which of the versions to use.
During the Install you have the option to execute the setup immediately after the install (not with Multi-User).

Prerequisites:
  1. Perl must be installed and the perl command must be either in the PATH or specified via an Environment-Variable (GBS_PERL_PATH).
  2. Decide where GBS will be installed (GBS_SCRIPTS_ROOT)
    GBS will provide some nice defaults, but you can also specify you own location
  3. You will need to provide a Site-ID and a Company and/or Project name
  4. You have the gbs .zip file in a DownloadDirectory (anywhere)

How to Install

'Install' command syntax here

Instructions for Install:
  1. Unzip the file to a new/empty temporary directory (NOT where you want to install GBS)
  2. cd to this directory (In the Navigator - if available)
  3. cd to the newly created top directory (if not already there). (E.g.: gbs_RMC-06.02_2023-04-27) On Windows, from the Windows Explorer:
    • Run Install.bat (Single-User) or
      Run Install_As_Administrator.bat (Multi-User)
    On Linux:
    • If in the Navigator: Open a terminal in the current directory
    • Set the properties of Install.sh to executable:
      chmod u+x Install.sh
    • Enter:
      ./Install.sh (Single-User) or
      ./Install_As_Administrator.sh (Multi-User)
  4. Answer the questions.
    For most questions you can assume the default. (between [])
  5. When done, do not forget to cleanup the temporary unzip directory

After the Install there will be:
  1. A 'Setup GBS [version]' shortcut on your Desktop and in System Programs
  2. An 'unzipgbs.bat/.sh' and 'unzipgbs_admin.bat/.sh' in your:
    • Used Download directory (if known) or else the standard Downloads directory.
    • Documents directory (so you can always find it and copy it to the actual download directory).
    This command-file can be used for future Installs to unzip and install GBS combined.
    To use it, it must be in the same directory as the zip file.
Notes:
  1. Subsequent installs can be run with -q flag (quiet). This will run the script without human intervention assuming all defaults to be correct.

Setup Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

General

To setup GBS:
  • If you have a 'GBS Setup [version]' icon on your desktop:
    • DoubleClick it.
      Note: it may also be in 'All Apps' (Windows) or 'Applications' (Linux)
  • No icon:
    • [ Inquire at your GBS Administrator where GBS is installed. ]
    • Open a Terminal: CMD-Prompt (Windows) or XTerm (Linux)
    • Navigate to the directory where the wanted GBS-version is installed.
      e.g.: Q:\Tools\RMC\GBS\2.02
    • Execute:
      _gbssetup.bat  (Windows) (Mind the '_'!) or
      . _gbssetup.sh (Linux) (Mind the dot, the space and the '_'!)
      The full command syntax can be found here
  • A Terminal is started. Answer the questions.
    - Possible values are between ( )
    - Default value is between [ ]
    - Enter ! to quit processing safely
    Lines beginning with a '|' (vertical bar) are grouped in a 'form' with an 'OK?' question at the end. (N will repeat the questions, E will Cancel)
What happens on Windows:
  • Some internal stuff is setup
  • A GBS Startup and a GBS Help shortcut are placed on your Desktop and in the 'All Programs' menu.
What happens on Linux:
  • Some internal stuff is setup
  • Your ENV-file(s) (~/.bashrc and/or ~/bash_aliases) are updated to contain some GBS Startup stuff
  • On systems with a GUI (e.g. GNOME, Xfce, KDE, etc) a GBS Startup and a GBS Help shortcut are placed on your Desktop and in the 'All Programs' menu.


install.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Create a GBS-WA/System Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Creating a new GBS-WA is serious business.
A good understanding of the concept and principles of GBS is needed.
Once done however, things get extremely simple, convenient and fast.

This document will guide you to setup a simple non SCM-controlled 'Hello World' project to give you a taste of GBS.

Before you start Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Install GBS

Read:

Prepare

After Install it really helps if you have read: If you get stuck, read:

The project

For the explanation below a 'Hello world' implementation is used as example:
  • SystemName: HelloWorld
  • Builds: Linux: gnuc and gnucd. Windows: mingw and mingwd
  • SubSystem: main
  • Component: hello
Linux: We will be using the native C/C++ compiler toolchain
Windows: We will be using the MinGW toolchain

Startup GBS

  • DoubleClick the 'GBS Startup [cur]' shortcut.
    A command-line window is opened and you are presented a list of possible GBS commands.
  • Enter: gbsbash if you are in Windows CMD and want to use GBS in a WSL bash environment.
  • Enter: gbs
  • Answer the questions if it is the first time.

Setup Editor

Now is a good time to setup your editor if you have not yet done so. (Not required):
gbssettings → Change Config settings → Edit Editor
More info: Define your own editor

Use a different Terminal type

You may also want to use a different Terminal type.
gbssettings → Change Config settings → Edit Terminal
More info: Use a different Terminal type

Creating the GBS-WA Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Make sure your 'Site' is defined in GBS
  • Enter: swr --new
    (switch System)
    • Select: 'Create in User's GBSWA (MyDocuments/GBSWA)'
    • Enter: 'New System Parent': HelloWorld
    • Confirm create
    • Confirm 'Enter New System Name [HelloWorld]:' with <enter>
    • Select: 'No_SCMS'
    • Confirm 'OK? (y/n/q)[y]:' with <enter>
    An empty System is created and made current.
We will now proceed to define a Build

Defining a Build Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

  • Enter: swb --new
    (switch Build)
    • Enter mingw (Windows) or gnuc (Linux) with 'Enter new Build-name []:'
    • Select: 'Associate with an existing Build Plugin'
    • Select Plugin:
      'mingw_cpp: MINGW: GNU C' (Windows) or
      'lgnu_gcc: LGNU_GCC: GNU C' (Linux)
    • Confirm 'OK? (y/n/q)[y]:'
    • Confirm 'Do you want to edit switch.gbs now?:'
      • In the editor-window find all occurrences of the missing EnvVars (3-4 lines), uncomment and possibly adjust to your situation E.g.: Location and/or version-number.
        • Windows:
          • GBSEXT_MINGW_ROOT
            -
          • GBSEXT_MINGW_BASE_REL
          • GBSEXT_MINGW_GCC_PATH
          • GBSEXT_MINGW_GCC_REL
        • Linux:
          • GBSEXT_LGNU_GCC_ROOT
            -
          • GBSEXT_LGNU_GCC_REL
          • GBSEXT_LGNU_GCC_PATH
      • Save the file!
    • Back to the GBS window: Confirm 'Press <ENTER> to continue . . '
    The Build is now created in the current System and made current.
    • Enter: swr .' to effectuate the edited switch.gbs
    If you got errors (from the execution of switch.gbs) you will have to fix switch.gbs.
    • If the switch.gbs is not still open in an editor, start the edit with 'gbsedit switch.gbs'.
      Note that gbsedit knows where the switch.gbs file resides and that it ends with .bat (Windows) or .sh (Linux)
    • Find and fix problem(s) with the GBSEXT_... EnvVars
    • Save the file (keep editor open)
    • Repeat until all errors solved.
  • Optionally enter gbs to see what you have achieved
We will now proceed to create a SubSystem in the current System.

Creating a Subsystem Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

  • Enter: sws --new
    (switch SubSystem)
    • Enter the name of the New Subsystem: main
    • Select: SubSystem type: 'GBS' (default)
    • Keep confirming (defaults) till you get 'Summary for new SubSys ...'
    • Confirm: 'OK? (y/n/q)[y]:'
    The SubSystem is created in the current System and made current.
We will now proceed to create a Component in the current SubSystem.

Creating a Component Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

  • Enter: swc --new
    (switch Component)
    • Enter the name of the New Component: hello
    • Keep confirming (defaults) till you get 'Summary for new Component ...'
    The Component is created in the current SubSystem and made current.
We will now proceed to create a file in the current Component and compile it.

Getting one file to compile Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Setup Editor

If you have not setup your own editor, now is really the time to do so. (But you do not have to):
gbssettings → Change Profile settings → Program Settings
More info: Define your own editor

Create and edit the file

Now we create the file:
  • Make sure you are in the src directory
    If not: Enter: cdsrc
  • Enter: gbsedit hello.c
    Enter 'y' when asked 'Create? (y/n/q)[y]:'
    Select Template-File 'main_slash_star.c' (2) when asked
    The file is created in the src directory and opened in your editor
  • Edit the file to implement the 'hello world' application
    and save the file (keep open in editor)
Note: If you should not be in the current src directory you can also enter: gbsedit src:hello.c

Adjust the Build-environment (if necessary)

Try to compile the file with gbsbuild hello.c
It should compile, but if it fails that is probably because the GBSEXT_ EnvVars are not properly set:
  • Enter: gbswhich to get an overview of building (and auditing)
    Note the src_types on top
    And the GBSEXT_ Paths, which should reflect the Plugin you selected
  • Enter: gbswhich build .c to get information on .c -files processing
    Note: In gbswhich: an 'x' before a PATH means that it was not found
  • Edit the switch.gbs, fix, swr . and try again.

Compile the file

Enter: gbsbuild hello.c
Repeat until no more errors:
  • Edit hello.c and save
  • Enter: gbsbuild hello.c
Note: You need not be in the src directory when you execute a gbsbuild.
We will now proceed to create the executable

Where am I?

At any time you can enter gbs on the commandline. It will show you all currencies.

Creating the executable Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For linking we need a .glk file in the src directory

Create the .glk file

  • Enter: cdsrc
  • Enter: gbsedit hello.glk
    'y' to create the file
    • Immediately below the main banner enter:
      hello$GBS_BLD_C
    • Save the file
      Note: During processing the $GBS_BLD_C will be replaced by the resulting file-type of a C compilation for this platform (.obj or .o)
  • 'cd' to the current bld/$GBS_BUILD directory:
    Enter: cdbld
    For Windows Enter: cd mingw (The current Build)
    For Linux Enter: cd gnuc (The current Build)
    This places you in the output-directory for gbsbuild.

Link and run the .glk file

  • Enter: gbsbuild hello.glk
  • Stay in the bld/Build directory
  • Run the executable:
    For Windows Enter: hello.exe
    For Linux Enter: ./hello.e

    Note that all files in GBS must have a type. Hence .e for Linux
    The .e can be removed when exporting the file with gbsexport.
  • If you need to change stuff:
    • Stay in the bld/Build directory.
    • Do your edits
    • Build all with gbsbuild .:*.*
      Not with gbsbuild *.*'. That will cause UNIX globbing to take the files in the current (Build) directory.
    • Run the executable

Creating automated testing Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For testing we need a .glt file in the src directory

Create the .glt file

  • Stay in the bld/Build directory
  • Enter: gbsedit src:hello.glt
    'y' to create the file
    • Immediately below the main banner enter:
      hello$GBS_BLD_GLK
    • Save the file
      Note: During processing the $GBS_BLD_GLK will be replaced by the resulting file-type of a .glk (linking) operation for this platform (.exe or .e)

Run the .glt file

  • Enter: gbsbuild hello.glt
  • 'cd' to the bld/$GBS_BUILD directory
    Enter: cdbld
    Windows: Enter: cd mingw
    Linux : Enter: cd gnuc
    This places you in the output-directory for gbsbuild.
  • The output of the test is placed in hello.log

Using 'make' Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Until now we have used gbsbuild to generate the code, specifying explicitly the file(s) we want to 'build'.
Of course GBS offers a 'make' facility ('incremental build', 'selective build', 'dependency build'): gbsmake.

Before you run gbsmake for the first time you have to run gbsmakemake to create a Component and Build specific make-file.
Enter: gbsmakemake
If you get errors or warnings refer to: Generating Code.
You can proceed with the next step if there are only warnings, but the 'make' will not be safe.

Enter: gbsmake

If you have not done so, this is a good time to read Generating Code.

More info: Generating Libraries & Executables and Testing

We will now proceed to export the executable

Exporting the executable Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For the Export we will need an export.gbs file in the component.

Create export.gbs file

We will assume that this executable is for a customer called FOO
  • Enter: gbsedit export.gbs
    As we can have various types of export.gbs files we must specify which. The default (Component) is what we want.
  • Add the following lines:
    In Windows:
        FOO
            bld/$GBS_BUILD/hello$GBS_BLD_GLK
        
    In Linux:
        FOO
            bld/$GBS_BUILD/hello$GBS_BLD_GLK            hello|ug+x
        
    The hello at the end of the line renames the file (removes the .e)
    The |ug+x chmods the file (Just an example. Not really needed)
  • Beware: No spaces before FOO and at least one space before bld/$GBS...
  • Notes:
    The $GBS_BUILD specifies the current Build
    The $GBS_BLD_GLK specified the output-type of the .glk gbsbuild. (i.e.: .exe (Windows) or .e (Linux)

Export the file

  • Enter: gbsexport
  • Enter: cdexport and see what has happened.
    - You may want to do this with a Navigator (Enter: gbsnav)
For more info: Exporting Deliverables

Generate in the Batch Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

  • Enter: gbssysbuild
    A batch job is started.
    When it is done, a Notify popup-box will appear.
  • In the popup-box Select: (click) 'View Log & Exit'
  • View the logfile
If at a later stage you want to view your gbssysbuild logfiles:
  • Enter: gbssilo
    A page is generated in your browser
  • Select: 'gbsssysbuild (.log)' under 'GBS Log Overviews'
  • Select: VIEW of the Logfile you want to view
More info: The gbssys... commands

Adding a Build (Debug) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The previously defined Build will generate our FINAL (non-debug) version.
But we also want a DEBUG version:
  • Enter: swb --new
    • Enter mingwd (Windows) or gnucd (Linux) with 'Enter new Build-name []:'
    • Select: 'Refer to an existing Build'
    • Select Build:
      'mingw' (Windows) or
      'gnuc' (Linux)
    • Confirm 'OK? (y/n/q)[y]:'
    The new Build is created and will be (almost) equal to mingw/gnuc ('FINAL').
    So we will have to set it to 'DEBUG'
    Note that it is now also the Current Build.
  • Set the current Build to 'DEBUG':
    Enter: gbsedit build.gbs.
    • Change MODE into DEBUG
    • Change DEBUGGER into YES
    • Change OPT into DEBUG
    • Save the file!
  • Build the stream:
    Enter: gbsbuild .:*.*
    - All files (*.*) of the current Component (.:)
  • We do not want to export the DEBUG version so we have to edit the export.gbs:
    Enter: gbsedit export.gbs
    Select 'Component'
    • Append FOO with a few TABs and then '== mingw' or '== gnuc'
      This will cause the destination-line and the following source-lines to be executed only for the mingw/gnuc Build.
    • Save the file!
    • Test with gbsexport
It is done now. You can generate single stuff for a single Build with gbsbuild and use swb to switch Builds.
Enter: gbssysbuild and observe how the system is generated for both Builds in parallel.

Creating a non-GBS SubSystem Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Create a 'make' Subsystem

  • Enter: sws --new
    (switch SubSystem)
    • Enter the name of the New Subsystem: make_ss
    • Select: SubSystem type: 'make'
    • Keep confirming (defaults) till you get 'Create App Sub directories (app/src, app/inc...'
    • Enter 'y'
    • Confirm: 'Summary for new SubSys ...'
    The SubSystem is created with a standard Makefile.mk in SubSys directory.
  • cd to app/src with cdapp and then cd src (note the space!)
  • Create a 'main.c' file with gbsedit main.c
    The file is created in the current subsys/app/src directory
  • Edit the makefile with gbsedit Makefile.mk
    The uppercase 'M' makes it a GBS makefile and takes it from the SubSys directory.
  • Run the makefile with gbssysbuild .
  • Wait for OK completion
  • cd ../bld/build
  • Run the generated executable

Try the GUI Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

You will need Perl Tkx installed.
  • Enter: gbsgui
    If it does not startup properly, try: gbsgui --t
  • Have fun

Interfacing with the outside-world Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

System

switch.gbs(.bat/.sh)

This file resides in the $GBS_SYSTEM_PATH directory.
It is a script that is executed every time GBS makes a System current.
Its purpose is to define the particularities of the general building environment of the selected System.
e.g.: Here you want to make sure you are using the proper environment for your particular System.
Have a look at the contents of this file.
It is maintained by the GBS Administrator and must be under SCM control.
Note that at the moment of invocation all environment variables for that System have been set.

The file consists of two parts:

  • The SITE part
    Here you define the GBSEXT_plugin_ROOT EnvVars to define the locations of your plugins.
    They may vary per Site (PC/Location).
  • Then REL/PATH part.
    Here you define the GBSEXT_plugin_REL and GBSEXT_plugin_PATH EnvVars using the abovementioned Roots This is - of course - fixed per System.
Because the SITE part is always the same on a specific PC you can also put your Root definitions in a central file called site.gbs

create_system.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
FAQ - Frequently Asked Questions Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

General

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button

How to create a new Component Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Enter: swc --new

How to create a new SubSystem Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Enter: sws --new

How to create a new System Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Enter: swr --new

How to add an existing System to my Systems-list Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Enter: swr --add

How to remove a System from my Systems-list Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

Enter: swr --remove

faq.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Terms and Conditions Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

SOFTWARE LICENSE Bottom Doc. Button Top Document Button Blank Blank Blank Blank

BEFORE YOU USE GBS, CAREFULLY READ THE TERMS AND CONDITIONS OF THIS AGREEMENT.
BY INSTALLING AND USING THE SOFTWARE YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT.
IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE.

As the code is written in Perl you are not allowed to modify any released code.
You may, however, get a copy of the full GBS code, modify it to your liking and release your own version under the MIT License

MIT License

Generic Build Support (GBS)
Copyright © 2020 by Randy Marques, Randy Marques Consultancy, Netherlands

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

  • The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

terms-of-use.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Definitions &amp; Acronyms Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Definitions Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Generic Build Support (GBS)

The process of building according to strict rules and a strict predefined directory structure.
This makes building an easy process to use and to handle.
Make-files can be generated because the directory structure is fixed for all SubSystems.

RMC

Randy Marques Consultancy. The originator of GBS.

GBS Version

In older GBS releases the GBS version syntax was R.VV and R.VV_YY-MM-DD.
Where R stands for Release, VV stands for Version and YY-MM-DD for ReleaseDate

With the move of GBS to OpenSource the need to identify the 'Releaser' arises: Given a Release/Version, you would want to identify who built the Release/Version.
Additionaly the need for identifying a 'patch' arises. Hence the new notation (Since RMC-06.02):

Proj-RR.VV and
Proj-RR.VV(-Patch)
Where

Proj
Stands for Project/Company that created this Release/Version.
UpperCase letters and/or '_'. Keep short.
RMC is reserved for the original creator of GBS: Randy Marques Consultancy
RR
Release
2 digits.
VV
Version.
2 digits.
Patch
Patch version.
Numbers, Letters and/or '_'.
Optional

GBS-WA or System

A single, whole GBS directory tree.
Contains SubSystems.
GBS-WAs or Systems are identified by their SystemName
You can have as many GBS-WAs as you want. Even multiple occurrences of the same.
A GBS-WA will always correspond with a total SCM work area.

SubSystem

An independent generation-unit within GBS
A directory-structure with files that, during generation, produce software that can be delivered (released) to other SubSystems and/or end-customers.
A GBS SubSystem is not per se an architectural SubSystem.
SubSystems can contain one or more Components
The number of SubSystems should be limited
Most Systems will have only one SubSystem

Component

A files-container within a GBS SubSystem.
The lowest level directory-tree in GBS
Here the source and object files reside.
A GBS Component is not per se an architectural Component
GBS Component may very well contain more than one architectural Component and/or parts of architectural Components.
Files in Components cannot refer to files in Components of other SubSystems

Deliverable

The set of files produced by a SubSystem for use in another SubSystem or as final product. Generally speaking the deliverables of a SubSystem will consist of one or more libraries with one or more header-files. In a broader sense, any file that has to be made available to another SubSystem is a deliverable. (final executables, test-scripts, etc)
You can also have internal deliverables. A SubSystem may 'deliver; to another Subsystem.

Build or BuildStream

A sequence of compilations for a specific build, with a specific compiler toolchain, using the same set of compile-options, possibly followed by linking, resulting in a deliverable.

Auditing

Actions performed on the code that do not generate executable code.
Think of Source Code Analysers (SCAs) like PCLint, C++Test or QAC
Auditing runs on file level, just like compilers
Note:
Doxygen runs on System level. It is therefore not considered an Auditing tool but a System Tool

Archiving

The process of placing one or more object files into an object library

GBS Administrator

Person responsible for the infrastructure of a GBS-WA. Typical GBS responsibilities:
  • Create the GBS-WA
  • Create and maintain SubSystems, Components, Builds, Scope-files, etc.
  • First line support for users of the GBS-WA
  • Keep the GBS-WA healthy
This function may very well correspond with that of the SCM Manager

GBS Integrator

Person responsible for the execution of Generic functions in a GBS-WA. Typical GBS responsibilities:
  • Consolidate Audit results
  • Set GBS Version Limits
This function may very well correspond with that of the SCM Manager

Hard versioned directories

A method to store multiple versions of something (programs, files, etc.) so that all are available at the same time. This in contrast to Soft versioned directories that are stored inside SCM repositories and need to be checkout before they can be accessed.
All versions reside under the ROOT directory. The versions are called REL. And the actual location is called PATH.
3 Environment Variables are used to define the actual location:
  • app_ROOT e.g.: /opt/bin/perl
  • app_REL e.g: v5.10.1.817
  • app_PATH is always the combination of app_ROOT and app_REL e.g.: /app_ROOT/app_PATH
In the applications and especially switch.gbs you always use app_PATH (and maybe occasionally app_REL)
This assures that when you want to switch to another version you only need to change the app_REL
This method is used heavily throughout GBS

Builder

In the context of this document a Builder is a program or script that takes care of one step of the build-process of a deliverable. Typical builders are compilers, library-archivers and linkers.

Acronyms Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

GBS Generic Build Support
RMC Randy Marques Consultancy
SCA Source Code Analyser
SCM Software Configuration Management
SCMS Software Configuration Management System
e.g. SubVersion, Git
WA Work Area
 

definitions.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Introduction Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

GBS uses a strict directory structure to facilitate automatic generation (build) and interchange ability between Systems and SubSystems.
Sometimes separate parts of a system may not be able to use GBS (dedicated environment like Visual Studio, old code, etc.), they can however benefit from parts of the concept of Generic Build Support, like the export mechanism which will be described later.

One of the advantages of Generic Build Support is that developers need not worry on how to build the system. Fixed sets of scripts, which work on all parts of the system, take care of this. Because of this, all scripts work in the same way for each component and for each file. This reduces the chance of mistakes considerably. Additionally, because everything is defined, accidental misuse is avoided. GBS gives flexibility where it is really needed. Everything else is fixed.

GBS provides the functionality to generate the directory-structure or parts of the directory-structure, automatically making sure all directories are properly named.
Users should never create directories manually.

Some basic definitions Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

SubSystem

The basic build unit of GBS is a SubSystem.
SubSystems build autonomously. I.e.: There are never direct references from one SubSystem to another.
At the end of the SubSystem build a SubSystem will have generated one or more deliverables.
These can be executables, header-files, object-libraries, etc.
In GBS you want to minimise the number of SubSystems.
Most systems will require only one SubSystem and that is good!

System

SubSystems are grouped into a System

Component

To be able to handle large amount of files in a SubSystem, files are distributed in containers called Components. Typical population of a Component will be somewhere between 10 to 40 source-files. It is often a good idea to map architectural components on GBS Components.
A GBS Component however, may very well contain more than one architectural component.

An executable usually has the following basic Component-structure:

Simple Component Scope Components COMP1 and COMP2 contain basic functionality.

Component BASE contains common functions and common header-files. (Or at least one header-file containing types common to COMP1 and COMP2 like 'bool', TRUE and FALSE, NULL, etc.)

The TOP Component contains the main.c file and the make-file for the executable.

References are 'downwards' only. There MAY be references between COMP1 and COMP2.

No matter how big an executable may become, it will always contain a 'TOP' Component with references 'down-ward', containing the main.c and the make-file for the executable.
It will also always contain a 'BASE' Component. This is the Component all other Components refer to. (e.g.: dbg-modules, general header-file, etc). It does not refer to other Components.

referring-to in this context means: including header-files, directly calling functions, directly accessing global variables and including of object-files/libraries during linking.

Build / BuildStream

A build-sequence leading to a specific variant of a deliverable is called a BuildStream.
The generic name of the variant is the Build.
In GBS the directory-structure is set up in such a way that multiple BuildStreams generations can run in parallel for a SubSystem.

introduction.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Top Level Directory Structure Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

The strict nature of the GBS directory structure allows interchange ability between Systems and SubSystems.
GBS will generate the directory-structure automatically making sure all directories are properly named and added to any specified SCM System.

General overview Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

For the build process three areas can be distinguished:
  • The development-area. (dev)
    Here developers will develop the software in SubSystems.
  • The results-area. (res)
    This is the interface area between SubSystems as no direct reference is allowed from one SubSystem into another.
  • An 'external' reference area.(ext)
    Here software can be found that is included by, but not developed (read: modified / generated) within the project.
    Examples are: 3-rd party software, maybe: compilers with their runtime libraries and system header files, etc..
The above results in a basic directory-structure that looks like this:
Reserved (fixed) directory names are specified in a blue background.

Toplevel Directory
The 'res' directory contains directories with the deliverables of the various SubSystems.
The 'dev' directory contains the top-level directories of the various SubSystems.
The 'ext' directory contains the top-level directories of the various external systems.

In a project that consists of a single Subsystem (i.e. where the SubSystem is the System) still this top-level directory structure is used.

The basics Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Software is developed in the SubSystems.
SubSystems contain, amongst others: sources, header-files, make-files and their resulting objects, libraries and executables.
If, for generation purposes, a SubSystem needs items from another SubSystem (like header-files or libraries), these items must be copied from the other SubSystem in the 'res' area. (How is explained later).
  • During generation of a SubSystem, files needed from another SubSystems are never taken directly from another SubSystem but only from the 'res' area.
  • Vice versa, a SubSystem will have to 'export' those items that are needed by other SubSystems to the 'res' area.
In a GBS environment a project will be split into SubSystems governed by scope-control.
Note that most (small) Systems will have only one SubSystem.
On a Software-Architectural level, SubSystems will have a hierarchy, defining the order in which SubSystems must be built.
In GBS this hierarchy is not reflected in the directory structure. All SubSystems reside on the same directory level.
The same applies to Software Components within SubSystems.
During the total generation of the system, first the lowest level SubSystem will be built. Using the GBS 'gbsexport' command, its deliverable(s) (e.g. library and header-files) will then be exported into the 'res' area and so made available to the next SubSystem(s). Then the next SubSystem in the Software hierarchy can be built, gradually moving 'up' the scope, generating and incorporating the other SubSystems.

Directories Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The System directory

This is the top-level directory for the whole project
In the rest of the document this directory will be referred to as the SYSTEM directory.
  • The SYSTEM is defined in an Environment Variable (GBS_SYSTEM_PATH) specifying the top directory.
  • In these documents the UNIX notation of directories will be used for both Windows and Linux.

The 'dev' directory

This directory contains the top-level directories of the various SubSystems.
  • The 'dev' directory may only contain SubSystem Top-Level directories.
    So each directory in the 'dev' directory is considered a SubSystem.
  • There are 2 basic types of SubSystems:
    • Full-GBS Compliant
      Here the internal structure is strictly defined by GBS
      Components are controlled by GBS
    • Non GBS Compliant
      Except for a few mandatory files the structure is completely free
      GBS will not concern itself with internals and most lower level GBS commands like the compile of a single file (gbsbuild) will not work here.
      There are multiples Types:
      • MSVS (Microsoft Visual Studio)
        For Microsoft Visual Studio Projects and Solutions
      • make
        For typical 'make' environments
      • Other
        For any not of the above

The 'res' directory

This directory contains matching SubSystem directories that are used for interfacing between SubSystems.
'res' stands for 'result' i.e. deliverables generated by the SubSystems.
  • During SubSystem build, the deliverables of a SubSystem are generated. When all is well, the deliverables are copied to the SubSystem's 'export' directory and/or the res/SubSystem directory.
  • Not all subdirectories in the 'res' directory will be available to all SubSystems.
  • Each Subsystem has a 'scoping' file that shows which other SubSystem 'ref'-directories may be referred to.
  • Files may never be modified directly in the 'res' directory.
  • The total of 'res' directories must be set up in such a way, that it is possible to delete the contents of the 'res' directory and regenerate it by using the proper GBS command.

The 'ext' directory

This directory contains 'static' parts of the project. i.e. those parts that are not generated for the project, are used 'as-is' and are not covered by another version-controlled repository.
  • The 'ext' area will contain 3-rd party software and maybe operating systems, (cross-) compilers and compiler files like system header files and run-time libraries.
  • Software controlled by the support-organisation should not be included in 'ext'.

Other Directories

Although not mentioned before, there are also a number of other top-level directories like 'sys', 'sysbuild', 'sysaudit', 'systool', 'silo' and 'tmp'
Their usage is described in Full-GBS Directory Structure

Additional top-level directories

All top-level directories are mandatory.
Additional directories may be placed at this top-level. Names are free except for the following:
- doc for documentation at system-level
This means that if you use these names, you have to use them for the purpose as specified above.

The SubSystem top directory

GBS allows Subsystems to be either Full-GBS or Non-GBS compliant.

Full-GBS SubSystems

Full-GBS Subsystems adhere completely to the GBS way of working.
The generation of the SubSystem is completely taken care of by GBS

Non-GBS SubSystems

This allows for 'alien' SubSystems to be incorporated in the generation-process.
Non-GBS SubSystems may have any directory-structure and/or generation process.
Non-GBS SubSystems require a number of predefined scripts that will be called by the GBS Top-level functions like: gbssysbuild, gbssysmake, gbssysaudit and cleanup.
The gbsexport functionality to fill res and/.or export directories is also available.

Continue reading Bottom Doc. Button Top Document Button Blank Blank Blank Up Chapter Button

Full Directory Structure

top_dir_struct.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Full Directory Structure Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

Reserved (fixed) directory names are specified in a blue background.

Toplevel Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

The following diagram gives an overview of the Toplevel GBS directory structure.

GBS Toplevel Directory Overview

For a full description: Top Level Directory Structure

Systemlevel (full) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The following diagram gives an total overview of the top part of GBS directory structure.

GBS Toplevel Directory Overview

Full Compliant GBS Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The following diagram gives an overview of the Full-GBS compliant directory structure.

Full-GBS Complient Directory Overview

Non Complient GBS Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The following diagram gives an overview of the Non-GBS Complient directory structure.

Non-Full-GBS Complient Directory Overview

Directory creation Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Please note that GBS maintains it's own directory structure, assuring consistency.
Never create GBS directories yourself. Let the GBS commands take care of that.

The System directory Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

GBS_SYSTEM_PATH
This is the base of the whole directory structure. It contains all that is necessary to build a multi-SubSystem system.
Nine directories are mandatory for GBS: res, dev, ext, sys, sysbuild, sysaudit, systool, silo and tmp.
More directories may be added. E.g. doc for documentation, etc.

The 'res' directory

GBS_SYSTEM_PATH/res
The functionality of this directory is explained in Top Level Directory Structure → res.
It is used to control the exchange of deliverables between SubSystems.

The 'dev' directory

GBS_SYSTEM_PATH/dev
This directory contains all and only SubSystems.

The 'ext' directory

GBS_SYSTEM_PATH/ext
This directory contains the directories of all 3-rd party software that is to be used by all or most of the SubSystems.

The 'silo' directory

GBS_SYSTEM_PATH/silo
Here data is stored that is generated outside the Component structure and should be kept. E.g. Doxygen output. Each Tool has its own directory.
The command gbssilo will display any content in HTML format in a browser

The 'sys' directory

GBS_SYSTEM_PATH/sys
This directory contains all common items (scripts, tables, etc) for sysbuild, sysaudit and systool
e.g.: steps.gbs
It also contains a mandatory templates directory to hold user defined File Templates. (Templates)

The 'sysbuild' directory

GBS_SYSTEM_PATH/sysbuild
This directory contains all items (scripts, tables, etc) for Building
e.g.: gcc, mingw, etc
It also contains a mandatory makemake_stubs directory, with subdirectories per Build, to hold stubs for external files to satisfy gbsmakemake.

The 'sysaudit' directory

GBS_SYSTEM_PATH/sysaudit
This directory contains all items (scripts, tables, etc) for Auditing (SCA)
e.g.: qac, qac++, pclint, cpptest, etc

The 'systool' directory

GBS_SYSTEM_PATH/systool
This directory contains all items (scripts, tables, etc) for additional Tooling (e.g. Doxygen)

The 'tmp' directory

GBS_SYSTEM_PATH/tmp
Here GBS places its temporary files.
When something goes wrong GBS will not delete its tmp files, so you can check what went wrong.
After 7 days they will be deleted when you make this System current.
It is always safe to cleanup this directory when no generations are running.
There is an entry in gbsmaint that will do that.

The SubSystem directory Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

There are 2 basic types of SubSystems:
  • Full-GBS Compliant
    There is one Type:
    • GBS
  • Non GBS Compliant
    There are multiples Types:
    • MSVS (Microsoft Visual Studio)
    • make
    • Other

GBS_SYSTEM_PATH/dev/GBS_SUBSYS
This is the top of a basic generation-unit.
The SubSystem directory may have any number of Sub-Directories and files.
The directories audit, export, build and tool are mandatory for all types of SubSystems.
The directory comp is mandatory for Full-GBS SubSystems.
The directories app and opts are mandatory for Non-Full-GBS SubSystems.
The following names are reserved for all SubSystems: import, gbs*.* and *.gbs.

The 'export' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/export
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/export/GBS_BUILD

After the build of the SubSystem, this directory will contain the files and directories that are the end-deliverables of this SubSystem.
Items in the export directory are always generated/copied items, so they can be deleted at any time.

The 'import' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/import
This directory contains directories that hold deliverables from outside the System.
This is usually 3-rd party software only used by this SubSystem.
It is used rarely.

The 'build' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/build
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/build/GBS_BUILD
This directory contains information for the generation of the SubSystem.
For each BuildStream that this SubSystem generates a sub-directory of the Build-name is required. Else this SubSystem will not generate for that particular BuildStream.
These directories may contain a number of files that give information on SubSystem level.
These include:
  • Option-files (flags-files). To define compile / link options per platform / language / variant.
  • External-ref files (incs-files). To specify directory-paths for SubSystem external software
All files and directories in these directories reside under the responsibility of the GBS Administrator in co-ordination with the architect(s) responsible for the SubSystem. They are the only ones allowed to modify these files.

The 'audit' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/audit
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/audit/GBS_AUDIT/GBS_BUILD
This directory contains information for the Auditing of the SubSystem.
For each Audit & Build combination that this SubSystem generates a sub-directory of the Audit-name/Build-name is required. Else this SubSystem will not audit for that particular Audit & Build combination.
All files and directories in these directories reside under the responsibility of the GBS Administrator in co-ordination with the architect(s) responsible for the SubSystem. They are the only ones allowed to modify these files.

The 'tool' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/tool
This directory contains information for the Step-Command execution.
For each Step-Command Tool that this SubSystem runs a sub-directory of the Tool-name is required. Else that particular Step-Command Tool will not run for this SubSystem.
All files and directories in these directories reside under the responsibility of the GBS Administrator in co-ordination with the architect(s) responsible for the SubSystem. They are the only ones allowed to modify these files.

The Full GBS directories (Components) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The 'comp' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp
Full GBS only.
This directory contains all and only Component directories. The name is reserved and is used only for Full GBS SubSystems.
The only directories it contains are the Component directories that are to be recognised as under control of GBS.
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT
These directories contain the Component-Subdirectories. No other directories than the Sub-Directories specified below are allowed here.
As far as GBS is concerned, Component names are free, except for ALL, EXPORT and RES.
The project however, will impose rules on names here.
You can have as many Components as you wish.
They also contain a number of files that give information on Component level:
  • A scope file (scope.gbs). To define the scope of the various Components. The file shows for this Component, which Components may be accessed (included).
  • Export-file (export.gbs). To define the items in the Sub-Directories to be copied to the 'export' and/or 'res' directories.
Please bear in mind that a GBS Component is not necessarily an architectural Component.

The 'src' sub-directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/src
It contains all files that will lead to the generation of corresponding files in a 'bld' Build-directory.
Files in this directory form the basis of the generation process. This means that the presence of a file in the src directory indicates that a step of the build-process must be executed with that file as main input.
As a result of this all files that have to be compiled (or processed) must reside in this directory. If a file is not placed in this directory it will not be a part of the build process (compiled).
Note that header-files are not compiled. They are included.
Rules:
  • Only files in this directory will generate files in the 'bld' Build-directory.
  • Any file in this directory must generate at least one file with the same name in the 'bld' Build-directory. (File-extensions may differ)
  • Any file in this directory is a candidate for a 'make-dependency' script.
No Subdirectories are allowed.

The 'inc' sub-directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/inc
It contains the files that are needed in the generation process but do not belong in the 'src' directory because their presence does not lead to the invocation of a processor (compiler, linker) in the build-process (and do not lead to a file with the same name in the 'bld' Sub-Directories).
Files in this directory will be accessible from other Components. (#include)
This means that all 'included' files like global header-files or API header-files must be placed in this directory.
Rules:
  • This directory will be included in the search-path for a compile or link.
  • Any file in this directory is a candidate for the 'make-dependency' script.
No Subdirectories are allowed.

The 'loc' sub-directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/loc
It contains the files that are needed in the generation process but do not belong in the 'src' directory because their presence does not lead to the invocation of a processor (compiler, linker) in the build-process (and do not lead to a file with the same name in the 'bld' Sub-Directories).
Files in this directory will not be accessible from other Components
This means that all 'included' files like local header-files must be placed in this directory.
Rules:
  • This directory will be included in the search-path for a compile or link, but only for the current Component.
  • Any file in this directory is a candidate for the 'make-dependency' script.
No Subdirectories are allowed.

The 'aud' sub-directory with Audit/Build-directories

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/aud
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/aud/GBS_AUDIT/GBS_BUILD

The 'aud' directory acts a placeholder for the Audit-directories.

The Audit/Build-directories contain the resulting files of Audits triggered by files in the 'src' directory.
This means that these directories will contain any derived files.
Rules for Audit/Build-directories:
  • These directories may only contain files generated from the 'src' directory.
  • All files generated from the 'src' directory are placed in each of these directories.
  • Each file in each of these directories has a counterpart in the 'src' directory by the same name. (file-extension may differ).
  • The presence of a Audit/Build directory indicates that all files in the 'src' directory must be Audited for that Audit and Build.

The 'opt' sub-directory with optional Build-directories

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/opt
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/opt/GBS_BUILD

This directory contains information for the generation of the Component.
For each BuildStream that this Component generates a sub-directory of the Build-name can be present to specify exceptions. These directories contain a number of files that give information on Component level:
  • Option-files. To define compile / link options per platform / language / variant.
  • External-ref files. To specify directory-paths for external software (outside any SubSystem)

The 'dat' sub-directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/dat
It contains all other (developer) files that do not fit in any of the Sub-directories mentioned before.
Examples are:
  • Test-scripts
  • Binary data (e.g: (jpeg-, GIF-, bmp-) images, mpeg background image, etc)

The 'sav' sub-directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/comp/GBS_COMPONENT/sav
Contains files that in no way perform a role in the build process, but still have to be kept (saved).
This is the place to keep obsolete files like test-files that are not maintained anymore.

The NON Full GBS directories (make, MSVS, Other) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The 'app' directory

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/app
Non-Full GBS only.
This directory contains the top of the Non-GBS projects/applications directories. The name is reserved and is used only for Non-Full GBS SubSystems.

The 'opts' sub-directory with optional Build-directories

GBS_SYSTEM_PATH/dev/GBS_SUBSYS/opts
GBS_SYSTEM_PATH/dev/GBS_SUBSYS/opts/GBS_BUILD

This directory contains information for the generation of the application.
For each BuildStream that this Component generates a sub-directory of the Build-name can be present to specify exceptions. These directories contain a number of files that give information on SubSys level:
  • Option-files. To define compile / link options per platform / language / variant.
  • External-ref files. To specify directory-paths for external software (outside any SubSystem)

full_dir_struct.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Handling SubSystems & Steps Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

SubSystems Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

GBS recognises a number of SubSystem types that can be either Full GBS or Non-Full GBS.
  • Full GBS
    • GBS
  • Non-Full GBS
    • MSVS (Microsoft Visual Studio) - Windows only
    • make
    • Other

In general:
  • Full GBS Subsystems:
    • Have a 'comp' directory that contains the Components that contain the code
    • The directory structure beneath 'comp' is fixed
    • Components and their contents are fully handled by GBS
    • Commands like gbsbuild, gbsmake and gbsaudit work here.
      Just as gbssysbuild, gbssysmake and gbssysaudit
  • Non-Full GBS Subsystems:
    • Have an 'app' directory that contains user defined directories that contain the code
    • The directory structure beneath 'app' is completely free
    • There are no GBS Components
    • Commands like gbsbuild, gbsmake and gbsaudit do not work here
    • Execution only by commands gbssysbuild, gbssysmake and gbssysaudit.
      Execution is controlled by the subsys.gbs script files in the SubSystem directory
      There is a vast amount of EnvVars that are set before execution of subsys.gbs.bat|.sh to be able to achieve the required functionality. E.g.: Generate for Debug or Release, etc.
      More information on the subsys.gbs file, including an example can he found in subsys.gbs.

MSVS SubSystem

You should create/copy your main project of solution file directly in the 'app' directory.
You will already have a subsys.gbs.bat file appropriate for MSVS, with lots of comments.
Run 'gbsedit subsys.gbs' to change to the wanted functionality.

make SubSystem

You should create/copy your 'make' code tree directly in the 'app' directory.
Your main 'make' file should be either in the SubSystem directory or the 'app' directory.
You will already have a subsys.gbs.bat|.sh file appropriate for 'make', with lots of comments.
Run 'gbsedit subsys.gbs' to change to the wanted functionality.

Other SubSystem

You should create/copy your code tree directly in the 'app' directory.
You will already have a generic subsys.gbs.bat|.sh file, with lots of comments.
Run 'gbsedit subsys.gbs' to change to the wanted functionality.

Steps Bottom Doc. Button Top Document Button Blank Blank Blank Up Chapter Button

By default SubSystems are handled (gen, make, audit) in Alphabetical order.
With the definition of Steps in steps.gbs this order can be changed.
It is also possible to make selections of SubSystems optional in various ways.
It is also possible to define non-SubSystem steps, called 'Commands' that will allow you to execute commands to e.g.:
Copy end-results to a specific directory outside then GBS tree, run Doxygen on the whole GBS tree, etc

More information in steps.gbs.

subsystems.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Procedures Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

In this section the essentials of some GBS procedures are described.
This is in no way a specification, final document or manual.
It shows the basic idea of what is possible in GBS.

Start-up the GBS environment Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The 'gbs' command sets up the GBS environment.
The first time it is called, it will prompt the user for things like System Path and a SubSystem name. This information is remembered between logins.
Some main Environment Variables are defined:
  • $GBS_SYSTEM_PATH
  • $GBS_SUBSYS
  • $GBS_AUDIT
  • $GBS_BUILD
  • $GBS_TOOL
  • $GBS_COMPONENT
These Environment Variables form the basics of the GBS build-environment.
All GBS actions involve the currencies as indicated by these Environment Variables.
GBS maintains the contents of these variables.
Never change these Environment Variables yourself. Use the GBS commands to do that.

Navigating the directory structure Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

GBS is based on a system of currencies: current-System, current-SubSystem, current-Component, current-Build. etc. Whenever you make another System, SubSystem, Component or Build current (switch) the appropriate Environment Variables are set accordingly.
Builds (and Audits and Tools) are always current for a whole System.

Switch System Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another System enter:
swr System-path or, if you do not know the path of the System enter: swr and you will be presented a list of Systems to choose from.

GBS_SYSTEM_PATH and additional Environment Variables needed for this System will be set.

Switch Subsystem Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another Subsystem enter: sws SubSystem-name or, if you do not know the name of the SubSystem enter: sws and you will be presented a list of SubSystems to choose from.

GBS_SUBSYS and additional Environment Variables will be set.

Switch Component Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another Component enter:
swc Component-name or, if you do not know the name of the Component enter: swc and you will be presented a list of Components to choose from.

GBS_COMPONENT and additional Environment Variables will be set

Switch Build Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another build enter
swb Build-name or, if you do not know the name of the Build enter: swb and you will be presented a list of Builds to choose from.

GBS_BUILD and additional Environment Variables will be set

Switch Audit Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another Audit enter
swb Audit-name or, if you do not know the name of the Audit enter: swb and you will be presented a list of Audit to choose from.

GBS_AUDIT and additional Environment Variables will be set

Switch Tool Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

To switch to another Tool enter
swb Tool-name or, if you do not know the name of the Tool enter: swb and you will be presented a list of Tools to choose from.

GBS_TOOL and additional Environment Variables will be set

Building Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Building is the process of generating one or more items from a file in the 'src' directory to one or more files in the 'bld/build' directories.
Typical builds are: compilation, creating a library (archiving), linking.
The file-extension specifies the type of build that is required. (e.g.: *.c →C-compile)

The building process of a single file goes via specific, generic rules:
  • The source file is an argument in the command-line and is taken from the current 'src' directory.
    More than one file from the 'src' directory may be specified. Wildcards are honoured.
  • The resulting files (e.g.) object-files will be written to the current 'bld/build' directories.
    The name of the resulting file will be equal to the name of the source-file. Filename extensions may differ and will be specific for various platforms. i.e.:
    name.c name.obj
    If the build fails, name.* will be deleted from the 'bld' Sub-Directories.
  • The include path (-I) will be assembled in the following order:
    • The current 'loc' directory.
    • The current 'inc' directory
    • The 'inc' directories of the other Components within the same SubSystem:
         In the order and as specified in the 'scope.gbs' file
      or if not present:
         the alphabetical order as found in the comp directory.
    • As specified by the contents of the inc_sourefiletype.gbs files, if present, in the order as found in the following directories, if present:
      • $GBS_COMPONENT_PATH/opt/$GBS_BUILD
      • $GBS_COMPONENT_PATH/opt
      • $GBS_SUBSYS_PATH/build/$GBS_BUILD
      • $GBS_SUBSYS_PATH/build
      • $GBS_SYSTEM_PATH/sysbuild/$GBS_BUILD
      • $GBS_SYSTEM_PATH/sysbuild
      This enables references to external stuff and from the 'import', 'res' and 'ext' areas.
  • The build-time options (-D) will be assembled in the following order:
    • Fixed Build settings for the whole project as defined in the option-file in the 'sysbuild/build' directory.
    • As specified by the contents of the flags_sourefiletype.gbs files, if present, in the order as found in the following directories, if present:
      • $GBS_SYSTEM_PATH/sysbuild
      • $GBS_SYSTEM_PATH/sysbuild/$GBS_BUILD
      • $GBS_SUBSYS_PATH/build
      • $GBS_SUBSYS_PATH/build/$GBS_BUILD
      • $GBS_COMPONENT_PATH/opt
      • $GBS_COMPONENT_PATH/opt/$GBS_BUILD
    • If present: Build-time options as specified in the command-line
      This means that options specified on the command-line will win.
To be able to implement these rules and to take care of any limitations of a building step (like a compiler) scripts are used. I.e.: A compiler is never invoked directly, but always via its (dedicated) script. These scripts must reside in 'SYSGEN/build'.

Typical Build (Generation) commands are:
gbsbuild files-list
gbssysbuild SubSystem-list

Compiling Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Compiling goes straightforward according to the rules specified above.

To compile a single file, enter: gbsbuild file.c More info: Generating Code (Building)

Building Libraries (Archiving) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For building a library, a 'glb-file' acts as the 'src' representative for the 'bld' library.
The glb-file contains a list of all object-files that will make up the library.
The glb-file also gives a name to the library. E.g.:
name.glb → name.lib
Using the rules as mentioned above, a script generates the library-build command needed to create the library, taking the object-files as specified in the glb-file.
A #include statement allows grouping of object-file-names. The search-path is the same as for other #includes
Note that the glb-file may also contain specific archiver options.
More info: glb/glk/glt Files and Generating Code (Building)

Linking Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For linking, a 'glk-file' acts as the 'src' representative for the 'bld' executable.
The glk-file contains a list of all objects and libraries that will make up the executable.
The glk-file also gives a name to the executable. E.g.:
name.glk → name.exe
Using the rules as mentioned above, a script generates the link command needed to link the executable, taking the object-files as specified in the glk-file.
A #include statement allows grouping of file-names. The search-path is the same as for other #includes
Note that the glk-file may also contain linker-options like -L.
More info: glb/glk/glt Files and Generating Code (Building)

Testing Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For (unit-)testing, a 'glt-file' acts as the 'src' representative for the test.
The glt-file contains the command-line with the name of the test-executable. Results go to a log-file in the 'bld'
The glt-file also gives a name to the log-file. E.g.:
name.glt → name.log
Using the rules as mentioned above, a script generates the test command needed to run the executable, taking the executable name as specified in the glt-file.
Note that the glt-file may also contain execution options
More info: glb/glk/glt Files and Generating Code (Building)

Generation by means of 'make' Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

With the information as supplied above 'make' files can now be generated and executed.

Typical commands are:
gbsmakemake
gbsmake build-file-name-list and gbssysmake SubSystem-list
To generate a single executable with 'make', enter: gbsmake myfile.exe
or, if the .glk file is in a different Component than the current-Component: gbsmake other_component:myfile.exe
For more information see: Generating Code (Building)

Exporting deliverables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Each Component has an optional export.gbs file in the Component-directory.
It specifies for each file in the Component that has to be exported, to which export directory it has to be exported, relative to the 'export'-directory and/or the 'res/SubSystem'-directory.
The command is:
gbsexport

Build-streams Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Code may be generated for more than one build: Simulator testing and one or more build platforms.
Sometimes a single source-file generates for more than one build
A sequence of compilations for a specific build, with a specific compiler using the same set of compile-options, possibly followed by linking, resulting in a set of deliverables is called a stream or build-stream.
A total generation of the software-system requires the generation of all streams.
Streams can run in parallel and can so reduce generation throughput time.

Builders and File-types Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

Two mechanisms are used in order to prevent name-clashes (and overwriting of objects/executables):
  • File-type extensions
  • Multiple output directories (explained later)

procedures.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Software Configuration Management Support Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

GBS works independently from a Software Configuration Management System (SCMS).

To ensure however, that GBS-managed files and directories are properly added to the SCMS, GBS provides support for a number of SCMSs:

SCMSs supported Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

  • Git - The stupid content tracker
  • SVN - Subversion

Combining an SCMS with GBS Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

During System creation (swr --new), one of the above (or 'None') may be selected.
If 'None' is selected, you are responsible for the proper handling of all SCMS aspects.

Note that gbsmaint offers a function to check and possibly add GBS-managed files and directories to the selected SCMS.

How it Fits Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Terms Used

    
        REPOSITORY:--SCMS_ROOT------+              +--ext--
    				 \            /
        DISK:--------GBS_PARENT_PATH--+--SYSTEM--+---dev--
    					      \
        DISK:<-------GBS_SYSTEM_PATH-------------->  +--res--
    
    

Overview

SCMS Repository Data Data Type
SVN URL SCMS_ROOT Informational
Git None SCMS_ROOT Informational

SubVersioN Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Create a local repository

  • Install TortoiseSVN: A plugin for your Navigator.
  • Navigate to the directory where the repository must be created.
  • Create a directory with the name of the wanted repository. E.g.: 'MyRepos' (bad name!)
  • Navigate into the created folder (empty).
  • Right-click on free space and select TortoiseSVNCreate repository here
  • Select 'Create folder structure'
  • Select 'Start Repobrowser'
  • Select 'trunk' in the right window
  • Copy the URL to the paste buffer

Create a workspace

  • Navigate to the directory where you want to create the workspace (GBS System)
  • Create the parent directory for your GBS System workarea (use GBS 'SYSTENAME)
  • Right-click on free space and select SVN Checkout...
  • Paste the copied URL to 'URL of repository'
  • Enter the path of the directory you just created in 'Checkout_directory'
  • Click OK

Create GBS System

  • Startup the GBS environment (via shortcut on your desktop)
  • Enter: gbs
  • Navigate (cd) to the created workarea (....../MyRepos)
  • Enter: swr --new
  • Select 'Use the Current Path (CWD) as System Path (....../MyRepos)'
  • Enter the System Name
  • Select 'SubVersioN'
  • Continue with the instructions in Create a GBS-WA/System

Git Bottom Doc. Button Top Document Button Blank Blank Blank Up Chapter Button

TBS... but somewhat similar to SVN

scms.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The Command-line Interface Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

GBS is controlled by command-lines in an X-term or DOS-box. Here is the general behaviour of the commands:

Entering Commands Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

In general:
  • Options for GBS-commands are prefixed with -- (double hyphens).
    Options with a single - will be passed to underlying application(s) like compilers, linkers, qac, etc.
  • '--' (2 hyphens) stops assuming -- as GBS-command option prefix
    All remaining options (including --options) will be passed to under laying applications(s)
  • '---' (3 hyphens) ignores the rest of the commandline.
  • A value of '.' (dot) means: use current
  • A value of '-' (hyphen) for positional arguments means: none
All GBS-commands accept --h for short help and --help for long help
--inc=filespec will redirect the reading of the command-line arguments to a file.

Command Syntax Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

All commands have the format: command [ positional-arg | gbs-option | gbs-env-setting ]...

positional-arg

Positional arguments are specified in this document as <1>, <2>, <3>
<*> specifies: Remaining (or all if none other specified)

gbs-option

All gbs-options start with --

Boolean type

--opt and --opt+ specify value 1
--opt- Specifies value 0

String type

Alphanumeric values
Specify: --opt=value
Specify: --opt="value-with-spaces"
Specify: --opt='value-with-spaces'

Integer type

Only numbers allowed
Specify: --opt=num-value

Time type

Delta (+) and Absolute (=). Default is Absolute (=)
Syntax: [+|=][[H]H:][M]M
Specify Delta: --opt=+HH:MM
Specify Absolute--opt=HH:MM

Array qualifier

Allows specification of multiple values separated by ',' (comma)

gbs-env-setting

By specifying GBS_env-name=value some specific GBS Environment Variables may be given a different value for the duration of the command execution.
The GBS_ prefix may be omitted.

Wildcards (globbing) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Wildcards (* and ?) behave in Windows the same as on Linux (UNIX-style).
This means that wild-card expansion is performed immediately on the current directory. If no match is found, the string will remain as-is.

Inserting space characters Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The command-line works with elements separated by white-space.
Sometimes there is a need to embed spaces in line-elements.
E.g.: -DTEXT=STATUS QUO
Placing an element between "" or ' ' may not always work.
The GBS-commands will replace all occurrences of %_ (Linux), $_ (Windows) and %20 (all) in the command-line by one space.
E.g.: -DTEXT=STATUS%_QUO ⇒ "STATUS QUO"

Prompts Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

In a prompt, possible values are embedded in parenthesis
e.g.:
GBS: Are you sure? (y/n):

In a prompt, the default value is embedded in square brackets
e.g.:
GBS: Are you sure? (y/n)[y]:

Breaking off during prompt Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Entering a single '!' will quit the script.
This is safer than the usual CTRL-C.
All commands can be safely terminated by entering '!' at any prompt. No action will be performed.

'Help' during prompt Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Entering a single '?' will give you some additional information on the prompt.
Not always and not excessive.

'Forms' Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Lines beginning with a '|' (vertical bar) are grouped in a 'form' with an 'OK?' question at the end. (N will repeat the questions, E will Cancel)

Messages Bottom Doc. Button Top Document Button Blank Blank Blank Up Chapter Button

All messages generated by GBS are prefixed by the name of the file generating the message in uppercase.
This distinguishes messages generated by GBS from those generated by the OS and/or called application(s).

command_line.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
All Commands Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

General Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

All commands have the format: command [args | gbs-options]...
gbs-options always start with: -- (hyphen hyphen)
General options (always available):
  • --h
  • --help
General options (mostly available):
  • --verbose
  • --inc
  command --h   will give you short help
  command --h option...   will give you short help on the specified option(s)
  command --help   will give you more extensive help
  command --help option...   will give you long help on the specified option(s)
  --verbose[+|-]   Extensive logging messages if '' or '+'
Always '+' in BATCH jobs (gbssys* commands)
  --inc file   will take the contents of file file as if it were typed on the commandline.
Empty lines and lines starting with '#' are ignored.
Multiple occurrence and nesting is allowed.

General Syntax Description

Refer to The Command Line Interface

Index

bgpids (Non-GBS - Linux only) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Show and/or kill background processes

Syntax:

bgpids [ USERS... ]
[ -a[+|-] ]
[ -f[+|-] ]
[ -k=process_to_kill ]

Semantics:

<*> USERS
string
array optional
<empty> == current user
Default=
-a[+|-] do_all
boolean
scalar optional
Include all processes
Default=0
-f[+|-] do_fg
boolean
scalar optional
Include parent (foreground) processes
Default=0
-k=process_to_kill process_to_kill
integer
scalar optional
Kill specified process-tree
Default=

gbs Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The gbs command will either startup GBS if not started or show the GBS currencies

gbsinit (gbs - Before GBS is started ) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Startup GBS

Syntax:

gbsinit
[ --nos[+|-] ]

Semantics:

--nos[+|-] noswitch
boolean
scalar optional
Do not implicitly swr to current System
Default=0

Note:

Alias for this command is 'gbs'. Exists only when GBS was not yet started

gbsaudit Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Perform an AUDIT on one or more files

Syntax:

gbsaudit ...
[ --i[+|-] ]
[ --stdout[+|-] ]
[ --vs[+|-] ]
[ --aud[+|-] ]
[ --sum[+|-] ]
[ --caller=caller ]
[ --threads=threads ]
[ Environment_Variable=Value ]...

Semantics:

<*> comp_file_opts
string
array mandatory
src-files and AUDIT-options. ALL = *:*.*
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue auditing after error(s)
Default=0
--stdout[+|-] show_stdout
boolean
scalar optional
Show errorlines (0 when not interactive)
Default=1
--vs[+|-] view_sum
boolean
scalar optional
View summary at completion
Default=1
--aud[+|-] run_audit
boolean
scalar optional
Run audit
Default=1
--sum[+|-] run_summary
boolean
scalar optional
Create summary
Default=1
--caller=caller caller
string
scalar optional
choice: gbsaudit gbssysaudit
Internal use.
Default=gbsaudit
--threads=threads threads
integer
scalar optional
range: 1..9
Max. nr. parallel threads
Default=2

Environment Variables:

(GBS_) LOG_PATH (GBS_) MODE (GBS_) FLAGS_*
(GBS_) APP_*    

Note:

Summary files are written to $GBS_LOG_PATH. View with gbssilo

gbsbash (gbswsl) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

The gbsbash command opens a new WSL bash window
Only available on Windows

Syntax:

gbsbash

Semantics:

None

gbsbldcheck Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Check if all files have generated

Syntax:

gbsbldcheck [ subsystems... ]
[ --m=max_missing ]
[ --builds=builds,... ]

Semantics:

<*> subsystems
string
array optional
Specific SubSystems
Default=
--m=max_missing max_missing
integer
scalar optional
Cancel SubSys check after this many missing files
Default=20
--builds=builds builds
string
array optional
(wild-)Builds to Build-Check. '' or '*' == All, '.' == Current
Default=

gbsbg Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Allow user to handle Background Jobs
 1. Show Jobs
 2. View Cur Logfile
 3, Tail Cur Logfile
 4. Cleanup List
 5. View Logfile
    ...
 9. Kill Job

Syntax:

gbsbg [ menu_entries... ]

Semantics:

<*> menu_entries
integer
array optional
greater: 0
Menu entries for immediate execution
Default=

gbsdebug Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Enable and Disable Debug
 1. Enable Debug
 2. Disable Debug

Syntax:

gbsdebug [ selector ] [ debug_name ]
[ --app=application ]

Semantics:

<1> selector
string
scalar optional
choice: 1 2 show enable disable
Menu entry or show/enable/disable
Default=
<2> debug_name
string
scalar optional
Menu entry or EnvName to enable/disable
Default=
--app=application application
string
scalar optional
choice: GBS TOOLS PRQA CPPTEST
Application to debug. E.g.: GBS TOOLS
Default=GBS

gbsedit Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Create/edit GBS-files and user-files. GBS-files end with .gbs
The switch.gbs, subsys.gbs and site.gbs batch files are also considered GBS-files
Source, Include and glkbt-files are considered user-files
Relevant templates will be used with file-creation
On GBS files, where possible, a syntax check is performed after the edit.

Syntax:

gbsedit <basic_filespec> [ editor_opt ]
[ --nco[+|-] ]

Semantics:

<1> basic_filespec
string
scalar mandatory
file, ./file, rel_filespec, filespec or subdir:file
Default=
<2> editor_opt
string
scalar optional
Editor option. e.g. Line-nr to jump to
Default=
--nco[+|-] no_checkout
boolean
scalar optional
By default files will also be added if non-exist
Default=0

gbsexit Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Cleanup and exit the GBS environment

Syntax:

gbsexit
[ --quit[+|-] ]
[ --restart[+|-] ]

Semantics:

--quit[+|-] quit
boolean
scalar optional
Do not setup the basic GBS functions
Default=0
--restart[+|-] restart
boolean
scalar optional
Restart GBS after exit
Default=0

Constraints:

The following combinations are not allowed:
    --quit+ AND --restart+

gbsexport Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Fill the export and/or res directories from the Components and/or Gen or SubSystem by Build

Syntax:

gbsexport [ export_file_locations... ]
[ --i[+|-] ]
[ --c[+|-] ]
[ --show[+|-] ]
[ Environment_Variable=Value ]...

Semantics:

<*> export_file_locations
string
array optional
<Component>... and/or SUBSYS:
. == Current Component. <empty> == <all>
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--c[+|-] cleanup_all
boolean
scalar optional
Delete all, independent from build
Default=0
--show[+|-] show_actions
boolean
scalar optional
Show all actions
Default=0

Environment Variables:

(GBS_) APP_*    

gbsbuild Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Generate one or more files

Syntax:

gbsbuild ...
[ --i[+|-] ]
[ --threads=threads ]
[ Environment_Variable=Value ]...

Semantics:

<*> comp_file_opts
string
array mandatory
src files to generate with 'generate' options. ALL = *:*.*
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation regardless of error(s)
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads
Default=2

Environment Variables:

(GBS_) DEBUGGER (GBS_) MODE (GBS_) OPT
(GBS_) MAP (GBS_) FLAGS_* (GBS_) APP_*

gbsgui Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Startup the GBS GUI

Syntax:

gbsgui
[ --t[+|-] ]
[ --geo=geo ]

Semantics:

--t[+|-] test_mode
boolean
scalar optional
Run in test-mode
Default=0
--geo=geo geo
string
scalar optional
Start geometry - Internal use (width, height, x, y)
Default=.

gbshelp Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Present help on GBS in HTML browser

Syntax:

gbshelp

Semantics:

None

gbslocate Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Locate a file according to include-settings and assigns the location to a specified Environment Variable

Syntax:

gbslocate <env_name> <file> <prefix> ...

Semantics:

<1> env_name
string
scalar mandatory
Env Variable to contain the filespec
Default=
<2> file
string
scalar mandatory
The file to search
Default=
<3> prefix
string
scalar mandatory
prefix string preceding all path-list elements. e.g: -I
Default=
<*> path-list
string
array mandatory
The directories to search preceded by <prefix>
Default=

gbsmaint Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Allow user to execute General Maintenance functions
 1. Audits Handling
 2. Cleanup
 3. Map Network Drives (Linux<->Windows)
 5. User Tools
 6. Integrator Tools
 7. Administrator Tools
 8. Check/Fix GBS Directory Structure
 9. Owners-file Maintenance

Syntax:

gbsmaint [ menu_entries... ]

Semantics:

<*> menu_entries
integer
array optional
greater: 0
Menu entries for immediate execution
Default=

gbsmake Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

'make' one or more files

Syntax:

gbsmake [ comp_file_opts... ]
[ --r[+|-] ]
[ --i[+|-] ]
[ --mo[+|-] ]
[ --threads=threads ]
[ Environment_Variable=Value ]...

Semantics:

<*> comp_file_opts
string
array optional
bld files to make with 'make' options. ALL = *:*.*
Default=
--r[+|-] reverse_type
boolean
scalar optional
Specify source-types instead of build-types
Default=0
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--mo[+|-] make_only
boolean
scalar optional
Run 'make' only (show make results)
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads
Default=2

Environment Variables:

(GBS_) DEBUGGER (GBS_) MODE (GBS_) OPT
(GBS_) MAP (GBS_) FLAGS_* (GBS_) APP_*

gbsmakemake Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Make make-file(s) for the current SubSystem

Syntax:

gbsmakemake [ components... ]
[ --i[+|-] ]

Semantics:

<*> components
string
array optional
. == current component, <empty> == all
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0

gbsman Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

The gbsman command gives a 'more' list of all GBS commands

Syntax:

gbsman

Semantics:

None

gbsnav Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Startup the Navigator in the current or specified directory

Syntax:

gbsnav [ dir_path ]

Semantics:

<1> dir_path
string
scalar optional
Existig directory path or '.'
Default=

gbsscm (scm) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Execute basic SCM commands using the current SCMS

Syntax:

gbsscm <command> [ files... ]
[ --r[+|-] ]
[ --c[+|-] ]

Semantics:

<1> command
string
scalar mandatory
choice: ? info state co ci unco mkdir mktxt add move get_ignore set_ignore remove import connect select
Basic SCM Command
Default=
<*> files
string
array optional
File / Directory  List
Default=
--r[+|-] recursive
boolean
scalar optional
Add whole directory tree
Default=0
--c[+|-] use_cache
boolean
scalar optional
Use cache
Default=0

Note:

info
state   <file-dir>...
co      <file-dir>...
ci      <file-dir>...
unco    <file-dir>...
mkdir   <dir>...
mktxt   <file>...
add     <file-dir>...
get_ignore  <dir>
set_ignore  <dir> <ignore_list>...
remove  <file-dir>...
import  <from-dir> [<to-dir>]
connect
select

gbssetup Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

This command has been replaced by gbssettings

gbssettings (gbssettings.bat or gbssettings.sh) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Setup/Maintain Basic GBS settings (Profile(EnvVars) and Config).

Syntax:

gbssettings [ menu_entries... ]

Semantics:

<*> menu_entries
integer
array optional
greater: 0
Menu entries for immediate execution
Default=
More information here

gbsmanage (gbsmanage.bat or gbsmanage.sh) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Unsetup/Uninstall GBS version(s).
Cannot execute in GBS context

Syntax:

gbsmanage [ menu_entries... ]

Semantics:

<*> menu_entries
integer
array optional
greater: 0
Menu entries for immediate execution
Default=

gbsshow (gbs) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Show GBS currencies

Syntax:

gbsshow
[ --brief[+|-] ]

Semantics:

--brief[+|-] brief
boolean
scalar optional
Brief (short) listing
Default=0

gbssilo Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Generate silo index and show in HTML browser

Syntax:

gbssilo
[ --ci[+|-] ]
[ --cs[+|-] ]
[ --vi[+|-] ]
[ --noc[+|-] ]

Semantics:

--ci[+|-] create_index
boolean
scalar optional
Create the HTML Index
Default=1
--cs[+|-] create_summaries
boolean
scalar optional
Create the HTML Summaries
Default=1
--vi[+|-] view_index
boolean
scalar optional
View index in HTML browser
Default=1
--noc[+|-] no_create
boolean
scalar optional
No HTML Creation (forces --ci and --cs to '-')
Default=0

Constraints:

The following combinations are not allowed:
    --noc+ AND --ci+ or --cs+

gbssysaudit Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Perform an AUDIT on part of or whole System

Syntax:

gbssysaudit [ steps... ]
[ --i[+|-] ]
[ --vs[+|-] ]
[ --audits=audits,... ]
[ --builds=builds,... ]
[ --files=files,... ]
[ --aud[+|-] ]
[ --sum[+|-] ]
[ --fg[+|-] ]
[ --at=delay ]
[ --n[+|-] ]
[ --wait[+|-] ]
[ --threads=threads ]
[ --c=comment ]
[ Environment_Variable=Value ]...

Semantics:

<*> steps
string
array optional
Steps and/or Aliases. <empty> == all select steps, 'CUR', 'ALL' == force all steps, 'CUR', '?' == show steps
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--vs[+|-] view_sum
boolean
scalar optional
View summary at completion
Default=1
--audits=audits audits
string
array optional
choice: . $GBS_AUDITS
(wild-)Audits to run. '' or '*' == All, '.' == Current
Default=*
--builds=builds builds
string
array optional
choice: . $GBS_BUILDS
(wild-)Builds to Build. '' or '*' == All, '.' == Current
Default=*
--files=files files
string
array optional
Files to audit
Default=*:*.*
--aud[+|-] run_audit
boolean
scalar optional
Run audit
Default=1
--sum[+|-] run_summary
boolean
scalar optional
Create summary
Default=1
--fg[+|-] foreground
boolean
scalar optional
Runs in the foreground if set
Default=0
--at=delay delay
time ([+=]hh:mm or [+=]mm) or now)
scalar optional
Starting time (10:20), delta (+10:10) or now
Default=now
--n[+|-] notify
boolean
scalar optional
Notify user on completion (bg/nowait only)
Default=$notify
--wait[+|-] wait
boolean
scalar optional
Wait for completion of bg threads
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads within a submitted job
Default=2
--c=comment comment
string
scalar optional
Comments - will be shown in Summary - Specify %20 for space
Default=

Constraints:

The following combinations are not allowed:
    <*> = ALL AND <*>
    <*> = CUR AND <*> or --audits or --builds
    <*> = ? AND <*>
    --fg+ AND --at or --n+ or --wait+
    --wait+ AND --n+
    --sum- AND --vs+

Environment Variables:

(GBS_) LOG_PATH (GBS_) FLAGS_* (GBS_) APP_*

Note:

Summary files are written to $GBS_SILO_PATH/audits. View with gbssilo
See also: The gbssys... commands
Use gbsbg command to View and/or Kill a Job

gbssysbuild Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Generate part of or whole System

Syntax:

gbssysbuild [ steps... ]
[ --i[+|-] ]
[ --mm[+|-] ]
[ --export[+|-] ]
[ --builds=builds,... ]
[ --files=files,... ]
[ --fg[+|-] ]
[ --at=delay ]
[ --n[+|-] ]
[ --wait[+|-] ]
[ --threads=threads ]
[ --c=comment ]
[ Environment_Variable=Value ]...

Semantics:

<*> steps
string
array optional
Steps and/or Aliases. <empty> == all select steps, 'ALL' == force all steps, '?' == show steps
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--mm[+|-] run_makemake
boolean
scalar optional
Run 'gbsmakemake' on completion of Full GBS SubSystems
Default=1
--export[+|-] run_export
boolean
scalar optional
Run 'gbsexport' on completion
Default=1
--builds=builds builds
string
array optional
choice: . $GBS_BUILDS
(wild-)Builds to Build. '' or '*' == All, '.' == Current
Default=*
--files=files files
string
array optional
Files to build
Default=*:*.*
--fg[+|-] foreground
boolean
scalar optional
Runs in the foreground if set
Default=0
--at=delay delay
time ([+=]hh:mm or [+=]mm) or now)
scalar optional
Starting time (10:20), delta (+10:10) or now
Default=now
--n[+|-] notify
boolean
scalar optional
Notify user on completion (bg/nowait only)
Default=$notify
--wait[+|-] wait
boolean
scalar optional
Wait for completion of bg threads
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads within a submitted job
Default=2
--c=comment comment
string
scalar optional
Comments - will be shown in Summary - Specify %20 for space
Default=

Constraints:

The following combinations are not allowed:
    <*> = ALL AND <*>
    <*> = CUR AND <*> or --builds
    <*> = ? AND <*>
    --fg+ AND --at or --n+ or --wait+
    --wait+ AND --n+

Environment Variables:

(GBS_) LOG_PATH (GBS_) DEBUGGER (GBS_) MODE
(GBS_) OPT (GBS_) MAP (GBS_) FLAGS_*
(GBS_) APP_*    
See also: The gbssys... commands
Use gbsbg command to View and/or Kill a Job

gbssysmake Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Generate part of or whole System using 'make'

Syntax:

gbssysmake [ steps... ]
[ --i[+|-] ]
[ --smm[+|-] ]
[ --mm[+|-] ]
[ --export[+|-] ]
[ --builds=builds,... ]
[ --files=files,... ]
[ --fg[+|-] ]
[ --at=delay ]
[ --n[+|-] ]
[ --wait[+|-] ]
[ --threads=threads ]
[ --c=comment ]
[ Environment_Variable=Value ]...

Semantics:

<*> steps
string
array optional
Steps and/or Aliases. <empty> == all select steps, 'CUR', 'ALL' == force all steps, '?' == show steps
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--smm[+|-] start_makemake
boolean
scalar optional
Pre-generate the make-file
Default=1
--mm[+|-] run_makemake
boolean
scalar optional
Run 'gbsmakemake' on completion of Full GBS SubSystems
Default=1
--export[+|-] run_export
boolean
scalar optional
Run 'gbsexport' on completion
Default=1
--builds=builds builds
string
array optional
choice: . $GBS_BUILDS
(wild-)Builds to Build. '' or '*' == All, '.' == Current
Default=*
--files=files files
string
array optional
Files to make
Default=*:*.*
--fg[+|-] foreground
boolean
scalar optional
Runs in the foreground if set
Default=0
--at=delay delay
time ([+=]hh:mm or [+=]mm) or now)
scalar optional
Starting time (10:20), delta (+10:10) or now
Default=now
--n[+|-] notify
boolean
scalar optional
Notify user on completion (bg/nowait only)
Default=$notify
--wait[+|-] wait
boolean
scalar optional
Wait for completion of bg threads
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads within a submitted job
Default=2
--c=comment comment
string
scalar optional
Comments - will be shown in Summary - Specify %20 for space
Default=

Constraints:

The following combinations are not allowed:
    <*> = ALL AND <*>
    <*> = CUR AND <*> or --builds
    <*> = ? AND <*>
    --fg+ AND --at or --n+ or --wait+
    --wait+ AND --n+

Environment Variables:

(GBS_) LOG_PATH (GBS_) DEBUGGER (GBS_) MODE
(GBS_) OPT (GBS_) MAP (GBS_) FLAGS_*
(GBS_) APP_*    
See also: The gbssys... commands
Use gbsbg command to View and/or Kill a Job

gbssystool Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Perform TOOL on part of or whole System

Syntax:

gbssystool [ steps... ]
[ --i[+|-] ]
[ --vs[+|-] ]
[ --tools=tools,... ]
[ --fg[+|-] ]
[ --at=delay ]
[ --n[+|-] ]
[ --wait[+|-] ]
[ --threads=threads ]
[ --c=comment ]
[ Environment_Variable=Value ]...

Semantics:

<*> steps
string
array optional
Steps and/or Aliases. <empty> == all select steps, 'CUR', 'ALL' == force all steps, '?' == show steps
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--vs[+|-] view_sum
boolean
scalar optional
View summary at completion
Default=1
--tools=tools tools
string
array optional
choice: . $GBS_TOOLS
(wild-)Tools to execute. '' or '*' == All, '.' == Current
Default=*
--fg[+|-] foreground
boolean
scalar optional
Runs in the foreground if set
Default=0
--at=delay delay
time ([+=]hh:mm or [+=]mm) or now)
scalar optional
Starting time (10:20), delta (+10:10) or now
Default=now
--n[+|-] notify
boolean
scalar optional
Notify user on completion (bg/nowait only)
Default=$notify
--wait[+|-] wait
boolean
scalar optional
Wait for completion of bg threads
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads within a submitted job
Default=2
--c=comment comment
string
scalar optional
Comments - will be shown in Summary - Specify %20 for space
Default=

Constraints:

The following combinations are not allowed:
    <*> = ALL AND <*>
    <*> = CUR AND <*> or --tools
    <*> = ? AND <*>
    --fg+ AND --at or --n+ or --wait+
    --wait+ AND --n+

Environment Variables:

(GBS_) LOG_PATH (GBS_) FLAGS_* (GBS_) APP_*

Note:

Output files (Summary files) are written to $GBS_SILO_PATH/audits. View with gbssilo
See also: The gbssys... commands
Use gbsbg command to View and/or Kill a Job

gbssysall Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Execute gbssysbuild/gbssysmake, gbssysaudit and gbssystool commands

Syntax:

gbssysall [ steps... ]
[ --i[+|-] ]
[ --vs[+|-] ]
[ --audits=audits,... ]
[ --builds=builds,... ]
[ --tools=tools,... ]
[ --current[+|-] ]
[ --files=files,... ]
[ --make[+|-] ]
[ --fg[+|-] ]
[ --at=delay ]
[ --n[+|-] ]
[ --wait[+|-] ]
[ --threads=threads ]
[ --c=comment ]
[ Environment_Variable=Value ]...

Semantics:

<*> steps
string
array optional
Steps and/or Aliases. <empty> == all select steps, 'ALL' == force all steps, '?' == show steps
Default=
--i[+|-] ignore_errors
boolean
scalar optional
Continue generation after error(s)
Default=0
--vs[+|-] view_sum
boolean
scalar optional
View summary at completion
Default=1
--audits=audits audits
string
array optional
choice: . $GBS_AUDITS
(wild-)Audits to run. '' or '*' == All, '.' == Current
Default=*
--builds=builds builds
string
array optional
choice: . $GBS_BUILDS
(wild-)Builds to Build. '' or '*' == All, '.' == Current
Default=*
--tools=tools tools
string
array optional
choice: . $GBS_TOOLS
(wild-)Tools to Execute. '' or '*' == All, '.' == Current, '-' == None
Default=*
--current[+|-] current
boolean
scalar optional
Sets --audits, --builds and --tools to '.' (current)
Default=0
--files=files files
string
array optional
Files to audit
Default=*:*.*
--make[+|-] make
boolean
scalar optional
Run gbssysmake instead of gbssysbuild
Default=0
--fg[+|-] foreground
boolean
scalar optional
Runs in the foreground if set
Default=0
--at=delay delay
time ([+=]hh:mm or [+=]mm) or now)
scalar optional
Starting time (10:20), delta (+10:10) or now
Default=now
--n[+|-] notify
boolean
scalar optional
Notify user on completion (bg/nowait only)
Default=$notify
--wait[+|-] wait
boolean
scalar optional
Wait for completion of bg threads
Default=0
--threads=threads threads
integer
scalar optional
range: 1..9
Max nr parallel threads within a submitted job
Default=2
--c=comment comment
string
scalar optional
Comments - will be shown in Summary - Specify %20 for space
Default=

Constraints:

The following combinations are not allowed:
    <*> = ALL AND <*>
    <*> = CUR AND <*> or --audits or --builds or --tools
    <*> = ? AND <*>
    --current+ AND --audits or --builds or --tools
    --fg+ AND --at or --n+ or --wait+
    --wait+ AND --n+

Environment Variables:

(GBS_) LOG_PATH (GBS_) FLAGS_* (GBS_) APP_*

Note:

Commands are only executed if applicable
See also: The gbssys... commands
Use gbsbg command to View and/or Kill a Job

gbsstart (%GBS_BOOT_PATH%\gbsstart.bat or $GBS_BOOT_PATH/gbsstart.sh) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Startup GBS and execute a (GBS) command. To be used for integration of GBS in other tools

Syntax:

gbsstart <system_spec> [ subsystem ] [ component ]
[ --build=build ]
[ --audit=audit ]
[ --tool=tool ]
--exec=execute_command

Semantics:

<1> system_spec
string
scalar mandatory
System: '-' == none, '.' == current, '!' == CWD, '!<abs_file/dir_spec>', '!!' == CWD = GBS_SYSTEM_PATH
Default=!
<2> subsystem
string
scalar optional
SubSystem: '-' == none, '.' or '' == current
Default=
<3> component
string
scalar optional
Component: '-' == none, '.' or '' == current
Default=
--build=build build
string
scalar optional
Build: '-' == none, '.' or '' == current
Default=.
--audit=audit audit
string
scalar optional
Audit: '-' == none, '.' or '' == current
Default=.
--tool=tool tool
string
scalar optional
Toolt: '-' == none, '.' or '' == current
Default=.
--exec=execute_command execute_command
string
scalar mandatory
(GBS-)Command to execute. 'none' = OK
Default=

Constraints:

The following combinations are not allowed:
    <1> = - AND <2>
    <1> = - AND <3>
    <2> = - AND <3>

More info:

For Tools integration purposes, use the replacing gbsstart_here command.

gbsstart_here (%GBS_BOOT_PATH%\gbsstart_here.bat or $GBS_BOOT_PATH/gbsstart_here.sh) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Startup GBS and execute a (GBS) command, using the CWD.
To be used for integration of GBS in other Development Tools / Editors.
Replaces 'gbsstart' in most situations

Syntax:

gbsstart_here <gbs_command> [ gbs_command_args... ]

Semantics:

<1> gbs_command
string
scalar mandatory
GBS command. e.g.: gbsbuild
Default=
<*> gbs_command_args
string
array optional
GBS command args, including --options
Default=

More info:

Integration with other Tools

gbsstats Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Show GBS System Statistics

Syntax:

gbsstats
[ --lines[+|-] ]
[ --cs[+|-] ]
[ --vi[+|-] ]

Semantics:

--lines[+|-] count_lines
boolean
scalar optional
Count lines in src, inc and loc
Default=0
--cs[+|-] create_stats
boolean
scalar optional
Create the HTML Statistics
Default=1
--vi[+|-] view_index
boolean
scalar optional
View index in HTML browser
Default=1

swc (gbsswc) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set and/or Create new Current Component

Syntax:

gbsswc swc [ component ]
[ --build=build ]
[ --audit=audit ]
[ --new[+|-] ]
[ --delete[+|-] ]
[ --nocd[+|-] ]

Semantics:

<1> component
string
scalar optional
Component: '' == ASK, '-' == none, '.' == current
Default=
--build=build build
string
scalar optional
Build: '-' == none, '.' == current
Default=
--audit=audit audit
string
scalar optional
Audit. '-' == none, '.' == current
Default=
--new[+|-] create_component
boolean
scalar optional
Create a new Component
Default=0
--delete[+|-] delete_component
boolean
scalar optional
Delete a Component
Default=0
--nocd[+|-] no_cd
boolean
scalar optional
Do not 'cd' to the selected directories
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND --delete+ or --build or --audit
    --delete+ AND --new+ or --build or --audit
    <1> = - AND --new+ or --delete+ or --build or --audit

swr (gbsswr) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set a current System or
- Create a new one
- Add / Remove one from the Systems-List
- Delete one
- Show the Systems-List

Syntax:

gbsswr swr [ system_spec ] [ subsystem ] [ component ]
[ --build=build ]
[ --audit=audit ]
[ --tool=tool ]
[ --new[+|-] ]
[ --add[+|-] ]
[ --remove[+|-] ]
[ --delete[+|-] ]
[ --show[+|-] ]
[ --exec=execute_command ]
[ --nocd[+|-] ]

Semantics:

<1> system_spec
string
scalar optional
System: <abs_or_relspec>, '' == ASK, '-' == none, '.' == current, '!' == CWD, '!<abs_or_relspec>' (search), '!!' == current GBS_SYSTEM_PATH
Default=
<2> subsystem
string
scalar optional
SubSystem: '-' == none, '.' == current
Default=
<3> component
string
scalar optional
Component: '-' == none, '.' == current
Default=
--build=build build
string
scalar optional
Build: '-' == none, '.' == current
Default=
--audit=audit audit
string
scalar optional
Audit: '-' == none, '.' == current
Default=
--tool=tool tool
string
scalar optional
Tool: '-' == none, '.' == current
Default=
--new[+|-] create_system
boolean
scalar optional
Create a new System
Default=0
--add[+|-] add_system
boolean
scalar optional
Add a System to the Systems-List
Default=0
--remove[+|-] remove_system
boolean
scalar optional
Remove a System from the Systems-List - do not Delete
Default=0
--delete[+|-] delete_system
boolean
scalar optional
Remove and Delete a System from the Systems-List
Default=0
--show[+|-] show_systems
boolean
scalar optional
Show the Systems-List
Default=0
--exec=execute_command execute_command
string
scalar optional
(GBS-)Command(s) to execute. 'none' = OK
Default=
--nocd[+|-] no_cd
boolean
scalar optional
Do not 'cd' to the selected directories
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND --add+ or --remove+ or --delete+ or --show+ or --exec or <2> or --build or --audit or --tool
    --add+ AND --new+ or --remove+ or --delete+ or --show+ or --exec or <2> or --build or --audit or --tool
    --remove+ AND --new+ or --add+ or --delete+ or --show+ or --exec or <2> or --build or --audit or --tool
    --delete+ AND --new+ or --add+ or --remove+ or --show+ or --exec or <2> or --build or --audit or --tool
    --show+ AND --new+ or --add+ or --remove+ or --delete+ or --exec or <2> or --build or --audit or --tool
    <1> = - AND --new+ or --add+ or --remove+ or --delete+ or --show+ or --exec or <2> or --build or --audit or --tool
    <2> = - AND <3>
    <1> AND <2> or <3> or --build or --audit or --tool

Note:

You can only '--add' a System if it was originally created by 'swr --new'

sws (gbssws) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set and/or Create new Current SubSystem

Syntax:

gbssws sws [ subsystem ] [ component ]
[ --build=build ]
[ --audit=audit ]
[ --new[+|-] ]
[ --delete[+|-] ]
[ --nocd[+|-] ]

Semantics:

<1> subsystem
string
scalar optional
SubSystem. '' == ASK, '-' == none, '.' == current
Default=
<2> component
string
scalar optional
Component. '-' == none, '.' == current
Default=
--build=build build
string
scalar optional
Build. '-' == none, '.' == current
Default=
--audit=audit audit
string
scalar optional
Audit. '-' == none, '.' == current
Default=
--new[+|-] create_subsys
boolean
scalar optional
Create a new SubSystem
Default=0
--delete[+|-] delete_subsys
boolean
scalar optional
Delete a SubSystem
Default=0
--nocd[+|-] no_cd
boolean
scalar optional
Do not 'cd' to the selected directories
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND <2> or --delete+ or --build or --audit
    --delete+ AND <2> or --new+ or --build or --audit
    <1> = - AND --new+ or --delete+ or <2> or --build or --audit

swb (gbsswb) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set and/or Create new Current Build

Syntax:

gbsswb swb [ build ]
[ --new[+|-] ]
[ --remove[+|-] ]
[ --delete[+|-] ]

Semantics:

<1> build
string
scalar optional
Build: '' == ASK, '-' == none, '.' == current
Default=
--new[+|-] create_build
boolean
scalar optional
Create a new Build
Default=0
--remove[+|-] remove_build
boolean
scalar optional
Remove a Build from the Builds List
Default=0
--delete[+|-] delete_build
boolean
scalar optional
Delete a Build
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND --remove+ or --delete+
    --remove+ AND --new+ or --delete+
    --delete+ AND --new+ or --remove+

swa (gbsswa) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set and/or Create new Current Audit

Syntax:

gbsswa swa [ audit ]
[ --new[+|-] ]
[ --remove[+|-] ]
[ --delete[+|-] ]

Semantics:

<1> audit
string
scalar optional
Audit: '' == ASK, '-' == none, '.' == current
Default=
--new[+|-] create_audit
boolean
scalar optional
Create a new Audit
Default=0
--remove[+|-] remove_audit
boolean
scalar optional
Remove an Audit from the Audits List
Default=0
--delete[+|-] delete_audit
boolean
scalar optional
Delete an Audit
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND --remove+ or --delete+
    --remove+ AND --new+ or --delete+
    --delete+ AND --new+ or --remove+

swt (gbsswt) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Set and/or Create new Current Tool

Syntax:

gbsswt swt [ tool ]
[ --new[+|-] ]
[ --remove[+|-] ]
[ --delete[+|-] ]

Semantics:

<1> tool
string
scalar optional
Tool: '' == ASK, '-' == none, '.' == current
Default=
--new[+|-] create_tool
boolean
scalar optional
Create a new Tool
Default=0
--remove[+|-] remove_tool
boolean
scalar optional
Remove a Tool from the Tools List
Default=0
--delete[+|-] delete_tool
boolean
scalar optional
Delete a Tool
Default=0

Constraints:

The following combinations are not allowed:
    --new+ AND --remove+ or --delete+
    --remove+ AND --new+ or --delete+
    --delete+ AND --remove+ or --new+

gbssudo Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Execute a GBS command in Elevated Mode (SuperUser/Administrator)

Syntax:

gbssudo <command> [ command_args... ]

Semantics:

<1> command
string
scalar mandatory
choice: edit manage
GBS command to execute
Default=
<*> command_args
string
array optional
Arguments for <command>
Default=

Note:

edit      <file_name>
manage    <menu_entries>...

gbswhich Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Show Build and Audit data. Lookup header-files, sub-files

Syntax:

gbswhich [ what ] [ what_args... ]
[ Environment_Variable=Value ]...

Semantics:

<1> what
string
scalar optional
choice:  ? subsys comp component build audit tool find search
Specify
Default=
<*> what_args
string
array optional
'what'-dependent
Default=

Environment Variables:

(GBS_) FLAGS_*    

Note:

subsys
component
build
build <src_file_type>
build <bld_file_type>
build .glkb
audit
audit  <src_file_type>
tool
find   <include_file> <find_method>
search <source_file>
search <subdir>/<file>

gbsxref Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Show cross-references using makefiles and/or scope-files Launcher

Syntax:

gbsxref
[ --t[+|-] ]

Semantics:

--t[+|-] test_mode
boolean
scalar optional
Run in test-mode - Internal use
Default=0

Install.bat & Install.sh Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Install GBS (and possibly setup GBS).

Syntax:

Install.bat [ install_root ]
[ --q[+|-] ]
[ --setup[+|-] ]
[ --site=site ]
[ --company=company ]
[ --log_root=log_root ]

Semantics:

<1> install_root
string
scalar optional
path: syntax check only
Install-Root. Remembered
Default=
--q[+|-] quiet_mode
boolean
scalar optional
Run in Quiet-Mode (No prompts)
Default=0
--setup[+|-] setup
boolean
scalar optional
Call gbssetup after install. Not if Multi-User. Remembered
Default=
--site=site site
string
scalar optional
word: Min. length = 3 Max. length = 20
Default Site. Remembered and passed to gbssetup
Default=
--company=company company
string
scalar optional
text: Min. length = 2 Max. length = 40
Default Company
Default=
--log_root=log_root log_root
string
scalar optional
path: syntax check only
Default Log-Root. Passed to gbssetup. Not if Multi-User.
Default=

Note

This command resides in the $GBS_SCRIPTS_PATH/Install/gbs directory

More info:

Install

_gbssetup.bat & _gbssetup.sh Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Setup GBS (After Install).

Syntax:

_gbssetup.bat
[ --q[+|-] ]
[ --site=site ]
[ --company=company ]
[ --log_root=log_root ]

Semantics:

--q[+|-] quiet_mode
boolean
scalar optional
Run in Quiet-Mode (No prompts)
Default=0
--site=site site
string
scalar optional
word: Min. length = 3 Max. length = 20
Default Site
Default=
--company=company company
string
scalar optional
text: Min. length = 2 Max. length = 40
Default Company
Default=
--log_root=log_root log_root
string
scalar optional
path: syntax check only
Default Log-Root
Default=

Note

This command resides in the $GBS_SCRIPTS_PATH directory

More info:

Setup

detab (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Replace TABs by spaces in files

Syntax:

detab [ files ]
[ -t[+|-] ]
[ -r[+|-] ]
[ -f=wild_files,... ]
[ -m=modulo ]
[ -s[+|-] ]

Semantics:

<*> files
string
scalar optional
Files to process or directory in case of -r
Default=
-t[+|-] test
boolean
scalar optional
test only - do not make modifications
Default=0
-r[+|-] recurse
boolean
scalar optional
recurse directory looking for -f= files
Default=0
-f=wild_files wild_files
string
array optional
wild-card files to process
Default=
-m=modulo modulo
integer
scalar optional
The TAB size the file was created with
Default=8
-s[+|-] smart_tabs
boolean
scalar optional
retab leading whitespace (modulo 8)
Default=0

fixeol (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Fix EndOfLine characters of specified file(s) according to the invoking Operating System

Syntax:

fixeol files...

Semantics:

files string
array mandatory
Files to be fixed
Default=

filerep (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Rename/Delete files

Syntax:

filerep <command_or_commandsfile> [ files ]
[ -t[+|-] ]
[ -r=recurse,... ]
[ -R=recurse_group,... ]

Semantics:

<1> command_or_commandsfile
string
scalar mandatory
Rename/Delete Command or @filespec of file containing Rename/Delete Commands
Rename/Delete Command: <delim><find><delim><replace><delim>[g|r][i]
- g = glob rename (default)
- r = Perl regular expression rename
- i = ignore case of search string
Empty <replace> deletes the file
commandsfile:  Empty lines and lines beginning with '#' are ignored
Default=
<*> files
string
scalar optional
(wild-)Files and.or Dirs to process
Default=
-t[+|-] test
boolean
scalar optional
test only - do not make modifications
Default=0
-r=recurse recurse
string
array optional
recurse direcory using comma-separated wild files
Default=
-R=recurse_group recurse_group
string
array optional
recurse direcory using comma-separated file-groups. e.g.: perl
Default=

Note:

Directory/Files starting with '.' are skipped

Note:

No check-out is performed on file(s)

pgrep (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Find strings in files, using Perl regular expressions

Syntax:

pgrep <rexexp_or_file> [ files ]
[ -w[+|-] ]
[ -b[+|-] ]
[ -e[+|-] ]
[ -a[+|-] ]
[ -i[+|-] ]
[ -n[+|-] ]
[ -B=before_context ]
[ -A=after_context ]
[ -C=context ]
[ -r=recurse,... ]
[ -R=recurse_group,... ]
[ -s[+|-] ]

Semantics:

<1> rexexp_or_file
string
scalar mandatory
Perl regexp or @filespec of file containing Perl regexps
regexp-file:  Empty lines and lines beginning with '#' are ignored
Default=
<*> files
string
scalar optional
(wild-)Files and.or Dirs to process
Default=
-w[+|-] word
boolean
scalar optional
find word (no regexp)
Default=0
-b[+|-] begin
boolean
scalar optional
find begin word (no regexp)
Default=0
-e[+|-] end
boolean
scalar optional
find end word (no regexp)
Default=0
-a[+|-] any
boolean
scalar optional
find any (no regexp)
Default=0
-i[+|-] ignore_case
boolean
scalar optional
ignore case of search string
Default=0
-n[+|-] print_linenr
boolean
scalar optional
print linenumber
Default=1
-B=before_context before_context
integer
scalar optional
print <num> lines of leading context
Default=0
-A=after_context after_context
integer
scalar optional
print <num> lines of trailing context
Default=0
-C=context context
integer
scalar optional
print <num> lines of output context (-A=<num> and -B=<num>)
Default=0
-r=recurse recurse
string
array optional
recurse direcory using comma-separated wild files
Default=
-R=recurse_group recurse_group
string
array optional
recurse direcory using comma-separated file-groups. e.g.: perl
Default=
-s[+|-] supress_msg
boolean
scalar optional
Suppress non-error messages
Default=0

Note:

Directory/Files starting with '.' are skipped

proto (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Generate function-prototypes for C, C++ and Perl

Syntax:

proto [ files ]

Semantics:

<*> files
string
scalar optional
Files to be parsed
Default=*.c,*.cpp,*.oc,*.pl,*.pm

win2unix (Non-GBS - Linux Only) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

The win2unix command will convert Files from Windows-format to Unix-format

Syntax:

win2unix files...

Semantics:

files string
array mandatory
Files to convert
Default=

wordrep (Non-GBS) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Replace words/strings in files

Syntax:

wordrep <command_or_commandsfile> [ files ]
[ -t[+|-] ]
[ -r=recurse,... ]
[ -R=recurse_group,... ]

Semantics:

<1> command_or_commandsfile
string
scalar mandatory
Replace Command or @filespec of file containing Replace Commands
Replace Command: <delim><find><delim><replace><delim>[w|b|e|a|r][i]
- w = find word, b = find begin word, e = find end word
- a = find any,  r = find Perl regular expression
- i = ignore case of search string
- \s in replace string is converted to single space
commandsfile:  Empty lines and lines beginning with '#' are ignored
Default=1
<*> files
string
scalar optional
(wild-)Files and.or Dirs to process
Default=
-t[+|-] test
boolean
scalar optional
test only - do not make modifications
Default=0
-r=recurse recurse
string
array optional
recurse direcory using comma-separated wild files
Default=
-R=recurse_group recurse_group
string
array optional
recurse direcory using comma-separated file-groups. e.g.: perl
Default=

Note:

Directory/Files starting with '.' are skipped

Note:

No check-out is performed on file(s)

wsudo (Non-GBS - Windows Only) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

Run a command in Elevated Mode ('as Administrator')
Somewhat like Linux: sudo
But the command is run in a separate window

Syntax:

wsudo [ command_sequence ]

Semantics:

command_sequence string
array optional
Command(s) to be executed
If omitted a CMD Window will be started in Elevated Mode.

grep tail touch and more... (Non-GBS - Windows Only) Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Purpose:

How any programmer can survive without 'grep' is beyond my understanding...
Gratefully copied from Karl M. Syring 's UnxUtils (now OpenSource) and (partly) delivered as part of GBS.
Please read the Standard Disclaimer.
Some extra help can be found UnxUtils Home Page. Note that not all commands are distributed with GBS. Feel free to request additions.

The executables are located in '%GBS_SCRIPTS_PATH%/win2utils'.
You may consider adding the win32utils directory in your PATH.
In switch.gbs.bat add:
IF "%WIN32UTILS_IN_PATH%"=="" THEN PATH=%GBS_SCRIPTS_PATH%\win2util;%PATH%
SET WIN32UTILS_IN_PATH=1

Syntax and Help:

On Command Line the following commands are predefined (DosKey):
 grep --help
egrep --help
agrep --help
 tail --help
touch --help
which --help

In GBS 'make' or via '%GBS_SCRIPTS_PATH%/win2utils' you can use:
   cp --help
 find --help
 gawk --help
 make --help
   rm --help
  sed --help
  tar --help


all_commands.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The gbssys... commands Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

gbssysbuild, gbssysmake, gbssysaudit, gbssystool and gbssysall Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

The gbssys... commands are used to perform actions involving more than one SubSystem.

gbssysbuild   is used to generate a whole or part of a whole System
gbssysmake   is used to 'make' a whole or part of a whole System
gbssysaudit   is used to audit a whole or part of a whole System
gbssystool   is used run a tool on the whole or part of a whole System

gbssysall   is used run all of the above

These commands will perform their functions over various SubSystems in the appropriate order and allows extra steps to be executed.
It is also possible to generate a number of SubSystems selectively.
The generations steps, their required order and allowed options are defined in the steps.gbs file (in $GBS_SYS_PATH).
Execution will be performed in the batch and the output is logged in a log-file.

Usage

gbssys...  [ steps | CUR | ALL ] [ GBS-options ] [ APP-options ] [ GBS-env-variables ] [ other_gbs_options ]
steps
Specifies the names of the steps to be executed
The stepnames are defined in the steps.gbs file.
If no steps are specified, all steps are assumed. Same as ALL.
If CUR is specified only the current SubSystem, with current Build, Audit or Tool is executed.
The '-' can be used to specify 'from - to' steps. It must be surrounded by spaces.
An empty 'from' specifies 'from the first'
An empty 'to' specifies 'to and including the last'
E.g.: step1 - step3 step6 step8 step9 -
-→ step1 step2 step3 step6 step8 step9 step10 step11 ... stepnn

GBS-options
Contain an '='.
Standard GBS-options:
BUILD =...
DEBUGGER =,YES,NO
MODE =,FINAL,ASSERT,DEBUG
OPT =,YES,SPEED,SIZE,NO
MAP =,NO,YES
FLAGS_MAKE =...
FLAGS_src_type =...
e.g.: BUILD=FINAL MODE=DEBUG

APP-options
Contain an '=' As defined in the GBS Customisation (Session) file
e.g. APP_PROFILING=YES

GBS-env-variables
Any assignment that starts with GBS_ is considered a request to define a (temporary) GBS environment-variable with that value.
e.g. GBS_FLAGS_MAKE="-u" will set the GBS_FLAGS_MAKE Environment Variable to the specified value for the duration on the command.

LOG files Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

.log files

Log files are written to $GBS_LOG_PATH, which unless defined in switch.gbs points to $GBS_LOG_ROOT/$GBS_SYSTEM_PARENT.
For each run 2 to 3 files will be generated:
  • logfile_name.log
    The actual logfile
  • logfile_name.log.sum
    A fixed-format summary of the logfile
  • logfile_name.err
    Only in case of errors

The logfile_name

gbssys-command_build-or-tool_audit-or-hyphen_packed-num-date-time
packed-num-date-time := YYYYMMDD-hhmmss
E.g.: gbssysaudit_mingw_pclint_20150214-12:00:00

The .log.sum file

This file contains a summary of the .log file.
It is a fixed-format file. One item per line.
Its layout will never change. Although new items may be added at the end, before the <<EOF>>.
This file can be used for your own tooling to extract information from the run.
Format:
jobname : gbssysbuild gbssysmake gbssysaudit gbssystool'
build_or_tool :
uname : computer name and id
os_root_spec : $GBS_SYSTEM_PATH
os_logfile_spec : $GBS_LOG_PATH/$jobname_$build_$audit_$datetime.log
time_start : YYYY-MM-DD hh:mm:ss
time_end : YYYY-MM-DD hh:mm:ss
time_diff : hhh:mm:ss
timer_diff : "$clock $cpu_system $cpu_user $cpu_all" in seconds
state : NORMAL FAILED KILLED
rc : Return Code (Numeric. 0 == OK)
audit : or '-'
date_time : YYMMDD-hhmmss as used in os_logfile_name
command_args : From the command-line
comment : From the command-line (--c=...)
<<EOF>> :

.html files

These are the Summary files resulting from gbsaudit and not from gbssysaudit

gbssys.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Generating Code (Building) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Building basics Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

There are two commands to be used for building (generating code): gbsbuild and gbsmake.
Each command is used for all aspects of building: compile, archive, link, test.
They are almost alike for the difference see the next chapter below.

gbsbuild is straightforward.

gbsmake requires some explanation.

gbsmake

gbsmake needs a 'make'-file.
The gbsmakemake command creates a make-file per SubSystem and Build.
You only need to run gbsmakemake when your include-structure changes.
Note that the system-wide gbssysbuild and gbssysmake will always create new make-files (implicit makemake).

gbsmakemake

gbsmakemake will parse all the Component src-files in a SubSystem to detect dependencies and create one (big) make-file per Component with no macros at all. This makes 'make' super-fast.
To be able to do this, gbsmakemake needs to know where the compiler gets its include-files. All other include-paths are derived from the GBS file-structure.
The compiler include-files are found via GBSEXT_plugin>_PATH which is a combination of GBSEXT_plugin>_ROOT and GBSEXT_plugin>_REL. A wrong '_REL.' may cause gbsmakemake to fail.

gbsmakemake has no knowledge of conditional includes (speed). Sometimes the include file may not be available (i.e. because of platform dependency). If all fails, you can put dummy files (stubs) in the makemake_stubs directory in sysbuild to satisfy gbsmakemake.

The difference between GBSBUILD and GBSMAKE Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

gbsbuild

  • You specify the source (e.g. file.c)
  • Only the specified file(s) will be generated
  • All the specified files will be generated

gbsmake

  • You specify the resulting file (e.g. file.o), Component-name or 'all'
  • Other files (even in other Components) may be generated
  • Specified files may or may not be (re-)generated

Specifying Files in GBSBUILD, GBSMAKE and GBSAUDIT Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax

The generic syntax to specify files in GBSBUILD, GBSMAKE and GBSAUDIT is:

    [options1]... [ [[Component:][file]... [options2] ]...

The string is parsed left-to-right, setting the 'current-Component' as specified with Component:
Both Component and file may contain wild-cards.
file may be a comma-list, binding it to a possibly prefixed Component

e.g.: gbsbuild *_test:*.c
Will generate all *.c files in all Components suffixed with '_test'
e.g.: gbsbuild *_test:*.c,*.cpp main: *.glk *.glb
Will generate all *.c and *.cpp files in all Components suffixed with '_test' then all *.glk in 'main' and then all *.glb in 'main'.
e.g.: gbsbuild *:*.*
Will generate all files in all Components (within the SubSystem), in the proper order.
For this particular purpose however you should use gbssysbuild SubSystem.

gbsbuild, gbsaudit

options1 if present, will be passed to all file-generations

options2 if present, will be passed to all file-generations preceding the options2

gbsmake

options1 if present, will be passed to 'make'

options2 cannot be present in gbsmake. Use the GBS_FLAGS_type to specify options with gbsmake.

Typical use of GBSBUILD:

        gbsbuild my_file.c -DTEST comp1.c  comp2:test.c -DTEST2
    

This results in:

  1. Compile my_file.c in the current Component with options -DTEST
  2. Compile comp1.c in the current Component
  3. Compile test.c in Component comp2 with options -DTEST2

Specifying FLAGS (-D) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

There are predefined FLAGS for Debug-Mode, Debugger, Optimizer and Map-files
- Do not specify -G but DEBUGGER=YES
- Do not specify -DDEBUG but MODE=DEBUG
More information here.

Full list:

  • MODE = FINAL | ASSERT | DEBUG
  • DEBUGGER = NO | YES
  • OPT = YES | SPEED | SIZE | DEBUG | NO
  • MAP = YES | NO

Flags will be placed behind the generation scripts own flags in the following order

  1. (generation-scripts own flags)
  2. Flags in $GBS_BUILD_PATH/flags_type.gbs
  3. Flags in $GBS_BUILD_PATH/$GBS_BUILD/flags_type.gbs
  4. Flags in $GBS_COMPONENT_OPT_PATH/flags_type.gbs
  5. Flags in $GBS_COMPONENT_OPT_PATH/$GBS_BUILD/flags_type.gbs
  6. Flags in Env. variable GBS_FLAGS_TYPE (either pre-set or on command-line)
  7. Flags in GBS Command-line

Specifying Derived Filetypes (.o) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For 'make', GLKBT, gbsexport and script files a platform/tool independent notation is used.
For each src-type (e.g.: .c) an EnvVar is defined containing the derived filetype (e.g: .o).
The syntax is GBS_BLD_src-type
They are set by the gbsswb command.

Examples:
    file1$GBS_BLD_C → file1.o or file1.obj
    file2$GBS_BLD_ASM → file2.o or file2.obj
    file3$GBS_BLD_GLB → file3.a or file3.lib

Specifying Search Paths (for -I and -L) Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

Include Paths are passed to the generation scripts in the following order

  1. ../loc
  2. ../inc
  3. ../bld/$GBS_BUILD (Only for glkbt builds)
  4. as specified in $GBS_COMPONENT_PATH/scope.gbs:
    Component/inc or
    Component/inc and Component/bld/$GBS_BUILD
  5. as specified in $GBS_COMPONENT_OPT_PATH/$GBS_BUILD/incs_type.gbs
  6. as specified in $GBS_COMPONENT_OPT_PATH/incs_type.gbs
  7. as specified in $GBS_BUILD_PATH/incs_TYPE.gbs
  8. as specified in $GBS_BUILD_PATH/$GBS_BUILD/incs_TYPE.gbs
  9. as specified in $GBS_SYSBUILD_PATH/incs_TYPE.gbs
  10. as specified in $GBS_SYSBUILD_PATH/$GBS_BUILD/incs_TYPE.gbs
  11. as specified in the generation-script

Note that the contents of the incs_TYPE.gbs files must refer to directories outside the current (Sub)System.

Do not prefix directories (with -I or -L)


generating_code.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Generating Libraries & Executables and Testing Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

Archiving Object-files to Libraries Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

The glb extensions are used to build libraries from object files.
For each library to be built there must be a glb-file in the source-directory, specifying the files to be included in the library.
The name of the library will be equal to the prefix of the glb-file, suffixed with the proper extension.
    (e.q.: total.glbtotal.lib)
'glb' Stands for GBS librarian

Specifying a file to be of the glb type tells GBS that the output files will be eligible for the -L statement while linking.
Description of the glb files can be found here.

Linking Object-files and Libraries to Executables Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The .glk extensions are used to build executables from object files and libraries.
For each executable to be built there must be a glk-file in the source-directory, specifying the files/libraries of the link.
The name of the executable will be equal to the prefix of the glk-file, suffixed with the proper extension.
    (e.q.: total.glktotal.exe)
'glk' Stands for GBS linker

Specifying a file to be of the glk type tells GBS that -L statement will cause searching for libraries as generated by glb.
Description of the glk files can be found here.

Testing Executables Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The .glt extensions are used to test executables.
For each executable to be tested there must be a glt-file in the source-directory, specifying the executable and its parameters.
The output of the test (the log) will go to the build-directory. The name of the logfile will be equal to the prefix of the glt-file, suffixed with .log.
    (e.q.: total.glttotal.log)
'glt' Stands for GBS link test

Specifying a file to be of the GLT type tells GBS that there may be special GLT directives in the GLT file.
GLT directives must be specified at the top of the file, prefixed with '^',
followed by the executable-spec on a single line,
followed by the parameters, each on a single line.

GLT directives

At this moment there is only 1 GLT directive:
  • ^timeout=seconds
    The default is 60 seconds.
    Note that at timeout the program being tested will be killed and output buffers will not be flushed.
    It is the programmer's responsibility to set something like autoflush for STDOUT and STDERR in the test program.
Note:
  • In addition to the build-line selection, Build exclusion can also be achieved via the .builds keyword in the glt file

Description of the glt files can be found here.

glk.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Exporting Deliverables Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

The gbsexport command Bottom Doc. Button Top Document Button Blank Blank Blank Blank

The gbsexport command is used to copy files from Components and/or Gen or SubSystem to the export-directories:

  • The export-directory
    Here the final product(s) will be placed.
  • The res/SubSystem-directory
    Here the items needed by other SubSystems will be placed.
gbsexport will process the export.gbs files in the Component directories do determine what must be exported (copied to the export and/or res/subsys directory).

The presence of an export directory determines copy to export.
The presence of a res/SubSystem directory determines the copy to res.
Components not containing a bld/$GBS_BUILD directory will be skipped.
During copy the file dates are preserved.

The creation of (msi) install programs is also supported in this command
The syntax of the command can be found here.
The description of the export.gbs file can be found here.

gbsexport.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Auditing (e.g. QAC, PCLint, C++Test) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Predefined Audits

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

gbsaudit Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The gbsaudit command will run an audit for one or more files in a Component.
It will generate a concatenated Audit output file optionally followed by a Summary.
The Summary is also generated in a separate file.
Upon completion the output file(s) are presented to the caller in a separate window.

The syntax of the gbsaudit command can be found here.

Notes:

An Audit will only run for SubSystems that

  1. Are Full-GBS and
    Contain an Audit specific directory in the GBS_AUDIT_PATH directory.
  2. Are Non-GBS and
    Contain an audit script in the GBS_SUBSYS_PATH directory

Predefined audits can be installed with the gbsmaint command.

gbssysaudit Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Executes the audit on all files in one or more or all SubSystems in a System (provided the SubSystem is enabled for the audit)

The syntax of the gbssysaudit command can be found here.

Predefined Audits Bottom Doc. Button Top Document Button Down Section Button Up Section Button

QAC Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Audit name:

qac

Required:

GBSEXT_QAC_PATH The main directory for QAC
GBSEXT_QAC_REL The selected QAC release

Include-file handling

Same way as for C-compilation
Note: #include "../../../file.h" notations are not handled correctly as they are not ANSI-C compliant.

Handling of compile time options

Same way as for C compilations

General Notes:

  • To obtain a list of qac-options enter: man qac
  • Do not qac same-name-file.c and same-name-file.h in one run: the database between qac1 and qac2 gets confused.
    Header-files are already checked when included in a source-file, so there is no need to audit them separately.

QAC++ Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Audit name:

qacpp

Required:

GBSEXT_QACPP_PATH The main directory for QAC++
GBSEXT_QACPP_REL The selected QAC++ release

Include-file handling

Same way as for C++-compilation
Note: #include "../../../file.h" notations are not handled correctly as they are not ANSI-C++ compliant.

Handling of compile time options

Same way as for C++ compilations

General Notes:

  • To obtain a list of qac++-options enter: man qac++
  • Do not qac++ same-name-file.cpp and same-name-file.h in one run: the database between qac++1 and qac++2 gets confused.
    Header-files are already checked when included in a source-file, so there is no need to audit them separately.

PCLint Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Audit name:

pclint

Required:

GBSEXT_PCLINT_PATH The main directory for PCLint
GBSEXT_PCLINT_REL The selected PCLint release

Include-file handling

Same way as for C and C++-compilation
Note: #include "../../../file.h" notations are not handled correctly as they are not ANSI-C/ANSI-C++ compliant.

Handling of compile time options

Same way as for C and C++ compilations

General Notes:

  • Header-files are already checked when included in a source-file, so there is no need to audit them separately.

C++test Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Audit name:

cpptest

Required:

GBSEXT_CPPTEST_PATH The main directory for C++test
GBSEXT_CPPTEST_REL The selected C++test release

Include-file handling

Same way as for C and C++-compilation
Note: #include "../../../file.h" notations are not handled correctly as they are not ANSI-C/ANSI-C++ compliant.

Handling of compile time options

Same way as for C and C++ compilations

General Notes:

  • Header-files are not checked

auditing.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Customisations (Session) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

These customisations give (extra) control over the gbsaudit, gbsbuild and gbsmake commands (and to some extent: gbssystool).
The following EnvVars can be set: There are 4 levels of session-control:
  • Permanent
    Place the EnvVar in site.gbs(.sh|.bat)
    GBS_APP_anyname only.
  • System Place the EnvVar in switch.gbs(.sh|.bat)
    GBS_APP_anyname only.
  • Command-line Set the EnvVar on the Command-line
    E.g.: set GBS_FLAGS_C=-x
  • Command Add the EnvVar in the command
    You may leave out the leading 'GBS_'
    E.g.: gbsbuild *.c APP_TEST=yes
All settings override in the order above except GBS_FLAGS_type, which is added.

GBS_DEBUGGER Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Name:

GBS_DEBUGGER

Purpose:

To predefine the GBS_DEBUGGER (include debugging information) setting during a session

Possible Values:

YES NO

Define:

Linux
export GBS_DEBUGGER=value
Windows
SET GBS_DEBUGGER=value

GBS_MAP Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_MAP

Purpose:

To predefine the GBS_MAP (generate memory-map) setting during a session

Possible Values:

YES NO

Define:

Linux
export GBS_MAP=value
Windows
SET GBS_MAP=value

GBS_MODE Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_MODE

Purpose:

To predefine the GBS_MODE settings during a session

Possible Values:

FINAL ASSERT DEBUG PROFILING

Define:

Linux
export GBS_MODE=value
Windows
SET GBS_MODE=value

GBS_OPT Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_OPT

Purpose:

To predefine the GBS_OPT (optimisation) settings during a session

Possible Values:

YES SPEED SIZE DEBUG NO

Define:

Linux
export GBS_OPT=value
Windows
SET GBS_OPT=value

GBS_FLAGS_type Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_FLAGS_type

Purpose:

To predefine flags (-options) for a specific type (E.g.: .c or .glk).
Specify the type without the '.' (dot)

Possible Values:

Depend on builder / audit

Define:

Linux
export GBS_FLAGS_type_without_dot=values
Windows
SET GBS_FLAGS_type_without_dot=values

GBS_APP_anyname Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_APP_anyname

Purpose:

To define an EnvVar that is used by a specific Application (audit, build or tool) to change its behaviour, not defined by FLAGs.

Possible Values:

Anything valid in the SHELL and of interest of the called Application, except GBS_APP_PATH.
GBS_APP_PATH is used for the 'app' directory in non-GBS SubSystems

Define:

Linux
export GBS_APP_anyname=value
Windows
SET GBS_APP_anyname=value

custom_session.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Customisations (User) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

GBS has a few user customisation possibilities.
Most are set by the gbssettings command
Index

Perl Directory (GBS_PERL_PATH) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Name:

GBS_PERL_PATH

Purpose:

Define an specific directory to find the Perl executable
To be used when (the wanted) perl is not in the PATH
Specifies the top-directory of the Perl installation (the directory containing 'bin')

Default:

Empty (Find Perl via PATH)

Where:

In Registry (Windows) My Computer → Properties → Advanced → Environment Variables
or ~/.profile or ~/.bash_profile

Define:

Linux
export GBS_PERL_PATH=your_perl_path
Windows
SET GBS_PERL_PATH=your_perl_path

gbssettings command Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

With the gbssettings command you can set/change:
  1. Change Profile Settings
  2. Change Config Settings
  3. Fix Startup Settings (Shortcuts, startup-scripts, etc)
  4. Move GBS_BASE_PATH

Site-ID

GBS_SITE

Purpose:

To identify the location where the user works
It is used in the switch.gbs to cater for different IT infrastructures (e.g. different locations of compilers, network drives, etc)
You will only really need it if people work from different site-locations on the same code.
A good name is an abbreviation of the town or site. Just make sure it is unique for the future.
Keep the name short and in uppercase. Consider using the 3-letter IATA Airport Code of a nearby airport.

Default:

MAIN

LogRoot

GBS_LOG_ROOT

Purpose:

To define the location of the logfile-directories per System
GBS_LOG_PATH=$GBS_LOG_ROOT/$GBS_SYSTEM_PARENT

Defaults:

Linux
~/Documents/GBSLogs
Windows
%MyDocuments%\GBSLogs

Home

GBS_HOME_PATH

Purpose:

Set the CWD when no current System and Default Root for GBS user directories

Default:

Linux
~/Documents
Windows
%MyDocuments%

Beeps

GBS_BEEBS

Purpose:

To switch the 'beep' on the command-line on or off

Default:

YES

Company

Generic

Purpose:

To identify your Company and/or Project
It is shown in the login-banner, logfile-banner and in the top of generated HTML-files like gbssilo.
You can put any text, even your own name here.

Default:

My Company

Ignores

Generic

Purpose:

TBS

Default:

None

Notify

Per Platform

Purpose:

To provide a different default for the --n (notify) option in the gbssys* functions

Default:

YES

Editor

Per Platform

Purpose:

Define a text-editor (for gbsedit and gbsmaint 9 ('Owners-file' Maintenance)

Defaults:

Linux
$EDITOR, gedit, nano, vim
Windows
Notepad

Browser

Per Platform

Purpose:

Define a HTML Browser (for gbshelp and gbsaudit)

Defaults:

Linux
Firefox, links2, links
Windows
Default HTML Browser (Internet Explorer)

Per Platform

Purpose:

Define a program to navigate directory structure
Used by gbsgui

Defaults:

Linux
Default Navigator (GNOME Files)
Windows
Windows Explorer

Viewer

Per Platform

Purpose:

Define a text-viewer (for viewing batch log-files)

Defaults:

Linux
less
Windows
Notepad

Terminal

TERMINAL

Purpose:

Define Terminal settings for when a new Terminal window is opened
You can set:
  • Terminal type:
    • Windows: cmd_console (CMD), Windows Console (WT)
    • WSL: wsl_console, xterm, gnome_terminal, konsole, uterm
    • Linux: xterm, gnome_terminal, konsole, uterm
  • Foreground colour (not all terminals)
  • Background colour (not all terminals)
  • Number of columns (not all terminals)
  • Number of rows (not all terminals)

Default:

Linux
gnome_terminal/konsole/xterm white black 120 45
Windows
cmd_console white black 120 45
WSL
wsl_console/gnome_terminal/konsole/xterm white black 120 45

Administrator

ADMINISTRATOR

Purpose:

Define/Remove the current user as Administrator for this System
Administrator privilege is required for all changes to the infrastructure. E.g.: create a new component.
It is just a token privilege. You will be warned every time you try to do a privileged action. You can always override.
This is a safety issue, warning you that you are changing something special for which you probably need permission of the System / Code Architect.

Default:

None

Integrator

INTEGRATOR

Purpose:

Define/Remove the current user as Integrator for this System
Integrator privilege is required for the execution of some special functions ad defined in gbsmaint 6:
  • Consolidate Audit results
  • Set GBS Version Limits
It is just a token privilege. You will be warned every time you try to do a privileged action. You can always override.
This is a safety issue, warning you that you are doing something irreversible.

Default:

None

GBS Command Prompt Window (gbscmd.bat / .sh) Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

You can customize your GBS Command Prompt DOS-box/xterm by placing shell commands in a private startup file: 'gbscmd.bat / .sh' in your GBS_BASE_PATH directory:
Please note the following:
  1. It is only executed in Interactive sessions.
  2. Do not place any GBS-related items in this file.
  3. Placing any GBS-related items in this file may cause GBS to malfunction.
    If not today: probably in the future.

custom_user.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Customisations (Admin) Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

These Customisation must only be set by the GBS Administrator!
Index

User File Templates (GBS_TEMPLATES_PATH) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Templates

When gbsedit creates a file, a template-file (template) is used.
Standard templates are defined in GBS for GBS-internal files (*.gbs & gbs script files).

There are also templates for most common User files (.c, .glk, etc).
As you can use gbsedit also outside GBS (outside the GBS Work Area) these come in two tastes:
  • gbs.* for files inside GBS (May contain Subsystem and/or Component name)
  • any.* for files outside GBS
You can define your own templates in GBS_SYS_PATH/templates. And/or somewhere central defined by GBS_TEMPLATES_PATH.
Template-files are named gbs.file_type or gbs_name.file_type or any.file_type or any_name.file_type.
E.g.: any.c, gbs.glk, any_myname.c
Search-order is:
  • GBS_SYS_PATH/templates (User Templates)
  • GBS_TEMPLATES_PATH (Shared Templates)
  • Internal GBS directory (GBS Templates)
You can also create such a file in the Shared Templates directory (GBS_TEMPLATES_PATH).
See below for the customisable items in a template-file.

gbsmaint 7 2 provides functions to:
  • Create a User Template
  • Copy Templates to the User Template directory
  • Edit a User Template

Comments in files

Associated to a file-type are comment-characters:
  • Begin Comment
    E.g: // or /*
  • End Comment (often empty) E.g: */
  • Comment start position (only used for old languages as COBOL and Fortran)
GBS maintains an extensive list of comment-characters per file-type.
Whenever you add a file with gbsedit, and the file-type is not known, you will be prompted for the comment-characters.
They are saved in a file called 'comment_chars.gbs' in the User Templates directory.

Not happy?

Suggestions? Your favourite missing? Let me know!

Name:

GBS_TEMPLATES_PATH

Purpose:

To define a directory containing external project file-templates

Default:

None

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_TEMPLATES_PATH=your_template_path
Windows
SET GBS_TEMPLATES_PATH=your_template_path

Semantics:

Template-files are named any.file_type or any_name.file_type. E.g.: any.c, any.glk, any_myname.c
Search-order is GBS_SYS_PATH/templates (User), GBS_TEMPLATES_PATH (Share), Internal_GBS_directory (GBS).

The following tokens used within the Template will be replaced during file-creation by GBS:
    %SYSTEM_NAME% → System
    %SUBSYS% → SubSys
    %COMPONENT% → Component
    %FILE% → File_nameFile_type
    %FILE_NAME% → File_name
    %FILE_TYPE% → File_type
    %UC_FILE% → uc File_nameFile_type
    %UC_FILE_NAME% → uc File_name
    %UC_FILE_TYPE% → uc File_type
    %INCLUDE_GUARD% → uc File_nameFile_type with '.' replaced by '_'

SCM binary home directory (GBSEXT_scm_PATH) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBSEXT_scm_PATH

Purpose:

To define the home directory of the specific SCM execution binary
This prevents being depended on the individual PATH settings

Default:

None

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBSEXT_scm_PATH=your_scm_home_path
Windows
SET GBSEXT_scm_PATH=your_scm_home_path

Semantics:

The following EnvVars will be recognised by GBS:
   Git GBSEXT_GIT_PATH
   Subversion GBSEXT_SVN_PATH

Make (GBS_MAKE) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_MAKE and/or
GBS_MAKE_gbs_build

Purpose:

Define a alternate make command and/or specify make-options for Non-GBS makefiles
Careful: Incorrect use can damage the build-system!

Default:

Linux
make
Windows
nmake

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_MAKE='Your make command'
Windows
SET GBS_MAKE=Your make command

Background Processing Invocation (GBS_SUBMIT) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_SUBMIT and/or
GBS_SUBMIT_gbs_build

Purpose:

Define a general script to be executed after submitting a job to the background batch and before the job is executed (for implementing things like LSF)
The batch-job will be executed within the context of this general script
Affected commands: gbssysbuild, gbssysmake, gbssysaudit.
Careful: Incorrect use can damage the build-system!

Default:

Linux
none
Windows
none

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_SUBMIT='command to be executed with $1'
The $1 will be replaced by the file-name of the scriptfile to be executed (Mandatory!)
Any $2 will be replaced by the jobname
Any $3 will be replaced by the logfile specification
Windows
SET GBS_SUBMIT=command to be executed with %1%
The %1% will be replaced by the file-name of the scriptfile to be executed (Mandatory!)
Any %2% will be replaced by the jobname
Any %3% will be replaced by the logfile specification

Foreground Processing Invocation (GBS_SUBWIN) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_SUBWIN and/or
GBS_SUBWIN_gbs_build

Purpose:

Define a general script to be executed after submitting a job for foreground executing in a separate window and before the job is executed (for implementing things like LSF)
The batch-job will be executed within the context of this general script
Affected commands: gbssysbuild, gbssysmake, gbssysaudit (with --fg)
Careful: Incorrect use can damage the build-system!

Default:

Linux
none
Windows
none

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_SUBWIN='command to be executed with $1'
The $1 will be replaced by the file-name of the scriptfile to be executed (Mandatory!)
Any $2 will be replaced by the jobname
Windows
SET GBS_SUBWIN=command to be executed with %1%
The %1% will be replaced by the file-name of the scriptfile to be executed (Mandatory!)
Any %2% will be replaced by the jobname

Batch Processing Invocation (GBS_BATCH) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_BATCH and/or
GBS_BATCH_gbs_build

Purpose:

Define a general script to be executed after submitting a batch job and before the job is executed (for implementing things like LSF)
The batch-job will be executed within the context of this general script
Affected commands: gbsbuild, gbsmake, gbsaudit
Careful: Incorrect use can damage the build-system!

Default:

Linux
none
Windows
none

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_BATCH='command to be executed with $1'
The $1 will be replaced by the file-name of the scriptfile to be executed (Mandatory!)
Windows
SET GBS_BATCH=command to be executed with %1%
The %1% will be replaced by the file-name of the scriptfile to be executed (Mandatory!)

Notify Submit, Start and End of gbssys...-job execution (GBS_BG_NOTIFIER) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Name:

GBS_BG_NOTIFIER and/or
GBS_BG_NOTIFIER_gbs-build

Purpose:

Define a command to be executed at submit, beginning and at termination of a gbssysbuild, gbssysmake or gbssysaudit job (Used by tools like SoftFab, Hudson, BuildForge and CruiseControl)

The command will be appended with the following information:
Submit:submitjobname datetime nr_jobs [ build action ]...
Begin: start jobname datetime pid build action logfile-spec
End: end jobname datetime pid build action logfile-spec completion-state completion-code
Where completion-state is one of NORMAL FAILED or KILLED
More TBS Expect future extensions
action is either gen make or audit_name (e.g. qac)

Note that for one submit all jobname and datetime will be the same

Where:

In the switch.gbs file or the site.gbs file.

Define:

Linux
export GBS_BG_NOTIFIER='command to be executed'
Windows
SET GBS_BG_NOTIFIER=command to be executed

Note:

As the GBS_BG_NOTIFIER will be executed from different processes, no assumption can be made on the order in which they are executed!

custom_admin.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Integration with other Tools Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

It is possible to integrate the execution of GBS commands in development tooling like editors, IDEs and buildmanagers.
The command that makes this possible is gbsstart_here.
It is a simplified version of the gbsstart command.

Typical commands are We suggest you keep this order.

The following chapters describe the integrations for:
Eclipse, Crimson Editor, Gedit, Notepad++, MS Visual Studio,

The gbsstart_here Command Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The purpose of the gbsstart_here command is to be able to execute a GBS command outside of a GBS context.
For this 2 things are needed:
  • The GBS context (The CWD)
  • The GBS command (with its parameters)
Most Development Environments and/or Editors allow you to specify multiple, named commands that will execute a command-file in which currencies can be set via special codes and/or entries:
  • Current directory
  • Current selected file or even: list of selected files
  • Directory where to execute the command
Because GBS is now invoked from outside a GBS context the gbsstart_here command must be invoked from the generic GBS startup directory GBS_BOOT_PATH.
Linux
~/.gbs/gbsstart_here.sh
Windows
%APPDATA%\.gbs\gbsstart_here.bat

The gbsstart Command Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

When gbsstart_here cannot be used (because you do not have a CWD), the more complex gbsstart command can be used.

The purpose of the gbsstart command is to be able to execute a GBS command outside of a GBS context.
For this 2 things are needed:
  • The GBS context (i.e.: GBS_SYSTEM_PATH and possibly SubSystem, Component and/or Build)
  • The GBS command (with its parameters)
The positional parameters of gbsstart allow you to specify the GBS context (System-spec, SubSys, Component and Build).
Specify '.' to take current (default)
Specify '-' to take none
The first parameter also allows for the special '!' and '!!' GBS_SYSTEM_PATH settings, giving the following possibilities:
  • abs_or_rel_path
    Means: Take abs_or_rel_path as GBS_SYSTEM_PATH (standard behaviour)
  • !
    Means: GBS_SYSTEM_PATH is in Current Working Directory. (search the tree)
  • !abs_or_rel_path
    Means: GBS_SYSTEM_PATH is in abs_or_rel_path. (search the tree)
  • !!
    Means: GBS_SYSTEM_PATH is Current Working Directory. (No need to search)

The --exec parameter specifies the command that is to be executed.
No spaces are allowed here so you must use the special space notation ($_, %_ or %20).

Because GBS is now invoked from outside a GBS context the gbsstart command must be invoked from the generic GBS startup directory GBS_BOOT_PATH.
Linux
~/.gbs/gbsstart.sh
Windows
%APPDATA%\.gbs\gbsstart.bat

Crimson Editor Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Location:

ToolsConf.User Tools...

Command definitions:

Tools On Windows GBS_BOOT_PATH points to %APPDATA%\.gbs
Be sure to mark: Capture output and Save before execute
gbsbuild
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbsbuild $(FileName)
Start in: $(FileDir)
gbsmake
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbsmake $(FileName) --r
Start in: $(FileDir)
gbsaudit
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbsaudit $(FileName)
Start in: $(FileDir)
gbssysbuild
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbssysbuild --i
Start in: $(FileDir)
gbssysmake
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbssysmake --i
Start in: $(FileDir)
gbssysaudit
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbssysaudit --i
Start in: $(FileDir)
swb build
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbsswb build
Start in: $(FileDir)
gbssilo
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbssilo
Start in: $(FileDir)
gbshelp
Command: $APPDATA\.gbs\gbsstart_here.bat
Argument: gbshelp
Start in: $(FileDir)

Notes

None

Eclipse Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Location:

Only System-wide commands can be defined here
WindowShow ViewMake Builds
Add Make Build

Command definitions:

In Add Make Build Window:
  • Build NameCommand Name
  • Make Buildgbsstart_parameters
  • Build Command → %APPDATA%\.gbs\gbsstart.bat or ~/.gbs/gbsstart.sh
gbsstart_parameters:
gbssysbuild
${workspace_loc:/projectname}\root_dirs - - --exec=gbssysbuild%20--i
gbssysmake
${workspace_loc:/projectname}\root_dirs - - --exec=gbssysmake%20--i
gbssysaudit
${workspace_loc:/projectname}\root_dirs - - --exec=gbssysaudit%20--i
swb build
${workspace_loc:/projectname}\root_dirs - - --exec=gbsswb%20build
doxygen
${workspace_loc:/projectname}\root_dirs - - --exec=gbssysbuild%20doxygen
gbssilo
${workspace_loc:/projectname}\root_dirs - - --exec=gbssysbuild%20gbssilo
gbshelp
- --exec=gbssysbuild%20gbshelp

Notes:

None

Gedit Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Enable:

EditPreferencesPlugins
Enable 'External Tools'

Location:

ToolsExternal Tools

Command definitions:

ToolsManage External Tools
The 'External Tools Manager' is started For a new command click on the 'New' icon, in the lower left corner, just above the 'Help'
gbsbuild
Command: ~/.gbs/gbsstart_here.sh gbsbuild $GEDIT_CURRENT_DOCUMENT_NAME
gbsmake
Command: ~/.gbs/gbsstart_here.sh gbsmake $GEDIT_CURRENT_DOCUMENT_NAME --r
gbsaudit
Command: ~/.gbs/gbsstart_here.sh gbsaudit $GEDIT_CURRENT_DOCUMENT_NAME
gbssysbuild
Command: ~/.gbs/gbsstart_here.sh gbssysbuild --i
gbssysmake
Command: ~/.gbs/gbsstart_here.sh gbssysmake --i
gbssysaudit
Command: ~/.gbs/gbsstart_here.sh gbssysaudit --i
swb build
Command: ~/.gbs/gbsstart_here.sh gbsswb build
gbssilo
Command: ~/.gbs/gbsstart_here.sh gbssilo
gbshelp
Command: ~/.gbs/gbsstart_here.sh - --exec=gbsshelp

Notepad++ Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Install

First you have to install the NppExec plugin
PluginsPlugin Admin...
Install NppExec

Command definitions:

PluginsNppExecExecute... or press F6
In the 'Command(s)' window add and Save... the following commands:
gbsbuild
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbsbuild $(FILE_NAME)
gbsmake
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbsmake $(FILE_NAME) --r
gbsaudit
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbsmake $(FILE_NAME)
gbssysbuild
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbssysbuild --i
gbssysmake
cd $(CURRENT_DIRECTORY)
~"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbssysbuild --i
gbssysaudit
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbssysaudit --i
gbssystool
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbssysaudit --i
swb build
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbsswb build
gbssilo
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" gbssilo
gbshelp
cd $(CURRENT_DIRECTORY)
"$(SYS.APPDATA)\.gbs\gbsstart_here.bat" - --exec=gbsshelp
Press F6 to call-up and execute the commands.
Press Ctrl+F6 to immediately execute the last selected command.

You can also place the commands in the Macro list with PluginsNppExecExecute...

Notes:

None

MS Visual Studio Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

As a Visual Studio project will be in a non-compliant GBS SubSystem, we cannot use the gbsbuild, gbsaudit and gbsmake commands.
If you are using Visual Studio only as an editor in a Full GBS SubSystem, you can use these commands.

Location:

Tools

Command definitions:

ToolsExternal Tools...
On Windows GBS_BOOT_PATH points to %APPDATA%\.gbs
Be sure to mark: Use Output window
gbsbuild
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbsbuild $(ItemFileName)$(ItemExt)
Initial directory: $(ItemDir)
gbsmake
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbsmake $(ItemFileName)$(ItemExt) --r
Initial directory: $(ItemDir)
gbssysbuild
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbssysbuild --i
Initial directory: $(ItemDir)
gbssysmake
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbssysmake --i
Initial directory: $(ItemDir)
swb build
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbsswb build
Initial directory: $(ItemDir)
gbssilo
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments: gbssilo
Initial directory: $(ItemDir)
gbshelp
Command: %APPDATA%\.gbs\gbsstart_here.bat
Arguments:- --exec=gbshelp
Initial directory:

Notes:

None

integration.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Plugins Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

Supported plugins.
GBS Administrator only!!
Index
Builds, Audits, Tools, Other

Build (gen) Plugins Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

Build Plugins are selected with gbsswb --new
And are updated with gbsmaint 7 1

Supported Build Plugins:

See also build.gbs

Audit Plugins Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Audit Plugins are selected and updated with gbsmaint 7 1

Supported Audit Plugins:

See also audit.gbs

Tool Plugins Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Tool Plugins are selected and updated with gbsmaint 7 1

Supported Tool Plugins:

See also tool.gbs


Doxygen

Purpose

Run Doxygen for all SubSystems

Run

In steps.gbs:
    
    STEP doxygen_api
        TOOL        = doxygen_api
        BUILD       = NO
        AUDIT	= NO
    
    STEP doxygen
        TOOL        = doxygen
        EXEC        = SPECIFY
        BUILD       = NO
        AUDIT	= NO
    
    

Requires

Doxygen via GBSEXT_DOXYGEN_PATH and GBSEXT_DOXYGEN_REL
and optionally Dot (Graphviz) via PATH

Notes

Use gbssilo to view results

Other Plugins Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

Supported Other Plugins:



Copy_Export

Purpose

Copy the contents of one or more GBS EXPORT directories to a directory outside the GBS WorkArea

Usage

Run in steps.gbs

Syntax

copy_export >copy_export/bin/copy_export.pl subsys_comma_list export_path to_path
subsys_comma_list
From SubSystem(s).
export_path
From-export: Relative path from EXPORT-path (may be .).
to_path
To-path: Absolute path to output-directory

Example

    STEP copy_export
        COMMAND    = >copy_export/bin/copy_export.pl superglo $GBS_BUILD $GBSEXT_GBSSHARE/$GBS_BUILD
        AUDIT      = NO
    

Requires

None

Notes

None

plugins.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Environment Variables (EnvVars) Bottom Doc. Button

Description Bottom Doc. Button Top Document Button Down Section Button Blank

GBS relies heavily on Environment Variables (EnvVars)
They are all controlled by GBS.
There is a lot of inter dependency between the GBS EnvVars and they must be set as a group.
Some EnvVars (most) are intrinsically set by GBS, others (a few) may be set by the User and that has to be done by using the proper GBS functionality that supports that.

Changing EnvVars by just setting them may lead to unexpected results and may cause GBS to crash or loose integrity
All GBS EnvVar are prefixed by either GBS_, GBSEXT_
  • GBS_... EnvVars are defined by GBS
  • GBSEXT_... EnvVars are defined in switch.gbs or site.gbs

Index

GBS_ EnvVars Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Blank

Note that the following table is sortable by the items in the top row.
Level EnvVar Name Possible Values Usage More
Info
Set by Changed
by
Remarks
0 Adm GBS_PERL_PATH directory path Define location of Perl More User User Optional. In:
Windows System Variables or
.profile
1 Pre GBS_BOOT_PATH directory path
%APPDATA%\.gbs or ~/.gbs
Define location of Boot .gbs   define GBS N/A Internal
1 Pre GBS_BASE_PATH directory path
%MyDocuments%/.gbs or ~/.gbs/base
Define location of User .gbs/base   define GBS N/A Internal
1 Pre GBS_PLATFORM MSWin32 or Linux Current platform More Define GBS Predefined Internal
1 Pre GBS_SHELL_FILETYPE .bat or .sh Commandfile-type for current platform   Define GBS N/A Internal
1 Pre GBS_PERL_CMD command Full Perl command   Define GBS N/A Internal
1 Pre GBS_WSL_DISTRO Empty, none or distro Current Distro if in WSL   Define GBS N/A Internal
2 GBS GBS_RC Number Scripts return status   various scripts  
2 GBS GBS_SITE Short name in uppercase Name of your Site More gbsinit gbssettings  
2 GBS GBS_LOG_ROOT directory path Log Files Root Location More gbsinit gbssettings Contains GBS_LOG_PATHs per GBS_SYSTEM_PARENT
2 GBS GBS_LOG_PATH directory path Log Files Location More gbsinit switch.gbs Set to $GBS_LOG_ROOT/$GBS_SYSTEM_PARENT
2 GBS GBS_HOME_PATH directory path
MyDocuments or ~/Documents
CWD when no System is current and default Root for GBS user directories More gbsinit gbssettings  
2 GBS GBS_TEMPLATES_PATH directory path External Templates path (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_MAKE command_spec Alternative 'make' for Non-GBS Makefiles (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_SUBMIT command_spec Alternative Submit (Background) (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_SUBWIN command_spec Alternative Submit (Foreground) (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_BATCH command_spec Alternative Batch command (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_BG_NOTIFIER command_spec Notifier for Submit completion (OPT) More gbsinit swr site.gbs
switch.gbs
2 GBS GBS_BUILD RVVYYMMDD Current Release/Build More gbsinit Predefined  
2 GBS GBS_EXEC_MODE DEFINED INTERACTIVE
FOREGROUND
BACKGROUND
Execution Mode   define gbsinit gbssys* Internal
2 GBS GBS_GUI Tkx None Available Perl GUI   gbsinit Predefined Internal
2 GBS GBS_PERL_CMD perl with or without path Direct Perl execution command   gbsinit Predefined  
2 GBS GBS_WPERL_CMD perl with or without path Command to start Perl GUI   gbsinit Predefined  
2 GBS GBS_PID number PID of toplevel process   gbsinit Predefined Internal
2 GBS GBS_SCRIPTS_ROOT directory path Where GBS versions are installed More gbsinit gbssettings Internal
2 GBS GBS_SCRIPTS_REL version version_build The current GBS version directory More gbsinit gbssettings Internal
2 GBS GBS_SCRIPTS_PATH Root/Rel The current GBS scripts location More gbsinit gbssettings  
2 GBS GBS_SHELL_FILETYPE .bat .sh The current shell filetype   gbsinit gbssettings  
2 GBS GBSDEBUG_VERBOSE 0 1 Verbose logging More gbsinit All Commands (Internally) Always 1 in BATCH jobs (gbssys*)
3 System GBS_SYSTEM_NAME name Name of the System More swr    
3 System GBS_SYSTEM_PATH directory path Current System path More swr    
3 System GBS_SYSTEM_PARENT directory name Parent dir of current System More swr    
3 System GBS_ALL_AUDITS names list All platform Audits   swr    
3 System GBS_AUDITS names list All Audits for this Platform   swr    
3 System GBS_AUDIT name Current Audit   swr gbsaudit  
3 System GBS_AUDIT_PLUGIN name Current Audit Plugin   swr gbsaudit  
3 System GBS_ALL_BUILDS names list All platform Builds   swr    
3 System GBS_BUILDS names list All Builds for this Platform   swr    
3 System GBS_BUILD name Current Build   swr swb  
3 System GBS_BUILD_PLUGIN name Current Build Plugin   swr swb  
3 System GBS_ALL_TOOLS names list All platform Tools   swr    
3 System GBS_TOOLS names list All Tools for this Platform   swr    
3 System GBS_TOOL name Current Tool   swr gbssystool  
3 System GBS_TOOL_PLUGIN name Current Tool Plugin   swr gbssystool  
3 System GBS_ALL_SUBSYSTEMS names list All SubSystems   swr sws --new  
3 System GBS_IS_ADMINISTRATOR 0 1 User is Administrator More swr gbssettings  
3 System GBS_IS_INTEGRATOR 0 1 User is Integrator More swr gbssettings  
3 System GBS_IGNORES regexp List Filetypes to be skipped   swr   Internal
3 System GBS_PLATFORMS Platform list Platforms this System generates for       Internal
3 System GBS_SCMS None Subversion Git ... Current SCMS More swr   Internal
3 System GBS_SCMS_DATA path Internal Path More swr   Internal
3 System GBS_SCMS_REPOSITORY file/directory path/URL SCMS Repository location More swr   Internal
3 System GBS_DEV_PATH directory path SystemPath/dev More swr    
3 System GBS_EXT_PATH directory path SystemPath/ext More swr    
3 System GBS_RES_PATH directory path SystemPath/res More swr    
3 System GBS_SILO_PATH directory path SystemPath/silo More swr   Internal
3 System GBS_SYS_PATH directory path SystemPath/sys More swr    
3 System GBS_SYSAUDIT_PATH directory path SystemPath/sysaudit More swr    
3 System GBS_SYSBUILD_PATH directory path SystemPath/sysbuild More swr    
3 System GBS_SYSTOOL_PATH directory path SystemPath/systool More swr    
3 System GBS_TMP_PATH directory path SystemPath/tmp More swr   Internal
3 System GBS_DEBUGGER YES NO Include Debugger (build) More swb User gbsbuild gbsmake Scripts
3 Systems GBS_MAP YES NO Produce a memory map (linking) More swb User gbsbuild gbsmake Scripts
3 System GBS_MODE FINAL ASSERT DEBUG PROFILING Build mode More swb User gbsbuild gbsmake Scripts
3 System GBS_OPT YES SPEED SIZE DEBUG NO Build Optimisation More swb User gbsbuild gbsmake Scripts
3 System GBS_BLD_src_type File type Derived Object filetype swb   Scripts
4 Sub GBS_SUBSYS name Current SubSys More sws    
4 Sub GBS_SSTYPE GBS make MSVS Other Current SubSystem Type More sws    
4 Sub GBS_SUBSYS_PATH directory path SystemPath/dev/SUBSYS More sws    
4 Sub GBS_AUDIT_PATH directory path SystemPath/dev/SUBSYS/audit More sws    
4 Sub GBS_BUILD_PATH directory path SystemPath/dev/SUBSYS/build More sws    
4 Sub GBS_TOOL_PATH directory path SystemPath/dev/SUBSYS/tool More sws    
4 Sub GBS_EXPORT_PATH directory path SystemPath/dev/SUBSYS/export (OPT) More sws    
4 Sub GBS_IMPORT_PATH directory path SystemPath/dev/SUBSYS/import (OPT) More sws    
4 Sub GBS_COMP_PATH directory path SystemPath/dev/SUBSYS/comp More sws   SSTYPE==GBS
4 Sub GBS_APP_PATH directory path SystemPath/dev/SUBSYS/app More sws   SSTYPE!=GBS
4 Cmp GBS_COMPONENT_PATH directory path SystemPath/dev/SUBSYS/comp/COMPONENT More swc   SSTYPE==GBS
5 Cmp GBS_COMPONENT name Current Component More swc   SSTYPE==GBS
5 Ses GBS_FLAGS_type flags Predefine flags (-D...) More User User Scripts
6 Exe GBS_IGNORE_ERRORS 0 1 --i was specified More gbssysbuild gbssysmake   Scripts
6 Exe GBS_FLAGS_type flags or flags_file ref Flags (-D...) More gbssys* gbsbuild gbsaudit   Scripts
6 Exe GBS_SYSFLAGS_type flags or flags_file ref System Flags (-D...) More gbssys* gbsbuild gbsaudit   Scripts
6 Exe GBS_INCS_type includes or includes_file ref Include Flags (-I...) More gbssys* gbsbuild gbsaudit   Scripts
6 Exe GBS_BUILD_type Command Command to execute Build More gbssysbuild   Scripts
SSTYPE== make or Other
6 Exe GBS_AUDIT_type Command Command to execute Audit More gbssysbuild   Scripts
SSTYPE== make or Other
6 Exe GBS_MAKE_FLAGS -i or empty -i if GBS_IGNORE_ERRORS == 1 More gbssysbuild   Scripts
SSTYPE==make
6 Exe GBS_MSBUILD_CONFIG Debug Release or empty Depends on GBS_MODE More gbssysbuild   Scripts
SSTYPE==MSVS

GBSEXT_ EnvVars For SCMS Bottom Doc. Button Top Document Button Down Section Button Blank Down Chapter Button Up Chapter Button

The value must be either the directory where the SCMS is installed or PATH if the SCMS command(s) are in the PATH.

Note that the following table is sortable by the items in the top row.
EnvVar Name Required for
GBSEXT_GIT_PATH Git
GBSEXT_SVN_PATH Subversion

GBSEXT_ EnvVars For Plugins Bottom Doc. Button Top Document Button Blank Blank Blank Up Chapter Button

GBSEXT_... EnvVars define the location of external stuff (Plugins and External Data).
Usually 3 EnvVars are defined (Hard versioned directories):
  • GBSEXT_name_ROOT: Site dependent location
  • GBSEXT_name_REL: Release/version
  • GBSEXT_name_PATH: GBSEXT_name_ROOT/GBSEXT_name_REL
Just before executing the plugin the following GBSEXT_ EnvVar will be defined:
  • GBSEXT_name_BIN_PATH: GBSEXT_name_PATH/optional_bin_dir

Note that the following table is sortable by the items in the top row.
Type Plugin EnvVar Required Platform Remarks
Builder MinGW C GBSEXT_MINGW_GCC REL and PATH Win32  
Builder MinGW C/C++ GBSEXT_MINGW_CPP REL and PATH Win32  
Builder Microsoft Visual Studio 2012 - Simple Console C/C++ GBSEXT_MSVS2012_CONS REL and PATH Win32  
Builder Green Hills - BlackFin C/C++ GBSEXT_GHSBF REL and PATH Win32  
Builder GNU C GBSEXT_LGNU_GCC REL and PATH Linux  
Builder GNU C/C++ GBSEXT_LGNU_CPP REL and PATH Linux  
Audit PC-Lint C/C++ GBSEXT_PCLINT REL and PATH Win32  
Audit QAC GBSEXT_QAC REL and PATH Both  
Audit QAC++ GBSEXT_QACPP REL and PATH Both  
Tool Doxygen GBSEXT_DOXYGEN REL and PATH Both  

envvars.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The glk/glb/glt files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a glb file
Example of a glk file
Example of a glt file

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

The glkbt files (.glb, .glk, .glt and others) are located in the src, loc and/or inc directories and are used to specify the behaviour of builders that traditionally do not have 'source'-files, like Linkers and Archivers.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

General considerations:
  • Trailing white-space is ignored.
  • Empty lines are ignored
  • Lines starting with '#' are considered comments and are ignored.
  • The syntax is line-oriented.
  • Leading white-space is significant.
  • The .builds directive can be used to skip execution and generate a dummy-file

Syntax Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

[ special_char ] content [ build_line_selector ]
special_char := . | $ | % | - | / | ^ | + | =

Lines can be appended with a Build Selector enabling skipping of the line dependent on the current Build.
Refer to GBS-files: General for explanation of the build_line_selector mechanism. The first (special-)character on a line specifies it's function:

Lines starting with '.':
Directives for the glkbt pre-processor:
.include file | "file" | 'file' | <file>
Lines starting with '$' or '%'
Specify absolute files-specs via Environment Variables
Passed as-is
Lines starting with '-' or '/' (Windows only)
Specify options for the post-processor (builder)
Passed as-is
Words with a dot will be passed to gbsmakemake for dependencies
Lines starting with '^'
Are passed as-is without the leading '^'
No further actions
Lines starting with '+'
Specify libraries or files to be found via the incs_type.gbs search path
Passed without the '+'
Lines with a dot will be passed to gbsmakemake for dependencies
Lines starting with '='
Specify config-type files found via the .include search path
Passed without the '='
Words with a dot will be prefixed with the found relative path and will be passed to gbsmakemake for dependencies
Other lines:
Specify files from the Component-build-build directories:
Same Component: file-comma-list
Other Component: Component:file-comma-list

Any line can be appended with a Build selector enabling skipping of the line dependent on the current Build. Refer to GBS-files: General for explanation of the build-line-selection mechanism.

Semantics: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Include:
No path specification allowed
Files will be searched in inc and loc directories
File extensions:
During processing all the GBS_BLD_src_type environment variables for the current Build are set.
You should create generic glk/glb/glt files suitable for various Builds by using these variables instead of the fixed text.
i.e.:
file1$GBS_BLD_C → file1.o or file1.obj
file2$GBS_BLD_ASM → file2.o or file2.obj
file3$GBS_BLD_GLB → file3.a or file3.lib

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a glb file: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

    #======================================
    #   Src-File:   software.glb
    #   Component:  software
    #   SubSys:     product_s
    #======================================
    main$GBS_BLD_C
    
    #======================================
    #   Other Components
    #======================================
    otv_arm:arm1$GBS_BLD_C
    otv_arm:arm2$GBS_BLD_C
    
    
    ###EOF###
    
    

Example of a glk file: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

    #======================================
    #   Src-File:   total_cze.glk
    #   Component:  software
    #   SubSys:     product_s
    #======================================
    main$GBS_BLD_C
    main_country_cze$GBS_BLD_C
    rom_cze_gnu$GBS_BLD_C            = gnu
    rom_cze_arm$GBS_BLD_C            = arm
    
    software.lib
    
    #======================================
    #   Other Components
    #======================================
    obs:occ$GBS_BLD_C
    obs:saoc$GBS_BLD_GLK
    
    #======================================
    #   Externals
    #======================================
    .include total_libs.glk
    
    +rmgr_upc$GBS_BLD_GLB
    +country_czech$GBS_BLD_C
    +caxxconfiguration_cze$GBS_BLD_C
    +dvbst_stub$GBS_BLD_GLB
    
    ###EOF###
    

Example of a glt file: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================
    #   File:       hello.glt
    #   Component:  test
    #   SubSystem:  superglo
    #   System:     SuperGlo_OK
    #========================================
    .builds=mingw,mingwd
    ^timeout=3
    hello$GBS_BLD_GLK
    -par1
    +PAR2
    
    ##EOF##
    
    

glkb.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The .gbs files - General Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

General
Directives
Common Elements

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Usage Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

  • 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

End-Of-Line Comments Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

  1. Skip empty lines and lines starting with '#'
  2. Remove EOL-Comments if enabled
    Skip possibly resulting empty line
  3. Perform Build-Line-Selection and remove build-selection part
  4. Execute Directive / Line

Directives Bottom Doc. Button Top Document Button Down Section Button Up Section Button

    .plugin     .include     .eol_comment     .builds     .exit     .end

.plugin Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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

.eol_comment Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

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 Bottom Doc. Button Top Document Button Down Section Button Up Section Button

    COMMAND

COMMAND Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

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.

gbsfiles.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The audit.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Examples of audit.gbs files

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The audit.gbs files are located in the GBS_SYSAUDIT_PATH/audit directories and are used to associate file-extensions with audit-plugins (QAC, QAC++ etc) for a specific audit.
Also the particularities of the auditing plugins are defined.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • Lines with no leading white-space (called header-lines) define an item.
  • Following lines with leading white-space (called sub-lines) define the parameters for that item.
  • Reserved words (keywords) are case sensitive
  • The search path for the .include Directive is:
    - $GBS_SYSAUDIT_PATH/$GBS_AUDIT
    - $GBS_SYSAUDIT_PATH

Contents Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

SETUP definition
INIT definition
SRC definitions (multiple)
...
SUMMARY definition
MAINT definition

SETUP Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To define general stuff, valid for the whole definition set.

Syntax:

SETUP
NICE_NAME = nice_name
VIA_FORMAT = via_format

Semantics:

NICE_NAME
Specifies a more descriptive name of the Audit. It is used in messages.
nice_name
Free format (just do not make it too long)
VIA_FORMAT
Specifies format/syntax of file-inclusion on the command-line.
via_format
Specifies the printf format for command-line file-inclusion
It must contain a %s
It may contain a .file_type
If a .file_type is not specified .gbs will be used.
e.g.: -via %s for QAC,
%s.lnt for PC-Lint,
@%s for MVS or
%s (default)

INIT Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To perform general initialisation.
It is possible to define derived plugin dependent Environment Variables
Note that all references to the 'outside-world' must be specified in the switch.gbs.
On Windows it can be used to (re)define an EnvVar with spaces removed. (Converted to ShortPathName)

Syntax:

INIT
SET_W = envvar_name => envvar_value
...
SET_X = envvar_name => envvar_value
...
SET = envvar_name => envvar_value
...
SETPATH = path_envvar_name => envvar_value-list
...
PACKAGE = package_def
BIN_DIR = bin_dir
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

SET_W, SET_X & SET
Specifies an Environment Variable.
envvar_name
Uppercase please
envvar_value
If placed between quotes (") it will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
SET_W is executed for Windows only.
SET_X is executed for Linux only.
SET is executed for all platforms
and must be specified after SET_W and SET_X
SETPATH
Specifies a PATH Environment Variable.
path_envvar_name
Case dependent on OS
envvar_value-list
If placed between quotes (") items will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
Items will be properly joined (';' on Windows, ':' on Linux)
Must be specified after SET_W, SET_X & SET
PACKAGE
Specifies possibly different directory and/or filename in a Plugin.
It is used when multiple plugin share the same data, but need a different audit.gbs.
Example: qac and qacpp share the same Plugin directory.
package_def
directory::Perl-module-name
BIN_DIR
Specifies the directory in which the executables of the plugin reside, relative to GBSEXT_<plugin>_PATH.
It is used to assemble GBSEXT_<plugin>_BIN_PATH which must be used in the COMMAND sub-section.
bin_dir
One or more directories, separated by '/'
COMMAND
Command for general initialisation.
Note that any EnvVars set during execution of the command will be lost when the command terminates.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with No positional parameters:

SRC Definitions Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To associate a file-extensions with an audit program (like SCA) and provide the necessary information in order to be able to execute that audit program (executable or script).

Syntax:

SRC src_type-list
OUT_TYPES = out_type-list
INC_FORMAT = [ env_type ] printf-format
SYSINC_FORMAT = [ env_type ] printf-format
FLAG_FORMAT = [ env_type ] printf-format
SYSFLAG_FORMAT = [ env_type ] printf-format
MULTI_SRC = multi_src_type [ printf-format ]
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

OUT_TYPES
List of mandatory output-types
The first one is considered the primary output-type
The primary output-type must start with a '.' (dot)
Secondary output-type(s) must contain a '.' (dot).
Note that if output-types do not start with '.' you may get name-clashes in Build-directory.
Files of these type(s) will be deleted before builder starts.
INC_FORMAT
Specifies information on the presentation of include-options (-I)
env_type
LIST | FILE
Specifies how the include-options will presented on the command-line.
LIST: In Environment Variable GBS_INCS
FILE: In a temporary file specified via EnvVar GBS_INCS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for include-options
It must contain a %s
e.g: -I %s for QAC.
SYSINC_FORMAT
Specifies information on the presentation of SYSTEM include-options (-I)
Items are taken from sysbuild/build/sysincs_src_type.gbs only.
env_type
LIST | FILE
Specifies how the include-options will presented on the command-line.
LIST: In Environment Variable GBS_SYSINCS
FILE: In a temporary file specified via EnvVar GBS_SYSINCS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for include-options
It must contain a %s
e.g: -SI %s for QAC++.
FLAG_FORMAT
Specifies information on the presentation of flags (-D)
env_type
LIST | FILE
Specifies how the flags will presented on the command-line.
LIST: In Environment Variable GBS_FLAGS
FILE: In a temporary file specified via EnvVar GBS_FLAGS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for flags
It must contain a %s
e.g: -D %s for QAC++.
SYSFLAG_FORMAT
Specifies information on the presentation of SYSTEM flags (-D)
Items are taken from sysbuild/build/sysflags_src_type.gbs only.
env_type
LIST | FILE
Specifies how the flags will presented on the command-line.
LIST: In Environment Variable GBS_SYSFLAGS
FILE: In a temporary file specified via EnvVar GBS_SYSFLAGS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for flags
It must contain a %s
e.g: -SD %s for QAC++
MULTI_SRC
Specifies that an audit-plugin can process multiple sources in one call.
multi_src_type
NO | YES | COMMA_LIST
Specifies how the source files will presented on the command-line.
NO: No multi-source. Single Source-specification
YES: Source-specifications will be specified separated by spaces
COMMA_LIST: Source-specifications will be specified separated by commas.
printf_format
Specifies the printf format for the source-specifications
Default is %s and may be omitted
It must contain a %s
e.g: -include **/%s for C++Test
COMMAND
Command to invoke the audit program.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with the following positional parameters:
  • $1 filename
    Without the file-type
    For MULTI_SRC this will be a constant: 'file_name'
  • $2 in_file_spec
    May be absolute depending on SRC_ABS_PATH
    For MULTI_SRC this will be multiple filespecs
  • $3 out_file_spec
    Relative path
    For MULTI_SRC this will be a constant: 'out_filespec'
  • $4 out_file_path
    Relative path
  • $5 out_file_type
    Including the dot.
  • $6-$n ($*) Command-line flags.
The following additional Environment Variables are set and may be used:
  • GBS_INCS
    Contains the include-statements specification as defined by INC_FORMAT
  • GBS_SYSINCS
    Contains the include-statements specification as defined by SYSINC_FORMAT
  • GBS_FLAGS
    Contains the flags specification as defined by FLAG_FORMAT Including:
    - Results of MODE, DEBUGGER, OPT and MAP
    - Values of flags_type.gbs files
    - Values in GBS_FLAGS_type
    Note that only the -D flags are included.
  • GBS_SYSFLAGS
    Contains the flags specification as defined by SYSFLAG_FORMAT
  • GBS_AUDIT_FLAGS
    Contains the content of EnvVar GBS_FLAGS_audit
  • GBS_APP_anyname...
    As specified in the GBS Customisation (Session) file

SUMMARY Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To provide information on how to run the summary program (executable or script)

Syntax:

SUMMARY
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

COMMAND
Command to invoke the audit summary program.
It is not used if the Audit is an SCA Audit.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with the following positional parameters:
  • $1 sum_file_spec
    Specifies the .html output filespec
The following additional Environment Variables are set and may be used:

MAINT Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To provide the interface of an audit-related program that can be executed from the gbsmaint command

Syntax:

MAINT
COMMAND = [ ok_exit_values-comma-list ; ] command-definition

Semantics:

COMMAND
Command to invoke the audit program.
Syntax and Semantics:
Refer to the COMMAND description
Only one COMMAND can be specified.
The command is called with the following positional parameters:
  • None
The following additional Environment Variables are set and may be used:
  • None

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Examples of audit.gbs files: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

File 1 (Basic reference) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

    #========================================================
    #   [qac] audit.gbs
    #========================================================
    .plugin qac
    .include <audit.gbs>
    
    ##EOF##
    

File 2 (Full specification) Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    #========================================================
    #   [qacpp] audit.gbs
    #========================================================
    
    SETUP
        NICE_NAME       = QAC++
        VIA_FORMAT	    = -via %s
    
    INIT
        SET_W   = QAC_EXEC => qacpp
        SET_X   = QAC_EXEC => qac++
        SET	    = QACPPHELPFILES => $GBSEXT_QACPP_PATH/help
        PACKAGE = qac::prqa
        BIN_DIR =
    
    SRC .cpp
        OUT_TYPES	    = .gout .met .err
        INC_FORMAT	    = -I %s
        SYSINC_FORMAT   = -SI %s
        FLAG_FORMAT	    = -D %s
        SYSFLAG_FORMAT  = FILE -SD %s
        COMMAND	    = 0,1 ; \
    		      $GBSEXT_QACPP_BIN_PATH/$QAC_EXEC $GBS_INCS $GBS_SYSINCS $GBS_AUDIT_FLAGS $GBS_SYSFLAGS $GBS_FLAGS \
    			  $2 $GBS_QACPP_FLAGS $* -outputpath $4 -n 1599
        COMMAND	    = exists $GBS_SYSTEM_PATH/sysaudit/$GBS_AUDIT/style_ALL.nrf; ; \
    		      $GBSEXT_QACPP_BIN_PATH/pal qacpp $2 $GBS_PAL_FLAGS -outputpath $4
        COMMAND	    = exists $GBS_SYSTEM_PATH/sysaudit/$GBS_AUDIT/user_checks$GBS_SHELL_FILETYPE ; ; \
    		      $GBS_SYSTEM_PATH/sysaudit/$GBS_AUDIT/user_checks$GBS_SHELL_FILETYPE qacpp $2 \
    			  $GBS_INCS $GBS_SYSINCS $GBS_AUDIT_FLAGS $GBS_SYSFLAGS $GBS_FLAGS $*
        COMMAND	    = 0,1-9,99; \
    		      $GBSEXT_QACPP_BIN_PATH/errdsp qacpp $2 $GBS_ERRDSP_FLAGS -outputpath $4 -file $2$5
    
    SUMMARY
        COMMAND = ECHO SCA
    
    MAINT
        COMMAND = >qac/bin/prqamaint.pl QACPP
    
    
    ##EOF##
    

audit.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The broadcast.gbs file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a broadcast.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Show a (GBS related) text when an interactive GBS session is started.

It is located in GBS_SCRIPTS_ROOT directory
Lines starting with '#' will be skipped.

To edit the file:
gbsedit broadcast.gbs or
gbssudo edit broadcast.gbs

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Useful with multi-user install of GBS

Example of a broadcast.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    
    #=================================================
    #   File: broadcast.gbs
    #   Path: D:/Work/Development/GBS/WA
    #=================================================
    #
    #   Place your broadcast here
    #   Lines starting with '#' will not be broadcast
    #
    #Release date set to2020-12-01
    
    Release date delayed till 2021-02-14
    
    #
    ###EOF###
    
    

broadcast.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The build.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Examples of build.gbs files

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The build.gbs files are located in the GBS_SYSBUILD_PATH/build directories and is used to associate file-extensions with builders (compilers, linkers, etc) for a specific build.
Also the particularities of the builders are defined.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • Lines with no leading white-space (called header-lines) define an item.
  • Following lines with leading white-space (called sub-lines) define the parameters for that item.
  • The search path for the .include Directive is:
    - $GBS_SYSBUILD_PATH/$GBS_BUILD
    - $GBS_SYSBUILD_PATH

Contents Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

SETUP definition
DEFAULTS definition
INIT definition
SRC definitions (multiple)
...

SETUP Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To define general stuff, valid for the whole definition set.

Syntax:

SETUP
NICE_NAME = nice_name
VIA_FORMAT = via_format

Semantics:

NICE_NAME
Specifies a more descriptive name of the Build. It is used in messages.
nice_name
Free format (just do not make it too long)
VIA_FORMAT
Specifies format/syntax of file-inclusion on the command-line.
via_format
Specifies the printf format for command-line file-inclusion
It must contain a %s
It may contain a .file_type
If a .file_type is not specified .gbs will be used.
e.g.: @%s for MVS or
%s (default)

DEFAULTS definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To set Build dependent defaults, overriding the GBS defaults

Syntax:

DEFAULTS
MODE = mode-definition
OPT = opt-definition
DEBUGGER = debugger-definition
MAP = map-definition

Semantics:

Refer to SRC semantics below.

INIT definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To perform general initialisation.
It is possible to define derived plugin dependent Environment Variables
Note that all references to the 'outside-world' must be specified in the switch.gbs.
On Windows it can be used to (re)define an EnvVar with spaces removed. (Converted to ShortPathName)

Syntax:

INIT
SET_W = envvar_name => envvar_value
...
SET_X = envvar_name => envvar_value
...
SET = envvar_name => envvar_value
...
SETPATH = path_envvar_name => envvar_value-list
...
BIN_DIR = bin_dir
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

SET_W, SET_X & SET
Specifies an Environment Variable.
envvar_name
Uppercase please
envvar_value
If placed between quotes (") it will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
SET_W is executed for Windows only.
SET_X is executed for Linux only.
SET is executed for all platforms
and must be specified after SET_W and SET_X
SETPATH
Specifies a PATH Environment Variable.
path_envvar_name
Case dependent on OS
envvar_value-list
If placed between quotes (") items will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
Items will be properly joined (';' on Windows, ':' on Linux)
Must be specified after SET_W, SET_X & SET
BIN_DIR
Specifies the directory in which the executables of the plugin reside, relative to GBSEXT_<plugin>_PATH.
It is used to assemble GBSEXT_<plugin>_BIN_PATH which must be used in the COMMAND sub-section.
bin_dir
One or more directories, separated by '/'
COMMAND
Command for general initialisation.
Note that any EnvVars set during execution of the command will be lost when the command terminates.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with No positional parameters:

SRC definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To associate a file-extensions with a builder and provide the necessary information in order to be able to execute the builder.

Syntax:

SRC src_type-list
TYPE = generic_type [ include_re [ comment_re | c ] ]
ORDER = order-number
SRC_ABS_PATH = 0 | 1
INC_TYPES = inc_type-list
OUT_TYPES = out_type-list
OPT_OUT_TYPES = out_type-list
OUT_FILES = out_name-list
GLKB = env_type [ lib_spec ]
INCLUDE_INC = 0 | 1
INCLUDE_BLD = 0 | 1
INC_FORMAT = [ env_type ] printf-format
SYSINC_FORMAT = [ env_type ] printf-format
INC_ABS_PATH = 0 | 1
INC_SEARCH_STYLE = UNIX | STANDARD
FLAG_FORMAT = [ env_type ] printf-format
SYSFLAG_FORMAT = [ env_type ] printf-format
MODE = mode-definition
OPT = opt-definition
DEBUGGER = debugger-definition
MAP = map-definition
MULTI_SRC = multi_src_type [ printf-format ]
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

SRC
Specifies the input-type.
May not be equal to '.glkb'
 
TYPE
Specifies the generic type of the builder.
Has consequences on how comments and includes are handled.
generic-type
gen | asm | c | glb | glk | glt
include_re
Regular expression specifying how include-statements are recognised
E.g.: For c the default is: ^\s*#include\s+[<"]\s*([^>"]+?)\s*[>"]
comment_re
Regular expression specifying how comments are recognised
E.g.: For asm the default is: ^\s*[;*/].*
Must be the first item in the list
ORDER
The Generation order
SRC_ABS_PATH
Some debuggers require an absolute src path to be able to find the source during debugging.
INC_TYPES
List of optional include-types
Used to determine the proper Template/Comment_char when creating a User-file with gbsedit
The SRC_TYPE is implicitly added to this list.
OUT_TYPES
List of mandatory output-types
The first one is considered the primary output-type
The primary output-type must start with a '.' (dot)
Secondary output-type(s) must contain a '.' (dot).
Note that if output-types do not start with '.' you may get name-clashes in Build-directory.
Files of these type(s) will be deleted before builder starts.
OPT_OUT_TYPES
Additional (optional) output-types.
Must contain a '.' (dot).
Note that if output-types do not start with '.' you may get name-clashes in Build-directory.
Files of these type(s) will be deleted before builder starts.
OUT_FILES
List of (mandatory) output-files
These files will be deleted before builder starts.
This is a very tricky option because you can have only one source file of this type per Component and GBS will not check on this...
GLKB
Specifies additional information on glb, glk and glt processing.
env_type
LIST | FILE
Specifies how the GLKB output will be presented.
LIST: In Environment Variable GBS_GLKB
FILE: In a temporary file specified via EnvVar GBS_GLKB. The syntax is specified by the VIA_FORMAT in the SETUP definition.
lib-spec
empty | UNIXLIB
Specifies Unix-type library specification i.e.:
-llibname searches for all liblibname.glb_out_types
INCLUDE_INC
Specifies that Component INC-directories must be included in the include-path search.
Default = 1 for non GLKB types
INCLUDE_BLD
Specifies that Component BLD-directories must be included in the include-path search.
INC_FORMAT
Specifies information on the presentation of include-options (-I)
env_type
LIST | FILE
Specifies how the include-options will presented on the command-line.
LIST: In Environment Variable GBS_INCS
FILE: In a temporary file specified via EnvVar GBS_INCS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for include-options
It must contain a %s
e.g: -I%s for the C compiler.
SYSINC_FORMAT
Specifies information on the presentation of SYSTEM include-options (-I)
Used in those cases where the compiler headerfiles must be specified explicitly.
Items are taken from sysbuild/build/sysincs_src_type.gbs only.
env_type
LIST | FILE
Specifies how the include-options will presented on the command-line.
LIST: In Environment Variable GBS_SYSINCS
FILE: In a temporary file specified via EnvVar GBS_SYSINCS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for include-options
It must contain a %s
e.g: -I%s for the C compiler.
INC_ABS_PATH
Specifies that the include-search-path must be an absolute address
INC_SEARCH_STYLE
Specifies the order in which the Include-Paths are searched:
UNIX
The order in which the paths are specified, unless it is a it is a quotes-type include:
then first look in the directory of the including file
STANDARD
The order in which the paths are specified
FLAG_FORMAT
Specifies information on the presentation of flags (-D)
env_type
LIST | FILE
Specifies how the flags will presented on the command-line.
LIST: In Environment Variable GBS_FLAGS
FILE: In a temporary file specified via EnvVar GBS_FLAGS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for flags
It must contain a %s
e.g: -D%s for the C compiler.
SYSFLAG_FORMAT
Specifies information on the presentation of SYSTEM flags (-D)
Used in those cases where the standard compiler flags must be specified explicitly.
Note that is normally not the case!
Items are taken from sysbuild/build/sysflags_src_type.gbs only.
env_type
LIST | FILE
Specifies how the flags will presented on the command-line.
LIST: In Environment Variable GBS_SYSFLAGS
FILE: In a temporary file specified via EnvVar GBS_SYSFLAGS. The syntax is specified by the VIA_FORMAT in the SETUP definition.
printf_format
Specifies the printf format for flags
It must contain a %s
e.g: -D%s for the C compiler.
MODE
Specifies the options for FINAL, ASSERT, DEBUG and PROFILING
Useful for types: c
mode-definition
mode-definition := mode_name... => option
mode_name := FINAL | ASSERT | DEBUG | PROFILING
E.g.: MODE = DEBUG => -DDEBUG
OPT
Specifies the optimization
Useful for types: c
opt-definition
opt-definition := optimize_name... => option
optimize_name := YES | SPEED | SIZE | DEBUG | NO
E.g: OPT = YES SPEED SIZE => -O9
DEBUGGER
Specifies if debugging information must be included
Useful for types: c glb and glk
debugger-definition
NO => option (default)
YES => option
MAP
Specifies if a memory-map must be created
Useful for types: glk
map-definition
YES => option (default)
NO => option
In the option: any %1 (MSWin) or $1 (Linux) will be replaced by the file-spec of the map-file.
MULTI_SRC
Specifies that a build-plugin can process multiple sources in one call.
Cannot be combined with GLKB types
multi_src_type
NO | YES | COMMA_LIST
Specifies how the source-files will presented on the command-line.
NO: No multi-source. Single Source-specification
YES: Source-specifications will be specified separated by spaces
COMMA_LIST: Source-specifications will be specified separated by commas.
printf_format
Specifies the printf format for the source-specifications
Default is %s and may be omitted
It must contain a %s
COMMAND
Command to invoke the builder.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with the following positional parameters
  • $1 filename
    Without the file-type
    For MULTI_SRC this will be a constant: 'file_name'
  • $2 in_file_spec
    May be absolute depending on SRC_ABS_PATH
    For MULTI_SRC this will be multiple filespecs
  • $3 out_file_spec
    Relative path
    For MULTI_SRC this will be a constant: 'out_filespec'
  • $4 out_file_path
    Relative path
  • $5 out_file_type
    Including the dot.
  • $6-$n ($*) Command-line flags.
The following additional Environment Variables are set and may be used:
  • GBS_INCS
    Contains the include-statements specification as defined by INC_FORMAT
  • GBS_SYSINCS
    Contains the include-statements specification as defined by SYSINC_FORMAT
  • GBS_FLAGS
    Contains the flags specification as defined by FLAG_FORMAT Including:
    - Results of MODE, DEBUGGER, OPT and MAP
    - Values of flags_type.gbs files
    - Values in GBS_FLAGS_type
  • GBS_SYSFLAGS
    Contains the flags specification as defined by SYSFLAG_FORMAT
  • GBS_GLKB
    For GLKB types
    Contains the GLKB lines
  • GBS_APP_anyname...
    As specified in the GBS Customisation (Session) file

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Examples of build.gbs files: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

File 1 (final build) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

    #========================================================
    #   [mingw] build.gbs
    #========================================================
    
    SETUP
        NICE_NAME	= MinGW_cpp
    
    INIT
        SET_W       = TEST => WIN32
        SET_X       = TEST => LINUX
        BIN_DIR	= bin
        SETPATH     = PATH => GBSEXT_MINGW_CPP_BIN_PATH% PATH
    
    SRC .c
        TYPE	= c
        ORDER	= 1
        INC_TYPES	= .h
        OUT_TYPES	= .o
        INCLUDE_BLD = 1
        INC_FORMAT	= -I%s
        INC_SEARCH_STYLE = UNIX
        FLAG_FORMAT = -D%s
        MODE    	= ASSERT    => -DASSERT
        MODE    	= DEBUG     => -DDEBUG
        MODE        = PROFILING => -DPROFILING
        DEBUGGER	= YES       => -g
        OPT     	= NO	    => -O0
        OPT     	= SIZE	    => -Os
        OPT     	= SPEED	YES => -O3
        COMMAND	= GBSEXT_MINGW_CPP_BIN_PATH%\gcc -c -Wall -ansi %GBS_INCS% %GBS_FLAGS% %* %2 -o %3
    
    SRC .cpp
        TYPE	= c
        ORDER	= 1
        INC_TYPES	= .hpp
        OUT_TYPES	= .o
        INCLUDE_BLD = 0
        INC_FORMAT	= -I%s
        INC_SEARCH_STYLE = UNIX
        FLAG_FORMAT = -D%s
        MODE    	= ASSERT    => -DASSERT
        MODE    	= DEBUG     => -DDEBUG
        MODE        = PROFILING => -DPROFILING
        DEBUGGER	= YES       => -g
        DEBUGGER    = NO        =>
        OPT     	= NO	    => -O0
        OPT     	= SIZE	    => -Os
        OPT     	= SPEED	YES => -O3
        COMMAND	= call GBSEXT_MINGW_CPP_BIN_PATH%\g++ -c -Wall %GBS_INCS% %GBS_FLAGS% %* %2 -o %3
    
    SRC .s
        TYPE	= asm ^\.include\s+(")(.*?)" ^\s*#.*
        ORDER	= 1
        INC_TYPES	= .inc
        OUT_TYPES	= .o
        INC_FORMAT	= -I%s
        FLAG_FORMAT = -D%s
        COMMAND	= call GBSEXT_MINGW_CPP_BIN_PATH%\as --warn --fatal-warnings %GBS_INCS% %GBS_FLAGS% %* %2 -o %3
    
    SRC .glb
        TYPE	= glb
        ORDER	= 2
        INC_TYPES	= .glb
        OUT_TYPES	= .a
        GLKB	= LIST
        COMMAND	= call GBSEXT_MINGW_CPP_BIN_PATH%\ar -rvs %* %3 %GBS_GLKB%
    
    SRC .glk
        TYPE	= glk
        ORDER	= 4
        INC_TYPES	= .glk
        OUT_TYPES	= .exe
        GLKB	= LIST UNIXLIB
        INC_FORMAT	= -L%s
        MAP     	= YES => -Wl,-Map -Wl,%1
    #    DEBUGGER	= NO  => "Wl,-s"
        COMMAND	= @mingw_glk.bat
    
    SRC .glt
        TYPE	= glt
        ORDER	= 5
        INC_TYPES	= .glt
        OUT_TYPES	= .log
        COMMAND	= >ALL/gbstest.pl
    
    ##EOF##
    
    

File 2 (debug build) Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    #========================================================
    #   [mingwd] build.gbs
    #========================================================
    .plugin mingw_gcc
    
    .include <build.gbs>
    
    DEFAULTS
        MODE     = DEBUG
        DEBUGGER = YES
        OPT      = DEBUG
    
    ##EOF##
    
    

build.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The export.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of an export.gbs
Example of an export.gbs using INSTALL

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The export.gbs files are used to fill the res/subsys and subsys/export directories.
They (the export.gbs files) can reside in 2 locations:
  • Full-GBS SubSystems:
    1. Component - From Component res and/or export
    2. SubSystem - From res to res and/or export and from ext to export
  • Non-GBS SubSystems:
    1. Subsystem - From SubSystem to res and/or export

The export.gbs files located in the GBS_COMPONENT_PATH directories are used to specify which files of the Component are to be exported to a relative directory in RES/$GBS_SUBSYS and/or EXPORT when using the gbsexport command.

The export.gbs files located in the GBS_SUBSYS_PATH directories are used to specify which files of the SubSystem, any RES and/or EXT are to be exported to a relative directory in RES/$SUBSYS and/or EXPORT when using the gbsexport command.

Files can be exported to $GBS_RES_PATH/$GBS_SUBSYS and/or to $GBS_EXPORT_PATH depending on the existence of these directories or selective by means if the to_base prefix.

Besides copying files it is also possible to create (msi) install programs.

By default:
Exported directories are created with mode: u=rwx,go=rx,o=x
Exported files are created with mode: ugo:r

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • Lines with no leading white-space define the destination (output_directory)
  • Following lines with leading white-space define the source (from_file)
  • Keywords are case sensitive
  • The .include directive is not allowed
The combination of 1 destination-line flowed by a number of source-lines is called a destination-set.

Contents: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax:

destination_line
source_line
...
destination_line := [to_base:]to_path['|'chmods] [build-line-selection]

source_line := copy_line | install_line

copy_line := [from_base:][from_path]from_file [to_file]['|'chmods]

install_line := INSTALL:command [args...] to_file['|'chmods]

Destination lines (to_path) can be appended with a Build Selector enabling skipping of the whole destination_set dependent on the current Build.
Refer to GBS-files: General for explanation of the build-line-selection mechanism.

Semantics:

to_base := EXPORT | RESSUB | ANY
Specifies explicit output location.
ANY: Default. Export to RESSUB and/or EXPORT depending on their existence
RESSUB: Base is GBS_RES_PATH/SUBSYS
EXPORT: Base is to GBS_EXPORT_PATH
to_path
Relative to to_base
../ or '*' not allowed

from_base := CMP | EXT | RES | SILO | SUB | GBSEXT_name_PATH | INSTALL
Specifies explicit input location.
CMP: Base is GBS_COMPONENT_PATH
CMP: is the default for Component export.gbs and should not be specified (custom)
CMP: may only be specified in a Component export.gbs
EXT: Base is GBS_EXT_PATH. Files MUST exist
RES: Base is GBS_RES_PATH
SILO: Base is GBS_SILO_PATH
SUB: Base is GBS_SUBSYS_PATH
SUB: is the default for Gen and Non-Full-GBS Subsystem export.gbs
SUB: Only specific directories can be selected (audit, export, build, comp, tool)
GBSEXT_name_PATH: Base is the directory defined by that Environment Variable
INSTALL: cannot be specified in a Component export.gbs
INSTALL: Base is the same location as the export.gbs file
from_path
Relative to from_base
../ or '*' not allowed
Default is from_base
from_file
../ or '*' not allowed
Use $GBS_BLD_src_type to specify Build specific generated file-types
to_file
Optional. Mandatory for INSTALL:
Specifies a (different) output name for the file.
A dot indicates the same as the input file name
chmods
chmod_comma-list
Use to change the default file/directory permissions
chmod := Unix_symbolic_mode_notation>
E.g.: u=rwx,go=r or 0755
For the chmod notation refer to Wikipedia chmod
command
Command that will invoke the (msi) install create program
Before execution the CWD will be set to the same locations as the export.gbs file
Best way to work is to use the copy_lines to create a directory/file structure and then use an install_line to create an installer using that directory/file structure
args
Argument(s) for command
Optional

General:
Paths containing non-current Build Build-names will be skipped for the current Build.

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

  • No wild-cards allowed (e.g.: *.h)
  • file/directory specifications containing spaces are supported:
    All occurrences of %_ (Linux), $_ (Win32) and %20 (all) are replaced by spaces.

Example of an export.gbs: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

    #===============================
    #  [otv_al_s:ocs] export.gbs
    #===============================
    RESSUB:inc/$GBS_BUILD				== mingw
        inc/http_init.h
        inc/lsm.h
        inc/oco.h
        inc/ocs.h
        inc/ocs_cfg.h
    RESSUB:lib/$GBS_BUILD				== mingw
        bld/$GBS_BUILD/ocs$GBS_BLD_GLB
        EXPORT:bin					== mingw
        bld/$GBS_BUILD/ocs$GBS_BLD_GLBK	|ugo:x
    
    ## EOF ##
    

Example of an export.gbs using INSTALL: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================================
    #   [profielsw] export.gbs
    #========================================================
    base
    base/bin
        app\Task24Profiel\bin\Release\Task24Profiel.exe
    base/bin/DUT
        data\bin\DUT\_NL%20Profiel%20Leesmij.txt
        data\bin\DUT\CV%20TemplateB.dotm
        data\bin\DUT\leegcv.ini
        data\bin\DUT\wizard.ini
    base/bin/ENG
        data\bin\ENG\_English%20Profile%20ReadMe.txt
        data\bin\ENG\CV%20TemplateB.dotm
        data\bin\ENG\leegcv.ini
        data\bin\ENG\wizard.ini
    base/Doc
        data\Doc\Help.html
        data\Doc\userguide.doc
    base/Doc/Images
        data\Doc\Images\Balkknop.jpg
        data\Doc\Images\CVWizardMain.jpg
        data\Doc\Images\image002.jpg
        data\Doc\Images\TASK24.ico
    install
        INSTALL:%GBSEXT_ADVANCED_INSTALLER_PATH%\AdvancedInstaller.com /build Task24Profiel.aip setup.msi
    ###EOF###
    

export.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The flags_*.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a flags_*.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The flags_type.gbs files are used to specify builder-specific flags.
The type specifies the associated source-file type (without the DOT)

The flags_type.gbs files may be placed in the following locations:

  • $GBS_SYSBUILD_PATH
  • $GBS_SYSBUILD_PATH/$build
  • $GBS_BUILD_PATH
  • $GBS_BUILD_PATH/$build
  • $GBS_COMPONONENT_PATH/opt
  • $GBS_COMPONONENT_PATH/opt/$build
And will be read in the specified order, overriding possible values of a higher level. Toplevel Directory

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • The .include directive is not allowed

Contents: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax:

One flag per line
A line containing spaces will be quoted unless the line also contains quotes (")
To prevent this, place elements on separate lines

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Flags may not be include-paths like -I and/or -L
These should be specified in the incs_*.gbs files.

Example of a flags_*.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================================
    #   [superglo::test]FLAGS_C.GBS
    #========================================================
    -DTESTFLAG=1
    
    
    ###EOF###
    

flags.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The subsys.gbs script files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a subsys.gbs.bat

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The subsys.gbs script file is used only for Non-GBS SubSystems, is located in the GBS_SUBSYS_PATH directory and is used for the building or auditing of these Subsystems.
It is used by gbssysbuild, gbssysmake, gbssysaudit and for Cleanup functions in gbsmaint.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Special considerations:
  • These files are operating-system dependent script files and have the appropriate file-extension for that particular operating-system. e.g.:
    • subsys.gbs.sh for Linux
    • subsys.gbs.bat for Windows

Calling Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The subsys.gbs file is called:
When you build or audit a SubSystem with one of the gbssys.. commands:
With one of the arguments cleanup_bld, gen, make, cleanup_aud or audit
When Cleanup a SubSystem with gbsmaint:
With one of the arguments cleanup_bld or cleanup_aud

Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Before execution a vast amount of EnvVars is set so you can make your proper selections.
Some EnvVars will be dependent on the SubSystem type.
Refer to example below.

Each GBS_BUILD_type EnvVar contains the Command to execute for that filetype for the current Build
It is taken from the build.gbs file and contains all settings until the first % or $ argument.
Same analogy for GBS_AUDIT_type

Layout Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

For every Non-GBS SubSystem type there is a slightly different subsys.gbs file.
The 'switch' on action (cleanup_bld, gen, make, cleanup_aud or audit) is the same for all, but the contents of the 'cases' will differ.
Refer to example below.

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a subsys.gbs.bat: Bottom Doc. Button Top Document Button Blank Up Section Button

    @ECHO OFF
    ::=============================================================================
    ::  [%SUBSYS%] subsys.gbs.bat
    ::	Requires 1 parameter: action
    ::	Called to cleanup, gen, make or audit a non-GBS SubSystem
    ::	For 'make' SubSystems
    ::=============================================================================
    ::
    ::  Currently in $GBS_SYSTEM_PATH/dev/$GBS_SUBSYS
    ::  Applicable EnvVars:
    ::	GBS_BUILD
    ::	GBS_BUILD_PLUGIN
    ::	GBS_BUILD_PLUGIN_PATH				('make' or 'Other')
    ::	GBS_BUILD_PLUGIN_BIN_PATH			('make' or 'Other')
    ::	GBS_BUILD_src_type			('make' or 'Other')
    ::	GBS_AUDIT_PLUGIN	    			(for Audit only)
    ::	GBS_AUDIT_PLUGIN_PATH	    		(for Audit only)    ('make' or 'Other')
    ::	GBS_AUDIT_PLUGIN_BIN_PATH   		(for Audit only)	('make' or 'Other')
    ::	GBS_AUDIT_src_type	    	(for Audit only)	('make' or 'Other')
    ::
    ::  Available EnvVars:
    ::      GBS_SYSTEM_PATH
    ::      GBS_SUBSYS
    ::      GBS_SUBSYS_PATH
    ::      GBS_AUDIT_PATH
    ::      GBS_BUILD_PATH
    ::      GBS_APP_PATH
    ::
    ::	GBS_MAKE		make_command
    ::      GBS_IGNORE_ERRORS       0 | 1
    ::      GBS_MODE                FINAL | ASSERT | DEBUG | PROFILING
    ::      GBS_OPT                 YES | SPEED | SIZE | DEBUG | NO
    ::      GBS_DEBUGGER            NO | YES
    ::      GBS_MAP                 NO | YES
    ::
    ::      GBS_BLD_src_type      primary_output_type>
    ::      GBS_SYSFLAGS_src_type
    ::      GBS_FLAGS_src_type    also contains flags resulting from MODE, OPT, DEBUGGER and MAP
    ::      GBS_SYSINCS_src_type
    ::      GBS_INCS_src_type
    ::
    ::      GBS_MAKE_FLAGS		'-i' if GBS_IGNORE_ERRORS == TRUE
    ::
    ::=============================================================================
    setlocal
    set rc=0
    
    set action=%1
    
    ::
    ::  Adjust for proper actions
    ::  Just one to a few lines per action. Keep it simple. Do not try to be clever.
    ::  Do not forget to set rc to proper exit value (0=success, >0=fail)
    ::
    
    if [%action%] == [cleanup_bld] goto CASE_CLEANUP_BLD
    if [%action%] == [gen]         goto CASE_GEN
    if [%action%] == [make]        goto CASE_MAKE
    if [%action%] == [cleanup_aud] goto CASE_CLEANUP_AUD
    if [%action%] == [audit]       goto CASE_AUDIT
    goto CASE_DEFAULT
    ::
    ::  CLEANUP_BLD
    ::
    :CASE_CLEANUP_BLD
        echo SUBSYS.GBS_: ** SubSys=%GBS_SUBSYS% - Build=%GBS_BUILD% - Action=%action%
        :: <== add your command(s) to execute the bld_cleanup here and remove these lines.
        ::     Do not forget to set rc to proper exit value (0=success, >0=fail)
        :: <== Probably something like:
        %GBS_MAKE% clean -f Makefile.mk -i
        set rc=%ERRORLEVEL%
        goto CASE_END
    :CASE_GEN
        ::
        ::	GEN
        ::
        echo SUBSYS.GBS_: ** SubSys=%GBS_SUBSYS% - Build=%GBS_BUILD% - Action=%action%
        :: <== add your command(s) to execute the gen here and remove these lines.
        ::	   Do not execute the 'clean' in this command.
        ::     Do not forget to set rc to proper exit value (0=success, >0=fail)
        :: <== Probably something like:
        %GBS_MAKE% -f Makefile.mk -B -k %GBS_MAKE_FLAGS%
        set rc=%ERRORLEVEL%
        goto CASE_END
    :CASE_MAKE
        ::
        ::	MAKE
        ::
        echo SUBSYS.GBS_: ** SubSys=%GBS_SUBSYS% - Build=%GBS_BUILD% - Action=%action%
        :: <== add your command(s) to execute the make here and remove these lines.
        ::     Do not forget to set rc to proper exit value (0=success, >0=fail)
        :: <== Probably something like:
        %GBS_MAKE% -f Makefile.mk %GBS_MAKE_FLAGS%
        set rc=%ERRORLEVEL%
        goto CASE_END
    :CASE_CLEANUP_AUD
        ::
        ::	CLEANUP_AUD
        ::
        echo SUBSYS.GBS_: ** SubSys=%GBS_SUBSYS% - Build=%GBS_BUILD% - Audit=%GBS_AUDIT% - Action=%action%
        :: <== add your command(s) to execute the audit_cleanup here and remove these lines.
        ::     Do not forget to set rc to proper exit value (0=success, >0=fail)
        :: <== Probably something like:
        %GBS_MAKE% clean -f Makefile_aud.mk -i
        set rc=%ERRORLEVEL%
        goto CASE_END
    :CASE_AUDIT
        ::
        ::	AUDIT
        ::
        echo SUBSYS.GBS_: ** SubSys=%GBS_SUBSYS% - Build=%GBS_BUILD% - Audit=%GBS_AUDIT% - Action=%action%
        :: <== add your command(s) to execute the gbssubaudit.bat here and
        ::     remove these lines.
        ::     Do not forget to set rc to proper exit value (0=success, >0=fail)
        :: <== Probably something like:
        :: %GBS_MAKE% -f Makefile_aud.mk -B -k %GBS_MAKE_FLAGS%
        echo SUBSYS.GBS_: No audits for non-GBS SubSystems
        set rc=%ERRORLEVEL%
        goto CASE_END
    :CASE_DEFAULT
        ::
        ::	DEFAULT
        ::
        echo SUBSYS.GBS_: ***FATAL ERROR***
        echo - Invalid action '%action%'. Must be one of (cleaunp_bld gen make cleanup_aud audit)
        set rc=9
        goto CASE_END
    :CASE_END
    
    endlocal & set rc=%rc%
    exit /B %rc%
    :::EOF:::
    
    

subsys.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The incs_*.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a incs_*.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The incs_type.gbs files are used to extend the search paths for builders beyond the Components.
The type specifies the associated source-file type (without the DOT)
They will specify directories in

  • 'res' area: $GBS_RES_PATH/$GBS_SUBSYS/...
  • 'ext' area: $GBS_EXT_PATH/yourdirectory
  • Directories outside the GBS directory structure, as specified in switch.gbs.

The incs_type.gbs files may be placed in the following locations:

  • $GBS_SYSBUILD_PATH
  • $GBS_SYSBUILD_PATH/$build
  • $GBS_BUILD_PATH
  • $GBS_BUILD_PATH/$build
  • $GBS_COMPONONENT_PATH/opt
  • $GBS_COMPONONENT_PATH/opt/$build
And will be read in reverse order. Toplevel Directory

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • The .include directive is not allowed

Contents: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax:

One directory per line.

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a incs_*.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================================
    #   [superglo]INCS_C.GBS
    #========================================================
    $GBSEXT_DMF_PATH/include
    $GBSEXT_MARAP_PATH/inc
    
    ###EOF###
    

incs.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The owners.gbs file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a owners.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The owners.gbs file is located in the GBS_SYS_PATH directory is used to maintains 'owners' of SubSystems and Components.
'Owners' have no meaning within GBS. It is offered as a convenience to be able to trace the responsible person for a SubSystem or Component.

It has a specific internal structure and editing of the file is done via gbsmaint 9: 'Owners-file' Maintenance

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Example of a owners.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    
    * UserId    Email                               Phone          Owner-Name
    + uida1179  Paul.Lieverse@siemens.com           +31-40-1234567 Paul Lieverse
    + uida1393  Leon.Bouwmeester@SiemensVDO.com     +31-40-1234567 Leon Bouwmeester
    + uida1473  Datta.Inamdar@siemensvdo.com        +31-40-1234567 Datta Inamdar
    + uida1641  Marcel.vanderVelden@siemensvdo.com  +31-40-1234567 Marcel van der Velden
    + uida1667  Reinier.Kleefman@siemensvdo.com     +31-40-1234567 Reinier Kleefman
    + uida1685  Martin.Smits.ext@siemens.com        +31-40-1234567 Martin Smits
    *
    * SubSystem  Component                       UserId
    = booter     drv_flash                       uida1641
    = booter     -                               uida1641
    = booter     booter                          uida1641
    = booter     i_infolog                       uida1641
    = main       -                               uida1667
    = main       c_trusted_device_database       uida1667
    = main       test_trace_mgr                  uida1685
    = main       most_fb_bluetooth_gateway       uida1667
    = main       drv_iis                         uida1641
    = main       i_tracer                        uida1641
    = main       i_infolog                       uida1641
    = main       test_booter                     uida1641
    = main       c_phonebook_manager             uida1667
    = main       a_ec_nr                         uida1179
    = main       zzz_comp2                       uida1685
    = main       appl_p2er5                      uida1685
    = main       a_mediarecorder                 uida1179
    = main       test_src                        uida1179
    = main       a_audiorouter                   uida1179
    = main       test_logger                     uida1641
    = main       c_bluetooth_phone               uida1667
    = main       hal                             uida1641
    = main       base                            uida1393
    = main       i_logger                        uida1641
    = main       a_speechrecognition_lib         uida1179
    = main       i_xtp                           uida1641
    = main       most_fb_speechrecognition       uida1179
    = main       most_fb_linkcontrol             uida1179
    = main       i_rtp                           uida1641
    = main       drv_sport                       uida1641
    = main       c_bluetooth_transfer_manager    uida1667
    = main       test_autotests                  uida1473
    = main       test_most_stack                 uida1641
    = main       bsp_bf532dev                    uida1641
    = main       i_lifesign                      uida1641
    = main       a_speechrecognition             uida1179
    = main       a_ec_nr_lib                     uida1179
    = main       i_ffs                           uida1641
    = main       h_flash_mgr                     uida1473
    = main       a_mediaplayer                   uida1179
    = main       most_fb_lifecycle               uida1641
    = main       dq_mgr                          uida1641
    = main       zzz_comp1                       uida1685
    
    

owners.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The sca_*.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a sca_*.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The sca_*.gbs files are used to define the behaviour of SCA Audits.
There are two types of sca_*.gbs files:

  • The sca_build.gbs file
    - Primary file
    - Specifies the associated Build
  • The sca_uppercase_name.gbs file
    - Include file
    - Can be included by the sca_build.gbs (and also by other sca_uppercase_name.gbs files.

The sca_*.gbs files can be placed in the following locations:

  • $GBS_SUBSYS_PATH/audit/$audit
  • $GBS_SYSAUDIT_PATH/$audit
The sca_build.gbs file is first searched in the current SubSystem/audit directory.
If not found it is searched in the SYSAUDIT directory

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • The .include directive is allowed.
    If the sca_build.gbs was found in the SubSystem the Include-path is:
    - $GBS_SUBSYS_PATH/audit/$audit
    - $GBS_SYSAUDIT_PATH/$audit
    If the sca_build.gbs was found in the SYSAUDIT the Include-path is:
    - $GBS_SYSAUDIT_PATH/$audit (same directory) only

Contents: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax:

+|-flag value|value-list [ #comments ]

The file is basically a 'flags' file.
Flags are switched on and off by placing a '+' or '-' in front
One flag per line
Possible flags are: E F Q T
Only the E flag can be disabled all others must be preceded by a '+'

Semantics:

E value-list
Enables/Disables Warnings/Errors from the sca tool.
value-list
ALL | message-id | message--wildcard-id
Initially all Warning/Errors are enabled
Wildcard characters are '*' and '?'
Note that '+E ALL' is the same as '+E *'
F value
Specifies the Format of the warning/error message on stdout.
value
NONE | DEFAULT | PCLINT | VISUAL_C | GNU_C | ECLIPSE
Q path
Ignore (Quiet) warnings/errors in the specified path / file-spec.
path
File or Directory Path
Note that system header-files and files in GBSEXT_plugin_PATH are Quieted by default.
T threshold_expression
Override Threshold setting for a Metric.
threshold_expression
Syntax:
metric_name=[min_value][,max_value][:msg_nr]
Either min_value or max_value must be specified, or both.
msg_nr: Specifies a use-defined message to be output after file-analysis.
Not implemented yet.

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a sca_*.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================================
    #   [SYSAUDIT:pclint[mingw]] sca_mingw.gbs
    #========================================================
    
    .include sca_ALL.gbs
    
    ###EOF###
    
    
and...
    
    #========================================================
    #   [SYSAUDIT:pclint[ALL]] sca_ALL.gbs
    #========================================================
    
    -E ALL
    +E 1* 2* 3*	 # Enable all messages starting with 1 2 or 3
    +E 537           # Repeated include file name
    -E 1042          # At least one class-like operand is required with operator 
    
    +Q $GBSEXT_MINGW_CPP_PATH
    
    +F NONE
    
    +T TLN=20,400:6001
    
    ###EOF###
    
    

sca.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The scope.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a scope.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The scope.gbs files are located in the GBS_COMPONENT_PATH directories and are used to specify which Components are in scope. Toplevel Directory

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

Contents: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Syntax:

component_name [ build-line-selection ]

Semantics:

component_name
The Component to included in the scope

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a scope.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    #========================================================
    #   [OMS::test_no_unix:main]SCOPE.GBS
    #========================================================
    superglo
    test_all                                = gnu
    
    ###EOF###
    

scope.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The site.gbs script file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a site.gbs.bat

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

This file can be used instead of the 'Site' section in the switch.gbs(.bat/.sh) files.

As the Site section in all your switch.gbs(.bat/.sh) files contains the locations of all your plugins on your computer - hence contains the same info -, we can have the definitions in one central place - not inside a System.

The site.gbs script file is located in your $GBS_BASE_PATH directory and it is called by swr before the switch.gbs script file with entry parameter.

To edit the file: gbsedit site.gbs

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Please note the following:
  1. Do not try to be 'clever' with these files.
  2. Placing any 'clever' stuff in these files may cause GBS to malfunction.
    If not today: definitely in the future.

Example of a site.gbs.bat: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Example of a site.gbs.bat: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

    
    @ECHO OFF
    ::================================================
    ::  File:     %FILE%
    ::  Path:     %PATH%
    ::================================================
    
    echo GBSSITE_: Setup GBS Development environment ***
    
    ::
    ::  The following settings define where the roots of your plugins are located on this PC
    ::  This file is called before the switch.gbs.bat
    ::  When you use this file there is no need for the 'ROOT' or 'SITE' section in the switch.gbs.bat file
    ::  Only GBSEXT_*_ROOT EnvVars in this file!
    ::
    
    ::
    ::  Version Control
    ::
    ::set GBSEXT_GIT_ROOT=C:\Program Files\Git
    
    ::set GBSEXT_SVN_ROOT=C:\Program Files\Subversion
    
    ::
    ::  Builds
    ::
    ::set GBSEXT_MSVS2012_ROOT=C:\Program Files (x86)\Microsoft Visual Studio 11.0
    ::set GBSEXT_MSVS2012_KIT_ROOT=C:\Program Files (x86)\Windows Kits
    ::set GBSEXT_MSBUILD_ROOT=C:\Windows\Microsoft.NET\Framework
    
    ::set GBSEXT_MINGW_ROOT=C:\MinGW
    
    ::
    ::  Audits
    ::
    ::set GBSEXT_QAC_ROOT=C:\MyPrograms\PRQA\QAC
    
    ::set GBSEXT_QACPP_ROOT=C:\MyPrograms\PRQA\QACPP
    
    ::set GBSEXT_PCLINT_ROOT=C:\MyPrograms\PC-Lint
    
    ::set GBSEXT_CPPTEST_ROOT=C:\MyPrograms\Parasoft\C++test
    
    ::
    ::  Tools
    ::
    ::set GBSEXT_DOXYGEN_ROOT=C:\MyPrograms\doxygen
    
    ::
    ::  My Settings
    ::
    ::  Place your stuff here...
    
    ::: EOF :::
    
    

Example of a site.gbs.sh: Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    
    #!must_be_sourced
    #=================================================
    #   File:     %FILE%
    #   Path:     %PATH%
    #=================================================
    
    echo "GBSSITE_: Setup GBS Development environment ***"
    
    #
    #   The following settings define where the roots of your plugins are located on this PC
    #   This file is called before the switch.gbs.sh
    #   When you use this file there is no need for the 'ROOT' or 'SITE' section in the switch.gbs.sh file
    #   Only GBSEXT_*_ROOT EnvVars in this file!
    #
    
    #
    #   Version Control
    #
    #export GBSEXT_GIT_ROOT=/usr/lib/git-core
    
    #export GBSEXT_SVN_ROOT=/usr/lib/svn
    
    #
    #   Builds
    #
    #export GBSEXT_LGNU_CPP_ROOT=/usr/lib/gcc/x86_64-linux-gnu
    #export GBSEXT_LGNU_GCC_ROOT=/usr/lib/gcc/x86_64-linux-gnu
    
    #
    #   Audits
    #
    #export GBSEXT_QAC_ROOT=/apl/cadappl_linux_ia32/qac
    #export GBSEXT_QACPP_ROOT=/apl/cadappl_linux_ia32/qac++
    
    #
    #   Tools
    #
    
    #
    #   My Settings
    #
    #   Place your stuff here...
    
    
    ### EOF ###
    
    

site.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The steps.gbs file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a steps.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The steps.gbs file is located in the GBS_SYS_PATH directory is used to define the order in which SubSystems are built or audited, Commands are executed or Tools are run.

Non-SubSystem steps, called 'Commands' allow you to execute commands to e.g.:
Copy end-results to a specific directory outside then GBS tree.

Tools run on the whole GBS tree and are not dependent on Audit or Build. E.g.: Doxygen, etc.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • Lines with no leading white-space (called header-lines) define an item.
  • Following lines with leading white-space (called sub-lines) define the parameters for that item.
  • Reserved words (keywords) are case sensitive
  • The .include directive is not allowed

Definitions Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

STEP ALIAS

STEP-definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To define the order in which SubSystems must be generated

Syntax:

STEP step_name
EXEC = SELECT | SPECIFY | ALWAYS | FORCE
TOOL = tool_name
COMMAND = command [command_arguments...]
...
BUILD = YES | NO
AUDIT = YES | NO

Semantics:

The order in which the STEP definitions appear specifies the order in which the steps must be executed. Cyclic references are not possible.
step_name
SubSystem, Command or Tool
The step_name may not be ALL
If the step_name is a SubSystem-name then it refers to that SubSystem.
Else, there must be a COMMAND or a TOOL line immediately following this line to specify the action to be taken

Each Non-GBS SubSystem must have a set of subsys.gbs 'generate' scripts in the top-directory of that SubSystem.
These scripts are:
gbssubgen.script_type
gbssubmake.script_type
gbssubaudit.script_type
gbssubcleaup_bld.script_type
gbssubcleanup_aud.script_type
These scripts do not take arguments from the command line, only EnvVars:
GBS_IGNORE_ERRORS (bool)
GBS_MAKE ('make' command)
GBS_FLAGS_type
GBS_BLD_type
GBS_MODE, GBS_OPT, GBS_DEBUGGER and GBS_MAP
EXEC
Single, Optional
SELECT == Include this step if specified in command-line (default)
SPECIFY == Only include this step if explicitly specified in command-line
ALWAYS == Include this step even if not specified in command-line
FORCE == Never skip, Same as ALWAYS, even if job fails.
TOOL
Single
May not be specified for SubSystem STEP or Command STEP
Must be specified for Tool STEP
COMMAND
Multiple
May not be specified for SubSystem STEP or Tool STEP
Must be specified for Command STEP
command
If preceded by '@' or '>' or '.' and no .type: assume .bat on Win32 else .sh

If preceded by '@', find command_file relative to $GBS_SYS_PATH
If preceded by '>', find command_file relative to $GBS_SCRIPTS_PATH/plugins
If preceded by '.', find command_file relative to $GBS_SCRIPTS_PATH
BUILD
Single, Optional, Boolean
If NO the Step will not be selected for gbssysbuild or gbssysmake
May not be specified for Tool Step
AUDIT
Single, Optional, Boolean
If NO the Step will not be selected for gbssysaudit
May not be specified for Tool Step

ALIAS-definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To group step_names and optionally associate a Build

Syntax:

ALIAS alias_name
BUILD = build-name
STEPS = steps-list

Semantics

ALIAS
Must be specified after the STEP-definitions
alias_name
It is good practice to specify the alias_name in uppercase
The alias_name may not be ALL
BUILD
Single, Optional
Specifies associated Build
STEPS
Single, Mandatory
steps-list
'-' (hyphen) may be used to specify 'from' - 'to' sequences

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a steps.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    
    #
    #   STEPS.GBS
    #
    
    #
    #   STEPS
    #
    STEP begin
        COMMAND     = @begin
        AUDIT       = NO
    
    STEP superglo
    
    STEP bart
    
    STEP non_gbs
    
    STEP visualstudio
    
    STEP copy_export
        COMMAND     = >copy_export/bin/copy_export.pl superglo $GBS_BUILD $GBSEXT_GBSSHARE/$GBS_BUILD
        AUDIT       = NO
    
    STEP prqa
        EXEC        = SPECIFY
    
    STEP doxygen
        TOOL        = >doxygen/bin/doxygen.pl full
        BUILD       = NO
        AUDIT	= NO
    
    STEP doxygen_api
        TOOL        = >doxygen/bin/doxygen.pl api
        EXEC        = SPECIFY
        BUILD       = NO
        AUDIT	= NO
    
    #
    #   ALIASES
    #
    ALIAS SUBSET
        STEPS = superglo bart
    
    ALIAS PRQA
        STEPS = prqa
    
    ALIAS FULL
        STEPS = superglo bart prqa
    
    ALIAS ALL
        STEPS = begin - doxygen_api
    
    ALIAS LGCC
        BUILD = lgcc
    
    ALIAS MINGW
        BUILD = mingw
    
    ##EOF##
    
    

steps.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The switch.gbs script file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a switch.gbs.bat

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The switch.gbs script file is located in the GBS_SYSTEM_PATH directory and is used to define the environment in which the System has to function.
Here all external items must be defined. e.g.:

  • Compiler-locations
  • 3rd party software located outside the System
  • etc

To edit the file: gbsedit switch.gbs

In GBS the switch.gbs script file and the site.gbs script file are the only files allowed to contain absolute disk-addresses

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Special considerations:
  • These files are operating-system dependent script files and have the appropriate file-extension for that particular operating-system. e.g.:
    • switch.gbs.sh for Linux
    • switch.gbs.bat for Windows

Calling Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The switch.gbs file is called:
When you enter a System (swr or startup)
GBS_SYSTEM_PATH:switch.gbs is called with parameter entry
When you leave a System (swr)
GBS_SYSTEM_PATH:switch.gbs is called with parameter exit

Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Environment Variables defined in the switch.gbs file should be in uppercase.
When referring to external data (directories/files) they should be prefixed with GBSEXT_. (Not GBS_EXT_)
When exiting a System, GBS will unset all GBSEXT_ Environment Variables that were set at 'entry'.
This is done before the switch.gbs is called with the 'exit' parameter.
The only sensible thing to do in the 'exit' part is to call a script or program. But this will be extremely rare.
Note that at the moment of invocation all GBS internal Environment Variables for that System have been set.

Additional Available Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

These are defined before execution of the switch.gbs file and can be used to control additional settings.
They may never be changed!
GBS_SITE
Preset by user (Install or gbssettings)
Specifies the site where this user is working
More info in Install Notes
GBS_PLATFORM
Use to distinguish on which platform GBS is running. e.g.:
    linux or MSWin32
GBS_SYSTEM_PARENT
The name of the parent directory (not the path) of the System.
It is used to define a Log-directory dependent on the System. E.g.:
SET GBS_LOG_PATH=%GBSLOG_ROOT%\%GBS_SYSTEM_PARENT%
GBS_IS_INTEGRATOR
0 or 1
Specifies that the user has GBS Integrator privileges
GBS_IS_ADMINISTRATOR
0 or 1
Specifies that the user has GBS Administrator privileges

Special Environment Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

You can specify 'special' EnvVars that give extra control the execution of gbsaudit, gbsbuild and gbsmake.
These are:
  • GBS_DEBUGGER
  • GBS_MAP
  • GBS_MODE
  • GBS_OPT
  • GBS_FLAGS_type
  • GBS_APP_anyname
They are described in GBS Customisation (Session)

Layout Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

The file consists of two mayor parts:
  • Entry: The part that is executed with parameter 'entry'
    • The ROOT section
    • The REL and PATH section
  • Exit: The part that is executed with parameter 'exit'

Entry

This part is executed when you 'enter' a System (make it current)
It consists of 2 Sections

The ROOT section

This Section is where you have the Site dependent stuff.
Here you will typically set GBSEXT_..._ROOT EnvVars to their Site-dependent locations

As this part remains consistent for the various Systems on your computer (SITE) you can also define the GBSEXT_..._ROOT EnvVars in a separate file site.gbs(.bat/.sh) instead. (described below)

The REL and PATH section

This Section is where you set the GBSEXT_..._REL
And the assembly of GBSEXT_..._ROOT and GBSEXT_..._REL to GBSEXT_..._PATH

In some cases (e.g. svn or git) you can set the GBSEXT_..._PATH to PATH. No GBSEXT_..._REL is needed in this case.

Exit

This part is executed when you 'exit' a System (un-current it)

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Please note the following:
  1. Do not try to be 'clever' with these files.
  2. Placing any 'clever' stuff in these files may cause GBS to malfunction.
    If not today: definitely in the future.

Example of a switch.gbs.bat: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Example of a switch.gbs.bat: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

    
    @ECHO OFF
    ::================================================
    ::  File:        %FILE%
    ::  Path:        %PATH%
    ::  System Name: %SYSTEM_NAME%
    ::================================================
    if NOT [%1] == [entry] goto :do_exit
        ::
        ::	ENTRY: set items
        ::
    
        ::-------------------------------------------
        ::	ROOT Section
        ::	This part can be deleted if <GBS_BASE_PATH>/site.gbs.bat is used
        ::-------------------------------------------
        if NOT [%GBS_SITE%] == [%SITE%] goto :NOT_%SITE%
    	::
    	::  %SITE%
    	::
    
    	::
    	::  Version Control
    	::
    	::set GBSEXT_GIT_ROOT=C:\Program Files\Git
    
    	::set GBSEXT_SVN_ROOT=C:\Program Files\Subversion
    
    	::
    	::  Builds
    	::
    	::set GBSEXT_MSVS2012_ROOT=C:\Program Files (x86)\Microsoft Visual Studio 11.0
    	::set GBSEXT_MSVS2012_KIT_ROOT=C:\Program Files (x86)\Windows Kits
    	::set GBSEXT_MSBUILD_ROOT=C:\Windows\Microsoft.NET\Framework
    
    	::set GBSEXT_MINGW_ROOT=C:\MinGW
    
    	::
    	::  Audits
    	::
    	::set GBSEXT_QAC_ROOT=C:\MyPrograms\PRQA\QAC
    
    	::set GBSEXT_QACPP_ROOT=C:\MyPrograms\PRQA\QACPP
    
    	::set GBSEXT_PCLINT_ROOT=C:\MyPrograms\PC-Lint
    
    	::set GBSEXT_CPPTEST_ROOT=C:\MyPrograms\Parasoft\C++test
    
    	::
    	::  Tools
    	::
    	::set GBSEXT_DOXYGEN_ROOT=C:\MyPrograms\doxygen
    
    	::
    	::  GBS Settings
    	::
    
    	goto :end_site
        :NOT_%SITE%
        if NOT [%GBS_SITE%] == [OTHER] goto :NOT_OTHER
    	::
    	::      OTHER
    	::
    	goto :end_site
        :NOT_OTHER
    	echo *******
    	echo **  Unknown site '%GBS_SITE%'
    	echo **  Must be one of [ %SITE% OTHER ]
    	echo *******
    	::false
    	goto :error_exit
        :end_site
    
        ::--------------------------------------------
        ::	REL and PATH Section
        ::-------------------------------------------
        ::
        ::	Version Control
        ::
        ::set GBSEXT_GIT_PATH=PATH
    
        ::set GBSEXT_SVN_PATH=PATH
    
        ::
        ::  Builds
        ::
        ::set GBSEXT_MSVS2012_CONS_REL=2012
        ::set GBSEXT_MSVS2012_CONS_PATH=%GBSEXT_MSVS2012_ROOT%
        ::set GBSEXT_MSVS2012_KIT_REL=8.0
        ::set GBSEXT_MSVS2012_KIT_PATH=%GBSEXT_MSVS2012_KIT_ROOT%\%GBSEXT_MSVS2012_KIT_REL%
        ::set GBSEXT_MSBUILD_REL=v4.0.30319
        ::set GBSEXT_MSBUILD_PATH=%GBSEXT_MSBUILD_ROOT%\%GBSEXT_MSBUILD_REL%
    
        ::set GBSEXT_MINGW_BASE_REL=2013072200
        ::set GBSEXT_MINGW_CPP_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL%
        ::set GBSEXT_MINGW_CPP_REL=6.3.0
    
        ::set GBSEXT_MINGW_BASE_REL=2013072200
        ::set GBSEXT_MINGW_GCC_PATH=%GBSEXT_MINGW_ROOT%\%GBSEXT_MINGW_BASE_REL%
        ::set GBSEXT_MINGW_GCC_REL=6.3.0
    
        ::
        ::  Audits
        ::
        ::set GBSEXT_QAC_REL=8.1-R
        ::set GBSEXT_QAC_PATH=%GBSEXT_QAC_ROOT%\%GBSEXT_QAC_REL%
    
        ::set GBSEXT_QACPP_REL=3.0-R
        ::set GBSEXT_QACPP_PATH=%GBSEXT_QACPP_ROOT%\%GBSEXT_QACPP_REL%
    
        ::set GBSEXT_PCLINT_REL=8.00x
        ::set GBSEXT_PCLINT_PATH=%GBSEXT_PCLINT_ROOT%\%GBSEXT_PCLINT_REL%
    
        ::SET GBSEXT_CPPTEST_REL=9.6
        ::SET GBSEXT_CPPTEST_PATH=%GBSEXT_CPPTEST_ROOT%\%GBSEXT_CPPTEST_REL%
        ::SET GBSEXT_CPPTEST_BUILD=9.6.0.99
    
        ::
        ::	Tools
        ::
        ::set GBSEXT_DOXYGEN_REL=3.5
        ::set GBSEXT_DOXYGEN_PATH=%GBSEXT_DOXYGEN_ROOT%
    
        ::
        ::	Audit Tools
        ::
        ::set QAC_REL=%GBSEXT_QAC_REL%
        ::set QACROOT=%GBSEXT_QAC_PATH%
    
        ::set QACPP_REL=%GBSEXT_QACPP_REL%
        ::set QACPPROOT=%GBSEXT_QACPP_PATH%
    
        goto end_entry_exit
    :do_exit
    if NOT [%1] == [exit] goto :no_entry_exit
        ::
        ::	unset items
        ::
    
        goto :end_entry_exit
    :no_entry_exit
        echo *****
        echo ** SYSTEM/switch.gbs: Usage = call switch.gbs.bat [ entry ^| exit ]
        echo *****
        goto :error_exit
    :end_entry_exit
    :: true
    goto :EOF
    
    :error_exit
    ::
    ::  Error-exit
    ::
    set GBS_RC=1
    goto :EOF
    
    :::EOF:::
    

Example of a switch.gbs.sh: Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    
    #!must_be_sourced
    #=================================================
    #   File:        %FILE%
    #   Path:        %PATH%
    #   System Name: %SYSTEM_NAME%
    #=================================================
    GBS_SWITCH_RC=0
    if [[ $1 = "entry" ]]
    then
        #
        #	ENTRY: set items
        #
    
        #--------------------------------------------
        #	ROOT Section
        #	This part can be deleted if <GBS_BASE_PATH>/site.gbs.sh is used
        #--------------------------------------------
        if [[ $GBS_SITE = "%SITE%" ]]
        then
    	#
    	#   %SITE%
    	#
    
    	#
    	#   Version Control
    	#
    	#export GBSEXT_GIT_ROOT=PATH
    
    	#export GBSEXT_SVN_ROOT=PATH
    
    	#
    	#   Builds
    	#
    	#export GBSEXT_LGNU_CPP_ROOT=/usr/lib/gcc/x86_64-linux-gnu
    	#export GBSEXT_LGNU_GCC_ROOT=/usr/lib/gcc/x86_64-linux-gnu
    
    	#
    	#   Audits
    	#
    	#export GBSEXT_QAC_ROOT=/apl/cadappl_linux_ia32/qac
    	#export GBSEXT_QACPP_ROOT=/apl/cadappl_linux_ia32/qac++
    
    	#
    	#   Tools
    	#
    
    	#
    	#   GBS Settings
    	#
    
    	true
    
        elif [[ $GBS_SITE = "OTHER" ]]
        then
    	#
    	#   OTHER
    	#
    
    	true
        else
    	echo "SWITCH.GBS: *****"
    	echo "SWITCH.GBS: ** Unknown Site $GBS_SITE"
    	echo "SWITCH.GBS: ** Must be one of '%SITE% OTHER'"
    	echo "SWITCH.GBS: *****"
    	GBS_SWITCH_RC=1
        fi
    
        #--------------------------------------------
        #	REL and PATH Section
        #--------------------------------------------
        if [[ $GBS_SWITCH_RC = 0 ]]
        then
    	#
    	#   Version Control
    	#
    	#export GBSEXT_GIT_PATH=PATH
    
    	#export GBSEXT_SVN_PATH=PATH
    
    	#
    	#   Builds
    	#
    	#export GBSEXT_LGNU_CPP_REL=7
    	#export GBSEXT_LGNU_CPP_PATH=$GBSEXT_LGNU_CPP_ROOT/$GBSEXT_LGNU_CPP_REL
    
    	#export GBSEXT_LGNU_GCC_REL=7
    	#export GBSEXT_LGNU_GCC_PATH=$GBSEXT_LGNU_GCC_ROOT/$GBSEXT_LGNU_GCC_REL
    
    	#
    	#   Audits
    	#
    	#set GBSEXT_QAC_REL=8.1-R
    	#set GBSEXT_QAC_PATH=$GBSEXT_QAC_ROOT-$GBSEXT_QAC_REL
    
    	#set GBSEXT_QACPP_REL=3.0-R
    	#set GBSEXT_QACPP_PATH=$GBSEXT_QACPP_ROOT-$GBSEXT_QACPP_REL
    
    	#
    	#   Tools
    	#
    
    	true
        fi
    elif [[ $1 = "exit" ]]
    then
        #
        #	EXIT: unset items
        #
    
        true
    else
        echo "SWITCH.GBS: *****"
        echo "SWITCH.GBS: ** switch.gbs.sh: Usage = . switch.gbs.sh [ entry | exit ]"
        echo "SWITCH.GBS: *****"
        GBS_SWITCH_RC=1
    fi
    
    [[ $GBS_SWITCH_RC = 1 ]] && export GBS_RC=1
    unset GBS_SWITCH_RC
    
    ##EOF##
    

switch.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The system.gbs file Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a system.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The system.gbs file is located in the GBS_SYSTEM_PATH directory is used to define primary settings for a System.

It is a very delicate file and any manual modifications should be left to a GBS specialist.

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Example of a system.gbs: Bottom Doc. Button Top Document Button Blank Up Section Button

    
    #
    #   SYSTEM.GBS
    #
    id=system
    system_name=SuperGlo
    root_version=2.04
    build_start=202061212
    build_end=
    scms-MSWin32=SubVersioN
    scms-linux=No_SCMS
    scms_data=trunk
    scms_repository-linux=
    scms_repository-MSWin32=svn://vhvfsnt10/SuperGlo
    builds-MSWin32=dos
    builds-MSWin32=dosd
    builds-MSWin32=mingw
    builds-MSWin32=mingwd
    builds-MSWin32=mvs
    builds-MSWin32=mvsd
    builds-linux=lgcc
    ###EOF###
    
    

system.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The tool.gbs files Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description
Example of a tool.gbs

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

Purpose Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

The tool.gbs files are located in the GBS_SYSTOOLS_PATH/tool directories and are used to define the particularities of a Tool.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Please refer to .gbs files: General information

Additional for this file:

  • Lines with no leading white-space (called header-lines) define an item.
  • Following lines with leading white-space (called sub-lines) define the parameters for that item.
  • Reserved words (keywords) are case sensitive
  • The search path for the .include Directive is:
    - $GBS_SYSTOOLS_PATH/$GBS_TOOL
    - $GBS_SYSTOOLS_PATH

Contents Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

SETUP definition
DEFAULTS definition
INIT definition
RUN definition

SETUP Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To define general stuff, valid for the whole definition set.

Syntax:

SETUP
NICE_NAME = nice_name

Semantics:

NICE_NAME
Specifies a more descriptive name of the Tool. It is used in messages.
nice_name
Free format (just do not make it too long)

DEFAULTS definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To set Tool dependent defaults, overriding the GBS defaults

Syntax:

DEFAULTS
ACTION = action-definition

Semantics:

Refer to RUN semantics below.

INIT definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To perform general initialisation.
It is possible to define derived Tool dependent Environment Variables
Note that all references to the 'outside-world' must be specified in the switch.gbs.
On Windows it can be used to (re)define an EnvVar with spaces removed. (Converted to ShortPathName)

Syntax:

INIT
SET_W = envvar_name => envvar_value
...
SET_X = envvar_name => envvar_value
...
SET = envvar_name => envvar_value
...
SETPATH = path_envvar_name => envvar_value-list
...
BIN_DIR = bin_dir

Semantics:

SET_W, SET_X & SET
Specifies an Environment Variable.
envvar_name
Uppercase please
envvar_value
If placed between quotes (") it will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
SET_W is executed for Windows only.
SET_X is executed for Linux only.
SET is executed for all platforms
and must be specified after SET_W and SET_X
SETPATH
Specifies a PATH Environment Variable.
path_envvar_name
Case dependent on OS
envvar_value-list
If placed between quotes (") items will be canonicalised (/.. solved) and on Windows converted to a ShortPathName without spaces.
Items will be properly joined (';' on Windows, ':' on Linux)
Must be specified after SET_W, SET_X & SET
BIN_DIR
Specifies the directory in which the executables of the plugin reside, relative to GBSEXT_<plugin>_PATH.
It is used to assemble GBSEXT_<plugin>_BIN_PATH which must be used in the COMMAND sub-section.
bin_dir
One or more directories, separated by '/'

RUN Definition Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Purpose:

To provide information on how to run the Tool program (executable or script)

Syntax:

RUN
ACTION = actiondefinition
...
COMMAND = [ [ pre-condition ; ] ok_exit_values-comma-list ; ] command-definition
...

Semantics:

ACTION
Specifies possible actions of the Tool. To be used as pos-arg, option or EnvVar
action-definition
action-definition := action_name... => option
E.g.:
ACTION = API => api
ACTION = FULL => full
Default is the first in the list
COMMAND
Command to invoke the Tool program.
Syntax and Semantics:
Refer to the COMMAND description
More than one COMMAND can be specified.
The command is called with the following positional parameters:
  • $1 selected_action
    The option value of the DEFAULT ACTION
  • $2 subsys_def_list
    A comma-list of selected SubSystem definitions
    subsys_def := subsystem:subsystem_type
    subsystem_type := GBS | MSVS | make | Other
    E.g.: subsys1:GBS,subsys2:make,subsys3:GBS
  • $3 out_file_spec
    $GBS_SILO_PATH/tools/$GBS_TOOL/index.html
  • $4 out_file_path
    $GBS_SILO_PATH/tools/$GBS_TOOL
The following additional Environment Variables are set and may be used:

Notes: Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

None

Example of a tool.gbs: Bottom Doc. Button Top Document Button Down Section Button Up Section Button

File 1 (Basic reference - implicit default) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

    #========================================================
    #   doxygen_api [doxygen] tool.gbs
    #========================================================
    .plugin doxygen
    
    .include <tool.gbs>
    
    ###EOF###
    

File 2 (Basic reference - explicit default) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    #========================================================
    #   [doxygen] tool.gbs
    #========================================================
    .plugin doxygen
    
    .include <tool.gbs>
    
    DEFAULTS
        ACTION = FULL
    
    ###EOF###
    

File 3 (Full specification) Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    #========================================================
    #   %TOOL% [doxygen] tool.gbs
    #========================================================
    
    SETUP
        NICE_NAME	= DoxyGen
    
    INIT
        BIN_DIR	= bin
    
    RUN
        ACTION = API    => api
        ACTION = FULL   => full
        COMMAND = >doxygen/bin/doxygen.pl %1 %2 %3 %4
    
    ##EOF##
    

tool.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Development Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Description

Description Bottom Doc. Button Top Document Button Down Section Button Up Section Button

This section describes some basic development aspects of GBS.

Choice of Language Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

GBS is written in Perl.
I needed a language that will execute exactly the same on various computers (at that time Windows and UNIX), without being depended on installed libraries.
When I started developing GBS in 2001 the best choice was Perl.
Should I start developing now I would probably chose Python.

Quality Assurance Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

perlcritic

Running perlcritic yields the following results for this version:
    ----
    
       335 files.
     5,603 subroutines/methods.
    80,795 statements.
    
    139,611 lines, consisting of:
        15,423 blank lines.
        36,049 comment lines.
    	68 data lines.
        85,725 lines of Perl code.
         2,346 lines of POD.
    
    Average McCabe score of subroutines was 3.25.
    
    0 violations.
    Violations per file was 0.000.
    Violations per statement was 0.000.
    Violations per line of code was 0.000.
    
    ----
    

I do use function prototypes, but only with $ and @. Never with \.

Checks

Some proprietary programs (perlxref and perlcheck) are used to detect:
  • Unused 'use' statements
  • Missing 'use' statements
  • Unused functions
  • Missing functions

  • Unused global variables
  • Active (Uncommented) trace/debug statements

Help

Command help (--help) and Help File All Commands are created directly from the code so there is no mismatch.

Design Considerations Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

  • It must be fast.
    Hence command-line interface and no frills.
    Some standard packages duplicated and reduced to cater only for Windows and Linux.
    The Perl code is 'compiled' replacing comment-lines by blank lines and removing leading white-space. This makes the files smaller and that reduces disk I/O and parsing.
  • Only dependent on plain Perl with standard packages.
    No extra CPAN installs. No separately installs of any utilities (except of course your compiler-suite).
  • Must run exactly the same on Windows and Linux.
  • Straight forward. No exceptions.
  • Keep it simple.
  • TBS

development.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
About Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

History
About Randy Marques

History Bottom Doc. Button Top Document Button Down Section Button Up Section Button

GBS was conceived, designed and developed by Randy Marques from Eindhoven, The Netherlands.

1985 Pre-GBS at Philips Medical Systems Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

GBS is based on experiences with 'CCS', the Code Control System developed at Philips Medical Systems, Best, Netherlands in 1985. Designed and developed by Randy Marques.
Used for over 15 years by a variety of small and large projects and still in use for maintenance projects
It was written for VAX/VMS in DCL.

2001 Start GBS at Origin / Atos Origin Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

GBS development started in 2001 on WinXp and later on Unix
Written mainly in Perl to ensure exact same functionality on all platforms.
Only dependent on Perl. No special privileges required.
Same concept, modern technology.

2008 GBS at Task24 / Nspyre Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Available for Windows 7 Unix and Linux.
'Consultancy-ware'
Experimental GUI

2011 GBS at Randy Marques Consultancy Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Available for Windows 10, WSL and Linux.
'Consultancy-ware'
Improved User-Interface
(Almost) full functioning GUI

2021 GBS Open Source at SourceForge Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

About Randy Marques Bottom Doc. Button Top Document Button Blank Up Section Button

Living in Eindhoven - The Netherlands, from Curaçao - South Caribbean
  • CASE Consultant
    • Retired, but still working on GBS
    • CEO / Owner Randy Marques Consultancy
    • Dutch Standardisation Institute (NEN)
      - Dutch Programming Languages Committee (NC 381 22)
      - WG14 (International C Committee)
    • Teach at various Universities and Colleges
  • "Consultancy by Walking Around"
    • Software Engineering since 1971
    • Coding Standards since 1978
    • Build Automation since 1980
    • C programming since 1983
    • Static Analysis since 1993
    • Les Hatton's Safer C™ trainer since 2001
    • Perl programming since 2001
    • Retired since 2020

about.html
GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Metrics Help Bottom Doc. Button

Contents Bottom Doc. Button Top Document Button Down Section Button Blank

Metrics Overview
Function-Based Metrics
File-Based Metrics
Class-Based Metrics
Project-Wide Metrics
General

Metrics Overview Bottom Doc. Button Top Document Button Down Section Button Up Section Button

The Calculation of Metrics Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

QAC calculates metrics in three groups.
Function metrics are generated for all functions with a full definition.
File metrics are generated for each file analyzed.
Project metrics are calculated once per complete project, and are generated from cross-module analysis.

QAC++ calculates metrics in three groups.
Function metrics are generated for all functions with a full definition.
Class metrics are generated for each defined class.
File metrics are generated for each file analyzed.

All metrics, except LIN and TPP, ignore code that is disabled on evaluation of pre-processor directives.
That is, both the code in the source file and the #include'd files inside conditional pre-processor directives are ignored for all metrics except LIN and TPP.

For example:

    
        #define A 10
        #if 0
        #include <stdio.h>      /* Ignored by all except LIN, TPP */
        int i;                  /* Ignored by all except LIN, TPP */
        #else
        long i;
        #endif
    

Function-Based Metrics Overview Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

These metrics are all calculated for the source code of an individual function. Some metrics are used in the definition of others, but there is no obvious sequence. They are described here in alphabetical order, for ease of reference. The complete list is as follows:

AKIAkiyama's Criterion
AV1Average Size of Statement in Function (variant 1)
AV2Average Size of Statement in Function (variant 2)
AV3Average Size of Statement in Function (variant 3)
BAKNumber of Backward Jumps
CALNumber of Functions Called from Function
CYCCyclomatic Complexity
ELFNumber of Dangling Else-Ifs
FN1Number of Operator Occurrences in Function
FN2Number of Operand Occurrences in Function
GTONumber of Goto statements
HLBNumber of Halstead's delivered bugs (B)
KDNKnot Density
KNTKnot Count
LCTNumber of Local Variables Declared
LINNumber of Code Lines
LOPNumber of Logical Operators
M07Essential Cyclomatic Complexity
M19Number of Exit Points
M29Number of Functions Calling this Function
MCCMyer's Interval
MIFDeepest Level of Nesting
PARNumber of Function Parameters
PBGResidual Bugs (PTH-based est.)
PDNPath Density
PTHEstimated Static Program Paths
RETNumber of Return Points in Function
ST1Number of Statements in Function (variant 1)
ST2Number of Statements in Function (variant 2)
ST3Number of Statements in Function (variant 3)
SUBNumber of Function Calls
UNRNumber of Unreachable Statements
UNVUnused or Non-Reused Variables
XLNNumber of Executable Lines

File-Based Metrics Overview Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

These metrics are all calculated for the source code in a complete translation unit (TU). They are listed alphabetically here for convenience. They are not calculated in this sequence. because of their derivation from each other:

BMEEmbedded Programmer Months
BMOOrganic Programmer Months
BMSSemi-detached Programmer Months
BUGResidual Bugs (token-based estimate)
CDNComment to Code Ratio
DEVEstimated Development (programmer-days)
DIFProgram Difficulty
ECTNumber of External Variables Declared
EFFProgram Effort
FCOEstimated Function Coupling
FNCNumber of Functions in File
HALHalstead Prediction of TOT
M20Number of Operand Occurrences
M21Number of Operator Occurrences
M22Number of Statements
M28Number of Non-Header Comments
M33Number of Internal Comments
OPNNumber of Distinct Operands
OPTNumber of Distinct Operators
SCTNumber of Static Variables Declared
SHNShannon Information Content
TDEEmbedded Total Months
TDOOrganic Total Months
TDSSemi-detached Total Months
TLNTotal Preprocessed Source Lines
TOTTotal Number of Tokens Used
TPPTotal Unpreprocessed Code Lines
VARTotal Number of Variables
VOLProgram Volume
ZIPZipf Prediction of TOT
  
CCATotal Number of Characters
CCBTotal Number of Code Characters
CCCTotal Number of Comment Characters

Class-Based Metrics Overview Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

These metrics are calculated for the classes in your source code. To calculate some of these metrics you must also have run the relevant cross-module analysis program. See Cross-Module Analysis in Chapter 4: Analysing Source Code. Class-based metrics are described here in alphabetical order for ease of reference:

CBOCoupling between objects
DITDeepest level of inheritance
LCMLack of cohesion of methods within a class
MTHNumber of methods available in class
NOCNumber of immediate children
NOPNumber of immediate parents
RFCResponse for class
WMCWeighted methods per class

Project-Wide Metrics Overview Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

These metrics are calculated once per complete project. The complete list is as follows:

NRANumber of Recursions Across Project
NEANumber of Entry Points Across Project
NFANumber of Functions Across Project
CYACyclomatic Complexity Across Project

Function-Based Metrics Bottom Doc. Button Top Document Button Down Section Button Up Section Button

AKI - Akiyama's Criterion Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Function-Based Metric

This metric is the sum of the Cyclomatic complexity (CYC) and the number of function calls (SUB). Although this is not an independent metric, it is included on account of its use in documented case histories. See Akiyama[1] and Shooman[2] for more details. The metric is calculated as:

AKI = CYC + SUB

[1] Akiyama, F. (1971) An Example of Software System Debugging, Proc. IFIP Congress 1971, Lbujlana, Yugoslavia, American Federation of information Processing Societies, Montvale, New Jersey.

[2] Shooman, M.L. (1983) Software Engineering, McGraw-Hill, Singapore.

AV1 - Average Size of Statement in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

AV2 - Average Size of Statement in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

AV3 - Average Size of Statement in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

AVx - Average Size of Statement in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metrics

These metrics (AV1, AV2, and AV3) measure the average number of operands and operators per statement in the body of the function. They are calculated using Halstead's[1] calculations as follows:

AVx = (N1 + N2) / number of statements in the function

where:
N1 is Halstead's number of operator occurrences.
N2 is Halstead's number of operand occurrences.

The AVx metrics are computed using ST1, ST2 and ST3 to represent the number of statements in a function. Hence there are three variants: AV1, AV2 and AV3 relating to the respective statement count metrics.

This metric is used to detect components with long statements. Statements comprising a large number of textual elements (operators and operands) require more effort by the reader in order to understand them. This metric is a good indicator of the program's readability.

Metric values are computed as follows:

AV1 = (FN1 + FN2) / ST1
AV2 = (FN1 + FN2) / ST2
AV3 = (FN1 + FN2) / ST3

[1] Halstead, Maurice H. (1977). Elements of Software Science.

BAK - Number of Backward Jumps Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

Jumps are never recommended and backward jumps are particularly undesirable. If possible, the code should be redesigned to use structured control constructs such as while or for instead of goto.

Example

        main()
        {
        Backward:
    	switch (n)
    	{
    	case 0:
    	    printf( stdout, "zero\n");
    	    break;
    	case 1:
    	    printf( stdout, "one\n");
    	    goto Backward;                  /* 1 */
    	    break;
    	case 2:
    	    printf( stdout, "two\n");
    	    break;
    	default: printf( stdout, "many\n");
    	    break;
    	}
        }
    

The above code sample has a BAK value of 1.

CAL - Number of Functions Called from Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric counts the number of function calls in a function.

It differs from the metric SUB, in that only distinct functions are counted (multiple instances of calls to a particular function are counted as one call), and also that functions called via pointers are not counted.

CYC - Cyclomatic Complexity Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

Cyclomatic complexity is calculated as the number of decisions plus 1.

High cyclomatic complexity indicates inadequate modularization or too much logic in one function. Software metric research has indicated that functions with a cyclomatic complexity greater than 10 tend to have problems related to their complexity.

McCabe[1] gives an essential discussion of this issue as well as introducing the metric.

Example 1

        int divide( int x, int y)
        {
    	if (y != 0)                     /* 1 */
    	{
    	    return x / y;
    	} else if (x == 0)              /* 2 */
    	{
    	    return 1;
    	} else
    	{
    	    printf( "div by zero\n");
    	    return 0;
    	}
        }
    

The above code sample has a cyclomatic complexity of 3 as there are two decisions made by the function. Note that correctly-indented code does not always reflect the nesting structure of the code. In particular, the use of the construct 'else if' always increases the level of nesting, but it is conventionally written without additional indentation and so the nesting is not visually apparent.

Example 2

        void how_many(int n)
        {
    	switch (n)
    	{
    	case 0:
    	    printf( "zero");            /* 1 */
    	    break;
    	case 1:
    	    printf( "one");             /* 2 */
    	    break;
    	case 2:
    	    printf( "two");             /* 3 */
    	    break;
    	default:
    	    printf( "many");
    	    break;
    	}
        }
    

The above code sample has a cyclomatic complexity of 4, as a switch statement is equivalent to a series of decisions.

Some metrication tools include use of the ternary operator ? : when calculating cyclomatic complexity. It could also be argued that use of the && and || operators should be included. Instead, CYC calculation is based on statements alone.

CYC is one of the three standard metrics used by QAC for demographic analysis.

[1] McCabe, T. J. (1976) A Complexity Measure, IEEE Transactions on Software Engineering, SE-2, pp. 308-320.

ELF - Number of Dangling Else-Ifs Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the number of if-else-if constructs that do not end in an else clause. This metric is calculated by counting all if statements that do not have a corresponding else and for which QAC issues a warning 2004. ELF provides a quick reference allowing monitoring of these warnings. The code sample below has an ELF value of 1.

Example

        int divide(int x, int y)
        {
    	if (y != 0)
    	{
    	    return x/y;
    	} else if (x == 0)
    	{
    	    return 1;
    	}
        }
    

FN1 - Number of Operator Occurrences in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is Halstead's[1] operator count on a function basis (N1). FN1 is related to OPT and M21: all of these metrics count 'operators', the difference is summarized as:

FN1Counts ALL operators in the function body
M21Counts ALL operators in the file
OPTCounts DISTINCT operators in the file

See OPT for the definition of an operator.

[1] Halstead, Maurice H. (1977). Elements of Software Science.

FN2 - Number of Operand Occurrences in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is Halstead's[1] operand count on a function basis (N2). FN2 is related to OPN and M20: all of these metrics count 'operands', the difference is summarized as:

FN2Counts ALL operands in the function body
M20Counts ALL operands in the file
OPNCounts DISTINCT operands in the file

See OPN for the definition of an operand.

[1] Halstead, Maurice H. (1977). Elements of Software Science.

GTO - Number of Goto statements Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

Some occurrences of goto simplify error handling. However, they should be avoided whenever possible. According to the Plum Hall Guidelines, goto should not be used.

HLB - Number of Halstead's delivered bugs (B) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

The metric is an estimate for the number of errors in the implementation.
High values of Halstead's[1] delivered bugs (B) metrics indicate possibility of high number of bugs.
The value of this metric is highly correlated to the size of a function.

The metric is defined in following way:
B = V / 3000

where:

Function Volume V = N * log2(n)
N - the number of all operators and operands within function
n - the number of distinct operators and operands within function

Example

        int foo( int i)     /* Violation: B = 0.09 */
        {
    	int a;
    	int b;
    
    	a = i + (2 * (i + 1)) + (3 * (i + 2));
    	b = (i + (2 * (i + 1)) + (3 * (i + 2))) * 2;
    
    	if (i >= 3)
    	    return a;
    	if (i >= 2)
    	    return b;
        }
    

[1] Halstead, Maurice H. (1977). Elements of Software Science.

KDN - Knot Density Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the number of knots per executable line of code. The metric is calculated as:

KDN = KNT / XLN

The value is computed as zero when XLN is zero.

KNT - Knot Count Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the number of knots in a function. A knot is a crossing of control structures, caused by an explicit jump out of a control structure either by break, continue, goto, or return. KNT is undefined for functions with unreachable code.

This metric measures knots, not by counting control structure crossings, but by counting the following keywords:

  • goto statements,
  • continue statements within loop statements
  • break statements within loop or switch statements, except those at top switch level,
  • all return statements except those at top function level.

The function below has an KNT value of 1.

Example

        void fn( int n, int array[], int key )
        {
    	while ( array[ n ] != key )
    	{
    	    if ( array[ n ] == 999 )
    	    {
    		break;
    	    } else
    	    {
    		++n;
    	    }
    	}
        }
    

LCT - Number of Local Variables Declared Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the number of local variables of storage class auto, register, or static declared in a function. These are variables that have no linkage. The function below has an LCT value of 2.

Example

        int other_result;
        extern int result;
    
        int test()
        {
    	int x;                                  /* 1 */
    	int y;                                  /* 2 */
    
    	return (x + y + other_result);
        }
    

LIN - Number of Code Lines Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the total number of lines, including blank and comment lines, in a function definition between (but excluding) the opening and closing brace of the function body. It is computed on raw code. LIN is undefined for functions which have #include'd code or macros which include braces in their definition.

The function below has an LIN value of 5.

Example

        int fn()
        {
    	int x;                  /* 1 */
    	int y;                  /* 2 */
    				/* 3 */
    	return (x + y);         /* 4 */
    	/* Comment Here */      /* 5 */
        }
    

Long functions are difficult to read, as they do not fit on one screen or one listing page. An upper limit of 200 is recommended.

LOP - Number of Logical Operators Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the total number of logical operators (&&, ||) in the conditions of do-while, for, if, switch, or while statements in a function. The example function below has a LOP value of 2.

Example

        void fn( int n, int array[], int key )
        {
    	while (( array[n] != key ) && ( n > 0 ))
    	{
    	    if (( array[n] == 999) || ( array[n] == 1000 ))
    	    {
    		break;
    	    } else
    	    {
    		++n;
    	    }
    	}
        }
    

M07 - Essential Cyclomatic Complexity Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

The essential cyclomatic complexity is obtained in the same way as the cyclomatic complexity but is based on a 'reduced' control flow graph. The purpose of reducing a graph is to check that the component complies with the rules of structured programming.

A control graph that can be reduced to a graph whose cyclomatic complexity is 1 is said to be structured. Otherwise reduction will show elements of the control graph which do not comply with the rules of structured programming.

The principle of control graph reduction is to simplify the most deeply nested control subgraphs into a single reduced subgraph. A subgraph is a sequence of nodes on the control flow graph which has only one entry and exit point. Four cases are identified by McCabe[1] which result in an unstructured control graph. These are:

  • a branch into a decision structure,
  • a branch from inside a decision structure,
  • a branch into a loop structure,
  • a branch from inside a loop structure.

However, if a subgraph possesses multiple entry or exit points then it cannot be reduced. The use of multiple entry and exit points breaks the most fundamental rule of structured programming.

The example below has a M07 value of 4.

Example

        void g( int n, int pos, int force )  /* M07 = 4
    					    Cannot reduce control graph to
    					    Cyclomatic Complexity of 1 */
        {
    	int nlines = 0;
    
    	while ( --n >= 0 )
    	{
    	    pos = back_line( pos );
    	    if ( pos == 0 )
    	    {
    		if ( ! force )
    		{
    		    break;
    		}
    		++nlines;
    	    }
    	}
        }
    

[1] McCabe, T. J. (1976) A Complexity Measure, IEEE Transactions on Software Engineering, SE-2, pp. 308-320.

M19 - Number of Exit Points Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a measure of the number of exit points in a software component and is calculated by counting the number of return statements. A function that has no return statements will have an M19 value of zero even though it will exit when falling through the last statement. This is regardless of whether the function is declared to have a return value or not (i.e. returns void). Calls to non-returning functions such as exit() or abort() are ignored by this metric.

The example below has an M19 value of 3.

Example

        void f( int a )
        {
    	return;             /* 1 */
    	if ( a )
    	    return;         /* 2 */
    	a++;
    	return;             /* 3 */
        }
    

M29 - Number of Functions Calling this Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is defined as the number of functions calling the designated function. The number of calls to a function is an indicator of criticality. The more a function is called, the more critical it is and, therefore, the more reliable it should be.

MCC - Myer's Interval Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is an extension to the cyclomatic complexity metric. It is expressed as a pair of numbers, conventionally separated by a colon. Myer's Interval is defined as CYC : CYC + L

Cyclomatic complexity (CYC) is a measure of the number of decisions in the control flow of a function. L is the value of the QAC LOP metric which is a measure of the number of logical operators (&&, ||) in the conditional expressions of a function. A high value of L indicates that there are many compound decisions, which makes the code more difficult to understand. A Myer's interval of 10 is considered very high.

The example below has a MCC value of 3:4 because the cyclomatic complexity is 3 and there is one connective (&&) used in the conditions.

Example

        int divide( int x, int y)
        {
    	if (y != 0)                     /* Condition 1 */
    	{
    	    return x / y;
    	} else if (x == 0 && y > 2)     /* Condition 2 */
    					/* Conditional expr 1 */
    	{
    	    return 1;
    	} else
    	{
    	    printf( "div by zero\n");
    	    return 0;
    	}
        }
    

Note:

In the calculation of MCC, the ternary operator (?:) is ignored.

When exporting metric values or displaying in the Metrics Browser, rather than attempting to display a value pair, the value of L is chosen for MCC.

MIF - Deepest Level of Nesting Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a measure of the maximum control flow nesting in your source code.

You can reduce the value of this metric by turning your nesting into separate functions. This will improve the readability of the code by reducing both the nesting and the average cyclomatic complexity per function.

The code example below has an MIF value of 3.

Example

        int divide( int x, int y)
        {
    	if (y != 0)                         /* 1 */
    	{
    	    return (x/y);
    	} else if (x == 0)                  /* 2 */
    	{
    	    return 1;
    	} else
    	{
    	    printf( "Divide by zero\n");
    	    while (x > 1)                   /* 3 */
    		printf( "x = %i", x);
    	    return 0;
    	}
        }
    

MIF is incremented in switch, do, while, if and for statements. The nesting level of code is not always visually apparent from the indentation of the code. In particular, an else if construct increases the level of nesting in the control flow structure but is conventionally written without additional indentation.

MIF is one of the three standard metrics used by QAC for demographic analysis.

PAR - Number of Function Parameters Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric counts the number of declared parameters in the function argument list. Note that ellipsis parameters are ignored.

PBG - Residual Bugs (PTH-based est.) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

Hopkins, in Hatton & Hopkins[1] investigated software with a known audit history and observed a correlation between Static Path Count (PTH) and the number of bugs that had been found. This relationship is expressed as PBG.

PBG = log10 ( PTH )

[1] Hatton, L., Hopkins, T.R., (1989) Experiences With Flint, a Software Metrication Tool for Fortran 77, Symposium on Software Tools, Napier Polytechnic, Edinburgh, Scotland.

PDN - Path Density Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is a measure of the number of paths relative to the number of executable lines of code.

PDN = PTH / XLN
PDN is computed as zero when XLN is zero.

PTH - Estimated Static Program Paths Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is similar to Nejmeh's[1] NPATH statistic and gives an upper bound on the number of possible paths in the control flow of a function. It is the number of non-cyclic execution paths in a function.

The NPATH value for a sequence of statements at the same nesting level is the product of the NPATH values for each statement and for the nested structures. NPATH is the product of:

  • NPATH( sequence of non control statements ) = 1
  • NPATH(if) = NPATH(body of then) + NPATH( body of else)
  • NPATH(while) = NPATH( body of while) + 1
  • NPATH(do while) = NPATH(body of while) + 1
  • NPATH(for) = NPATH(body of for) + 1
  • NPATH(switch) = Sum( NPATH(body of case 1) ... NPATH(body of case n) )

Note:

else and default are counted whether they are present or not.

In switch statements, multiple case options on the same branch of the switch statement body are counted once for each independent branch only. For example:

Example

        switch( n )
        {
        case 0:
    	break;          /* NPATH of this branch is 1                */
        case 1:
        case 2:
    	break;          /* NPATH for case 1 &amp; case 2 combined is 1  */
        default:
    	break;          /* NPATH for this default is 1              */
        }
    

Since NPATH cannot be reliably computed if there are goto statements in the function, they are ignored by QAC for the purposes of calculating NPATH.

The following code example has a static path count of 26.

Example

        int n;
        if ( n )
        {
        } /* block 1, paths 1 */
        else if ( n )
        {
    	if ( n )
    	{
    	} /* block 2, paths 1 */
    
    	else
    	{
    	} /* block 3, paths 1 */
    
    	/* block 4, paths block2+block3 = 2 */
    
    	switch ( n )
    	{
    	case 1 : break;
    	case 2 : break;
    	case 3 : break;
    	case 4 : break;
    	default: break;
    	} /* block 5, paths = 5 */
    
        } /* block 6, paths block4*block5 = 10 */
        else
        {
    	if ( n )
    	{
    	} /* block 7, paths 1 */
    
    	else
    	{
    	} /* block 8, paths 1 */
        } /* block 9, paths block7+block8 = 2 */
        /* block 10, paths block1+block6+block9 = 13 */
    
        if ( n )
        {
        } /* block 11, paths 1 */
    
        else
        {
        } /* block 12, paths 1 */
        /* block 13, paths block11+block12 = 2 */
    
        /* outer block, paths block10*block13 = 26 */
    

Each condition is treated as disjoint. In other words, no conclusions are drawn about a condition that is tested more than once.

The true path count through a function usually obeys the inequality:

cyclomatic complexity <= true path count <= static path count

Static path count is one of the three standard metrics used by QAC for demographic analysis.

[1] Nejmeh, B.A. (1988), NPATH: A Measure of Execution Path Complexity and its Applications, Comm ACM, 31, (2), p. 188-200.

RET - Number of Return Points in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

RET is the count of the reachable return statements in the function, plus one if there exists a reachable implicit return at the } that terminates the function.

The following example shows an implicit return:

Example

        void foo( int x, int y )
        {
    	printf( "x=%d, y=%d\n", x, y );
    	/* Here with implicit return. Hence RET = 1*/
        }
    

Structured Programming requires that every function should have exactly one entry and one exit. This is indicated by a RET value of 1. RET is useful when the programmer wants to concentrate on the functions that do not follow the Structured Programming paradigm. For example, those with switch statements with returns in many or every branch.

ST1 - Number of Statements in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

ST2 - Number of Statements in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

ST3 - Number of Statements in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

STx - Number of Statements in Function Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metrics

These metrics count the number of statements in the function body. There are 3 variants on the metric:

ST1 is the base definition and counts all statements tabulated below.
ST2 is ST1 except block, empty statements and labels are not counted.
ST3 is ST2 except declarations are not counted.

The following chart shows the statements counted by the STST metrics:

Statement KindST1ST2ST3
blockyesignoreignore
simple statement followed by ;yesyesyes
empty statementyesignoreignore
declaration statementyesyesignore
labelyesignoreignore
breakyesyesyes
continueyesyesyes
doyesyesyes
foryesyesyes
gotoyesyesyes
ifyesyesyes
returnyesyesyes
switchyesyesyes
whileyesyesyes

The following example shows statements counted by ST1, which for this function yields a value of 10:

Example

        void stst( void )
        {
    	int i;          /* 1 */
        label_1:            /* 2 */
        label_2:            /* 3 */
    	switch ( 1 )    /* 4 */
    	{               /* 5 */
    	case 0:         /* 6 */
    	case 1:         /* 7 */
    	case 2:         /* 8 */
    	default:        /* 9 */
    	    break;      /* 10 */
    	}
        }
    

This metric indicates the maintainability of the function. Number of statements also correlates with most of the metrics defined by Halstead. The greater the number of statements contained in a function, the greater the number of operands and operators, and hence the greater the effort required to understand the function. Functions with high statement counts should be limited. Restructuring into smaller sub-functions is often appropriate.

SUB - Number of Function Calls Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

The number of function calls within a function. Functions with a large number of function calls are more difficult to understand because their functionality is spread across several components. Note that the calculation of SUB is based on the number of function calls and not the number of distinct functions that are called, see CAL.

A large SUB value may be an indication of poor design; for example, a calling tree that spreads too rapidly.
See Brandl (1990)[1] for a discussion of design complexity and how it is highlighted by the shape of the calling tree.

The following code example has an SUB value of 4.

Example

        extern dothis(int);
        extern dothat(int);
        extern dotheother(int);
    
        void test()
        {
    	int a, b;
    	a = 1;
    	b = 0;
    
    	if (a == 1)
    	{
    	    dothis(a);                  /* 1 */
    	} else
    	{
    	    dothat(a);                  /* 2 */
    	}
    	if (b == 1)
    	{
    	    dothis(b);                  /* 3 */
    	} else
    	{
    	    dotheother(b);              /* 4 */
    	}
        }
    

[1] Brandl, D.L. (1990), Quality Measures in Design, ACM Sigsoft Software Engineering Notes, vol 15, 1.

[x] Halstead, Maurice H. (1977). Elements of Software Science.

UNR - Number of Unreachable Statements Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is the count of all statements within the function body that are guaranteed never to be executed. UNR uses the same method for identifying statements as metric ST1. Hence UNR counts the following as statements if unreachable.

Statement Kind Counted
block
simple statement followed by ;
empty statement
declaration statement
label
break
continue
do
for
goto
if
return
switch
while

Example yielding UNR = 4

Example

    void stunr( unsigned i )
    {
        if ( i >= 0 )
        {
    	if ( i >= 0 )
    	{
    	    while ( i >= 0 )
    		return;
    	} else
    	/* unreachable */
    	{
    	    while ( i >= 0 )
    		return;
    	}
        }
        return; /* unreachable */
    }
    

UNV - Unused or Non-Reused Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

An unused variable is one that has been defined but which is never referenced. A non-reused variable is a variable that has a value by assignment but which is never used subsequently.

Such variables are generally clutter and are often evidence of 'software ageing', which is the effect of a number of programmers making changes. The code below has an UNV value of 2.

Example

        int other_result;
        extern int result;
    
        int test()
        {
    	int y;                      /* Unused */
    	int z;
    
    	z = 1;                      /* Non-Reused */
    
    	return (result + other_result);
        }
    

XLN - Number of Executable Lines Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is a count of lines in a function body that have code tokens. Comments, braces, and all tokens of declarations are not treated as code tokens. The function below has an XLN value of 9.

Example

        void fn( int n )
        {
    	int x;
    	int y;
    
    	if ( x )                        /* 1 */
    	{
    	    x++;                        /* 2 */
    	    for (;;)                    /* 3 */
    		/* Ignore comments */
    		/* Ignore braces */
    	    {
    		switch ( n )            /* 4 */
    		{
    		    case 1 : break;     /* 5 */
    		    case 2 :            /* 6 */
    		    case 3 :            /* 7 */
    			break           /* 8 */
    				;       /* 9 */
    		}
    	    }
    	}
        }
    

This metric is used in the computation of the KDN and PDN metrics.

File-Based Metrics Bottom Doc. Button Top Document Button Down Section Button Up Section Button

BMO - Organic Programmer Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

BMS - Semi-detached Programmer Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

BME - Embedded Programmer Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metrics

The COCOMO metrics are produced for each source code file. You can display an estimate of development costs for a whole project by choosing the COCOMO Cost Model option from the Reports menu. See Chapter 6: Reports for a discussion of the COCOMO cost model and an explanation of the three programming modes: Organic, Semi-detached, and Embedded.

These metrics estimate the number of programmer-months required to create the source code in the respective environments.

BME = 3.6 * ( TPP / 1000 ) 1.20
BMO = 2.4 * ( TPP / 1000 ) 1.05
BMS = 3.0 * ( TPP / 1000 ) 1.12

BUG - Residual Bugs (token-based estimate) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

BUG = 0.001 * EFF2/3

This is an estimate of the number of bugs in the file, based on the number of estimated tokens. Its value would normally be lower than the sum of the function-based PBG values. For a more detailed discussion of software bug estimates, see Hatton and Hopkins,[1].

[1] Hatton, L., Hopkins, T.R., (1989) Experiences With Flint, a Software Metrication Tool for Fortran 77, Symposium on Software Tools, Napier Polytechnic, Edinburgh, Scotland.

CDN - Comment to Code Ratio Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is defined to be the number of visible characters in comments, divided by the number of visible characters outside comments. Comment delimiters are ignored. Whitespace characters in strings are treated as visible characters.

A large value of CDN indicates that there may be too many comments, which can make a module difficult to read. A small value indicates that there may not be enough comments, which can make a module difficult to understand.

The code below has 28 visible characters in comments and 33 visible characters in the code. The resulting CDN value is 0.85.

Example

        int test()
        /* This is a test */
        {
    	int x;
    	int y;
        /* This is another test */
    	return (x + y);
        }
    

The value of CDN is affected by how QAC counts the comments. QAC can count comments in three possible ways:

  • all comments, (a),
  • all comments except for those from headers, (n),
  • inline or internal comments (i). These are comments within functions and comments that annotate a line of code (comments that are on the same line as code at file scope).

DEV - Estimated Development (programmer-days) Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is an estimate of the number of programmer days required to develop the source file. Unlike COCOMO statistics, which are based solely on the number of lines of code, this estimate is derived from the file's difficulty factor. It is a more accurate measure of the development time, especially after the scaling factor has been adjusted for a particular software environment.

DEV = EFF / dev_scaling

where dev_scaling is a scaling factor defined in qac.cfg. The default is 6000.

DIF - Program Difficulty Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is a measure of the difficulty of a translation unit. An average C program has a difficulty of around 12. Anything significantly above this has a rich vocabulary and is potentially difficult to understand.

DIF = VOL / ( (2 + VAR) * log2 (2 + VAR) )

ECT - Number of External Variables Declared Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is a measure of the number of data objects (not including functions) declared with external linkage. It is an indication of the amount of global data being passed between modules. It is always desirable to reduce dependence on global data to a minimum.

Example

        extern int result;
        int other_result;
    
        main()
        {
    	result = 20 + 30;
    	other_result = result * 2;
        }
    

The above code sample has an ECT value of 2.

EFF - Programmer Effort Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a measure of the programmer effort involved in the production of a translation unit. It is used to produce a development time estimate.

EFF = VOL * DIF

FNC - Number of Functions in File Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a count of the number of function definitions in the file.

FCO - Estimated Function Coupling Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

See Brandl[1]. Since the actual value of Brandl's metric requires a full, well-structured calling tree, FCO can only be an estimate. A high figure indicates a large change of complexity between levels of the calling tree. The metric is computed from FNC and the SUB values of the component functions in the translation unit:

FCO = ∑(SUB) - FNC + 1

The code example below has an FCO value of 1 (2 - 2 + 1).

Example

        BOOL isActive(CHANNEL c);
    
        BOOL okToRead(TEXTCHANNEL c)
        {
    	return !isActive(c);
        }
    
        BOOL okToPrint(PRINTCHANNEL c)
        {
    	return !isActive(c);
        }
    

[1] Brandl, D.L. (1990), Quality Measures in Design, ACM Sigsoft Software Engineering Notes, vol 15, 1.

HAL - Halstead Prediction of TOT Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric and also ZIP are predictions derived from the vocabulary analysis metrics OPN and OPT of what the value of TOT should be. If they differ from TOT by more than a factor of 2, it is an indication of an unusual vocabulary. This usually means that either the source code contains sections of rather repetitive code or it has an unusually rich vocabulary. The two metrics are computed as follows:

ZIP = ( OPN + OPT ) * ( 0.5772 + ln (OPN + OPT) )
HAL = OPT * log2 ( OPT ) + OPN * log2 ( OPN )

M20 - Number of Operand Occurrences Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is the number of operands in a software component and is one of the Halstead vocabulary analysis metrics. Halstead considered that a component is a series of tokens that can be defined as either operators or operands.

Unlike OPN, this metric is the count of every instance of an operand in a file, regardless of whether or not it is distinct. OPN only counts the operands that are distinct. The code example below has a M20 value of 8.

Example

        void f( int a )             /* 1,2 -> f, a  */
        {
    	if ( a > 1 )            /* 3,4 -> a, 1  */
    	{
    	    ++a;                /* 5 -> a       */
    	    while ( a > 1 )     /* 6,7 -> a, 1  */
    	    {
    		--a;            /* 8 -> a       */
    	    }
    	}
        }
    

[x] Halstead, Maurice H. (1977). Elements of Software Science.

M21 - Number of Operator Occurrences Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is the number of operators in a software component and is one of the Halstead vocabulary analysis metrics. Halstead considered that a component is a series of tokens that can be defined as either operators or

operands.

Unlike OPT, this metric is the count of every instance of an operator in a file, regardless of whether or not it is distinct. OPT only counts the operators that are distinct. The code example below has a M21 value of 22.

Example

        void f( int a )             /* 1,2,3,4 -> void, (, int, )       */
        {                           /* 5 -> {                           */
    	if ( a > 1)             /* 6,7,8,9 -> if, (, >, )           */
    	{                       /* 10 ->{                           */
    	    ++a;                /* 11,12 -> ++, ;                   */
    	    while (a > 1)       /* 13,14,15,16 -> while, (, >, )    */
    	    {                   /* 17 -> {                          */
    		--a;            /* 18,19 -> --, ;                   */
    	    }                   /* 20 -> }                          */
    	}                       /* 21 -> }                          */
        }                           /* 22 -> }                          */
    

[x] Halstead, Maurice H. (1977). Elements of Software Science.

M22 - Number of Statements Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is the number of statements in a software component. This is a count of semicolons in a file except for the following instances:

  • within for expressions,
  • within struct or union declarations/definitions,
  • within comments,
  • within literals,
  • within preprocessor directives,
  • within old-style C function parameter lists.

The code example below has a M22 value of 5.

Example

        void f( int a )
        {
    	struct { int i;
    		 int j; }
    	    ij;                 /* 1    */
    	a = 1;                  /* 2    */
    	a = 1; a = 2;           /* 3,4  */
    	if
    	    ( a >
    		    1 )
    	{
    	    return;             /* 5    */
    	}
        }
    

M28 - Number of Non-Header Comments Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a count of the occurrences of C or C++ style comments in a source file except for those that are within the header of a file. A file header is defined as tokens preceding the first code token or preprocessor directive token.

M28 is based on the method used to compute CDN but differs from CDN in that CDN counts the visible characters within comments, whereas M28 counts the occurrences of comments. The code example below has a M28 value of 2.

Example

        /* Header comment 1             Count = 0 */
        /* Header comment 2             Count = 0 */
    
        /* Last header comment          Count = 0
           code follows */
    
        #define CENT 100
    
        /* Non header comment           Count = 1 */
        void f( int a )
        {
    	/* Block scope comment      Count = 2 */
    	a = CENT;
    	return;
        }
    

M33 - Number of Internal Comments Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is a count of C style or C++ comments in a source file that are within functions or annotate a line of code at file scope. Comments within functions are all comments at block scope. Comments that annotate code are ones that start or end on the same line as code.

M33 is based on the method used to compute CDN but differs from CDN in that CDN counts the visible characters within comments, whereas M33 counts the occurrences of comments. The code example below has a M33 value of 5.

Example

        /* Header comment 1         Count = 0 */
        /* Header comment 2         Count = 0 */
    
        /* Last header comment      Count = 0
           code follows */
    
        #define CENT 100    /* Annotating comment   M33 = 1 */
    
        int                 /* Annotating comment   M33 = 2 */
    	i;
        /* Annotating comment M33 = 3 */ int j; /*
           Annotating comment M33 = 4 */
        /* Non internal comment                     M33 = 0 */
        void f( int a )
        {
    	/* Block scope comment                  M33 = 5 */
    	a = CENT;
    	return;
        }
    

OPN - Number of Distinct Operands Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This is the number of distinct operands used in the file. Distinct operands are defined as unique identifiers and each occurrence of a literal.

Most literals, except 0 and 1, are usually distinct within a program. Since macros are usually used for fixed success and failure values (such as TRUE and FALSE), the differences in counting strategies are fairly minimal. The code below has an OPN value of 11.

Example

        extern int result;              /* 1 -> result */
        static int other_result;        /* 2 -> other_result */
    
        main()                          /* 3 -> main */
        {
    	int x;                      /* 4 -> x */
    	int y;                      /* 5 -> y */
    	int z;                      /* 6 -> z */
    
    	x = 45;                     /* 7 -> 45 */
    	y = 45;                     /* 8 -> 45 */
    	z = 1;                      /* 9 -> 1 */
    	result = 1;                 /* 10 -> 1 */
    	other_result = 0;           /* 11 -> 0 */
    
    	return (x + other_result);
        }
    

OPT - Number of Distinct Operators Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This covers any source code tokens not supplied by the user, such as keywords, operators, and punctuation. OPT is used in the calculation of a number of other metrics.

The code below has an OPT value of 11.

Example

        extern int result;              /* 1,2,3 -> extern, int, ; */
        static int other_result;        /* 4 -> static */
    
        main()                          /* 5,6 -> ()*/
        {                               /* 7 -> { */
    	int x;
    	int y;
    	int z;
    
    	x = 45;                     /* 8 -> = */
    	y = 45;
    	z = 1;
    	result = 1;
    	other_result = 0;
    
    	return (x + other_result);  /* 9,10 -> return, + */
        }                               /* 11 -> } */
    

SCT - Number of Static Variables Declared Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Function-Based Metric

This metric is computed as the number of variables and functions declared static at file scope. The code example below has an SCT value of 2.

Example

        static int other_result;                /* 1 */
        int result;
    
        static int test()                       /* 2 */
        {
    	int x;
    	int y;
    	int z;
    
    	z = 1;
    
    	return (x + other_result);
        }
    

SHN - Shannon Information Content Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

Also known as the "entropy" H, this metric is a widely recognized algorithm for estimating the program space required to encode the functions in a source file. SHN is measured in bits and is calculated as follows:

SHN = ZIP * log2 (√(OPN + OPT) + ln (OPN + OPT))

TDE - Embedded Total Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

TDO - Organic Total Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

TDS - Semi-detached Total Months Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metrics

The COCOMO metrics are produced for each source code file. You can display an accurate estimate of development costs for a whole project by choosing the COCOMO Cost Model option from the Reports menu. Refer to Chapter 6: Reports for a discussion of the COCOMO cost model and an explanation of the three programming modes: Organic, Semi-detached, and Embedded.

These metrics are a measure of elapsed time in months required to develop the source code in the respective environments.

TDE = 2.5 * BME 0.32
TDO = 2.5 * BMO 0.38
TDS = 2.5 * BMS 0.35

TLN - Total Preprocessed Code Lines Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This metric is a count of the total number of source lines in the file after pre-processing. The pre-processed file will reflect the processing of include files, pre-processor directives and the stripping of comment lines.
Empty lines are not counted.

See also TPP

TOT - Total Number of Tokens Used Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This metric is the total number of tokens, not distinct tokens, in the source file. The code example below has an TOT value of 19.

Example

        int test()                  /* 1,2,3,4 */
        {                           /* 5 */
    	int x;                  /* 6,7,8
    	int y;                  /* 9,10,11 */
    	/*Excluded Comment*/
    	return (x + y);         /* 12,13,14,15,16,17,18 */
        }                           /* 19 */
    

TPP - Total Unpreprocessed Code Lines Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This metric is a count of the total number of source lines in the file before pre-processing.

See also TLN

VAR - Total Number of Variables Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

The metric represents the total number of distinct identifiers. The code below has an VAR value of 5.

Example

        int other_result;           /* 1 */
        extern int result;          /* 2 */
    
        int test()                  /* 3 */
        {
    	int x;                  /* 4 */
    	int y;                  /* 5 */
    
    	return (x + y + other_result);
        }
    

VOL - Program Volume Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This is a measure of the number of bits required for a uniform binary encoding of the program text. It is used to calculate various Halstead vocabulary metrics.

The following is the calculation for the program volume:

VOL = TOT * log 2 ( OPN + OPT )

[x] Halstead, Maurice H. (1977). Elements of Software Science.

ZIP - Zipf Prediction of TOT Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

ZIP = ( OPN + OPT ) * ( 0.5772 + ln (OPN + OPT) )

See HAL.

CCA - Total Number of Characters Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This metric is the total number of characters in the file. Only visible characters are counted, except in string or character literals, in which case all characters are counted and tabs are treated as one character. When counting comment characters, the comment delimiter characters are counted.

CCB - Total Number of Code Characters Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

File-Based Metric

This metric is the total number of code characters in the file. Only visible characters are counted, except in string or character literals, in which case all characters are counted and tabs are treated as one character. Characters comprising comments are not counted, this includes the comment delimiter characters.

CCC - Total Number of Comment Characters Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

File-Based Metric

This metric is the total number of visible comment characters in the file. The comment delimiter characters are not counted.

Class-Based Metrics Bottom Doc. Button Top Document Button Down Section Button Up Section Button

CBO - Coupling between objects Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Class-Based Metric

This is a count of the number of methods (member functions) or member objects of other classes accessed by a class. Only classes outside the inheritance hierarchy are considered because you would expect interaction with base and derived classes. Coupling to classes outside the inheritance tree should be viewed with suspicion as it makes the class less independent and less re-usable. This is one of Chidamber & Kemerer's[1] suite of object oriented metrics.

[1] Chidamber, S.R. and Kemerer, C.F. (1991). Towards a Metrics Suite for Object Oriented Design, Proceedings of OOPSLA, '91, Sigplan notices, vol.26, no. 11, ACM Press.

DIT - Deepest level of inheritance Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

This represents the number of derivations from the furthest base class down to this class. A high figure may indicate that the class depends on accumulated functionality, which makes understanding the class potentially difficult. This is one of the metrics defined by Chidamber & Kemerer.

LCM - Lack of cohesion of methods within a class Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

Methods within a class are partitioned into sets that access independent sets of member objects. The LCM metric is a count of sets of unrelated members for a type.

For example (default):

Example

        class cohesive
        {
        private:
    	int i1;
    	int i2;
    	int i3;
        public:
    	void m1(int a) { i1 = a + i2; }
    	void m2(int a) { i2 = a; }
    	void m3(int a) { if (a > i3) ++i3; }
        };
    

This above code sample has a LCM value of 2 because methods m1 and m2 access the set of member objects i1 and i2. Method m3 accesses only i3 and can be viewed as independent of m1 and m2. (m3 is not cohesive with the other two methods).

Similarly, where one method calls another, the set used for inclusion in LCM is the union of the sets from each method.

Variations of the calculation of LCM may explicitly exclude constructors, so the default behavior of CMA is that constructors are excluded when calculating this metric. To include constructors, enable the configuration option "-ProdOption LCM::include_constructor".

If constructors are included, and the constructor for such a type initializes all the members, then the value of LCM is guaranteed to be '1'.

This is one of the metrics defined by Chidamber & Kemerer.

MTH - Number of methods declared in class Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

The number of methods declared within a class. This does not include methods declared in base classes. Classes with a large number of methods will be difficult to understand.

NOC - Number of immediate children Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

This is the number of classes for which this class is an immediate base class. A high figure for this metric indicates greater dependence on the functionality of this class, and more potential knock-on effects from changes to it. This is one of the metrics defined by Chidamber & Kemerer.

NOP - Number of immediate parents Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

This metric indicates the number of inheritances for a class. Root base classes have a value of 0 while classes derived with a single inheritance have a value of 1. Classes that have multiple inheritance are prohibited by some programming standards.

RFC - Response for class Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Class-Based Metric

This indicates how functions can potentially be called directly from the class. The response set is calculated as the number of distinct class methods and functions called from the definitions of those methods. This is one of the metrics defined by Chidamber & Kemerer.

WMC - Weighted methods per class Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Class-Based Metric

This is the sum of cyclomatic complexities (See Cyclomatic complexity (CYC) in Function-Based Metrics section of this document) for all the methods in the class. In the same way that cyclomatic complexity gives an indication of the amount of testing required for an individual function, this metric gives an indication of the amount of testing required for a whole class. This is one of the metrics defined by Chidamber & Kemerer.

Project-Wide Metrics Bottom Doc. Button Top Document Button Down Section Button Up Section Button

NRA - Number of Recursions Across Project Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Project-Wide Metric

This metric is defined to be the number of recursive paths in the call graph of the project's functions. A recursive path can be for one or more functions. The minimum, and often desirable, value of this metric is zero. Values greater than zero indicate the number of distinct loops in the call graph.

NEA - Number of Entry points Across Project Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Project-Wide Metric

This metric is the number of functions that are not called in the project. It is the number of nodes in the call graph which are not themselves called. For example, main() is not called; hence the minimum (build) value of 1.

NFA - Number of Functions Across Project Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

Project-Wide Metric

This metric is the number of function definitions in the project. Note that this metric is the sum of QAC's FNC metric values for each source file included in the project.

CYA - Cyclomatic Complexity Across Project Bottom Doc. Button Top Document Button Down Section Button Up Section Button Blank Up Chapter Button

Project-Wide Metric

This metric is the sum of cyclomatic complexity values for each function definition in the project. Note that this metric is the sum of QAC CYC metric values for each source file included in the project.

General Bottom Doc. Button Top Document Button Down Section Button Up Section Button

The Components of Function Structure Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Blank

Function structure diagrams show the control flow structures within source code. Decisions (if, switch, and the condition part of a loop) are displayed as forks in the structure. The corresponding join, further to the right, indicates where the paths rejoin. Backward arcs, caused by loops, are shown as dotted lines.

The function structure diagrams show the following code structures:

  • straight code
  • if
  • if else
  • switch
  • while loop
  • for loop
  • nested structures
  • break in a loop
  • return in a loop
  • continue in a loop
  • unreachable code

Each component progresses from the left to the right as the control flow would progress through the source code.

Straight code Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
    static int code = 0;
    
        void funcStraight( void)
        {
    	code = 1;
        }
    

There is only one path through this particular function, which is represented as lying along the x-axis.

If Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
    
        void funcIf( void)
        {
    	if (code > 0)
    	{
    	    code = 1;
    	}
        }
    

This function has two paths. The first path is through the if statement and is shown by the raised line. The second path is where the if condition is false and is represented by the x-axis.

If-Else Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
    
        void funcIfElse( void)
        {
    	if (code > 0)
    	{
    	    code = 3;
    	} else
    	{
    	    code = 4;
    	}
        }
    

This function has two execution paths. The first path is the if sub-statement represented by the raised line. The second path is the else sub-statement represented by the x-axis.

Note that the body of this structure is longer than the body of the if statement. If the two arms of the if-else were not straight line code, the body of the if branch would appear at the left hand end of the raised line and the body of the else branch would appear to the right of the lower line.

Switch Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

        static int code = 0;
    
        void funcSwitch( void)
        {
    	switch (code)
    	{
    	case 1:
    	    if (code == 1)
    	    {
    		/* block of code */
    	    }
    	    break;
    	case 2:
    	    break;
    	case 3:
    	    if (code == 3)
    	    {
    		/* block of code */
    	    }
    	    break;
    	default:
    	    break;
    	}
        }
    

In the switch statement, the x-axis represents the default action, and each case statement is shown by a raised line. The two briefly raised lines represent the if statements within case 1 and case 3.

The diagram shows how the if statements are staggered. The if of case 1 is shown on the left and the if of case 3 is shown on the right.

While loop Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
    
        void funcWhile( void)
        {
    	while (code > 0)
    	{
    	    --code;
    	}
        }
    

In the while loop, the x-axis represents the path straight through the function as though the while loop had not been executed. The solid raised line shows the path of the while body. The dotted line shows the loop to the beginning of the while statement.

For loop Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
        void doSomethingWith(int);
    
        void funcFor( void)
        {
    	int i;
    	for (i = 0; i > code; ++i)
    	{
    	    doSomethingWith( i);
    	}
        }
    

The for loop is similar to the while loop as for loops can be rewritten as while loops. For example, funcFor in the above example could be written as:

    
        void funcFor( void)
        {
    	int i = 0;
    	while (i > code)
    	{
    	    /* body */
    	    ++i;
    	}
        }
    

Nested Structures Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
    
        void funcWhileIfElse( void)
        {
    	while (code > 0)
    	{
    	    if (code == 1)
    	    {
    		code = 0;
    	    } else
    	    {
    		code--;
    	    }
    	}
        }
    

This is an if-else contained within a while loop. The first solid raised line represents the while loop while the inner raised solid line represents the if-else loop. Other function structure components can be similarly nested.

Break in a loop Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
    
        void funcWhileIfBreak( void)
        {
    	while (code > 0)
    	{
    	    if (code == 3)
    	    {
    		break;
    	    }
    	    code--;
    	}
    	if (code == 0)
    	{
    	    code++;
    	}
        }
    

The break jumps to the end of the while statement and causes a knot. A knot is where the control flow crosses the boundary of another statement block and indicates unstructured code. In this case, break jumps to the end of the while statement and the next part of the program, the if statement, is executed.

Return in a loop Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
    
        void funcWhileIfReturn( void)
        {
    	while (code > 0)
    	{
    	    if (code == 3)
    	    {
    		return;
    	    }
    	    code--;
    	}
    	if (code == 0)
    	{
    	    code++;
    	}
        }
    

The return statement causes the program to jump to the end of the function. This jump breaks the control flow and causes a knot in the code.

Continue in a loop Bottom Doc. Button Top Document Button Down Section Button Up Section Button Down Chapter Button Up Chapter Button

    
        static int code = 0;
        void funcWhileIfContinue( void)
        {
    	while (code > 0)
    	{
    	    if (code == 3)
    	    {
    		continue;
    	    }
    	    code--;
    	}
    	if (code == 0)
    	{
    	    code++;
    	}
        }
    

The continue statement causes the program to jump back to the beginning of the while loop.

Unreachable code Bottom Doc. Button Top Document Button Blank Up Section Button Blank Up Chapter Button

    
        static void funcUnReach( int i)
        {
    	if (i)
    	{
    	    i = 1;
    	}
    
    	goto Bad;
    
    	if (i)
    	{
    	    i = 2;
    	}
    
        Bad:
    	if (i)
    	{
    	    i = 3;
    	}
    
    	return;
        }
    

The raised red section represents code that is unreachable.

The structure and approximate position of the unreachable code is shown. It occurs after the first if condition and before the last if condition. Its position above the main structure shows that the control flow misses the middle if condition.


metrics.html
 All Manual Pages