GBS Logo HELP HOME Generic Build Support (GBS) - User Manual
The subsys.gbs script files 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
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