GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
Generating Code (Building) Bottom Doc. Button
Release RMC-06.02
(2024-04-29)


- Home
Getting Started
- Quick Start
- Release Notes
- Install Notes
- Create a GBS-WA/System
- FAQ
- Terms and Conditions (The Fine Print)
Basics
- Definitions & Acronyms
- Introduction
- Top Level Directory Structure
- Full Directory Structure
- Handling SubSystems & Steps
- Procedures
- Software Configuration Management Support

Manual Pages
- The Command-Line Interface
- All Commands
- The gbssys... Commands
- Generating Code (Building)
- Libraries & Executables and Testing
- Exporting Deliverables
- Auditing
- Customisations (Session)
- Customisations (User)
- Customisations (Admin)
- Integration with other Tools
- Plugins (Admin)
- Environment Variables (EnvVars)
User Files
- The GLKBT (glk/glb/glt) Files
Internal (.gbs) Files
- GBS Files - General
- audit.gbs
- broadcast.gbs
- build.gbs
- export.gbs
- flags_*.gbs
- subsys.gbs (.bat/.sh)
- incs_*.gbs
- owners.gbs
- sca_*.gbs
- scope.gbs
- site.gbs (.bat/.sh)
- steps.gbs
- switch.gbs (.bat/.sh)
- system.gbs
- tool.gbs
Various
- Development
- About
- Metrics Help

Full Documentation
- All Docs - Printable


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