GBS Logo Generic Build Support (GBS) - User Manual HOME
The gbssub batch file

Purpose

The gbssub batch 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 gbssysgen, gbssysmake, gbssysaudit and for Cleanup functions in gbsmaint.

General

Special considerations:

Calling

The gbssub file is called:
When you build or audit a SubSystem with one of the gbssys.. commands:
With one of the arguments cleaunp_bld, gen, make, cleanup_aud or audit
When Cleanup a SubSystem with gbsmaint:
With one of the arguments cleaunp_bld or cleanup_aud

Environment Variables

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.

Layout

For every Non-GBS SubSystem type there is a slightly different gbssub file.
The 'switch' on action (cleaunp_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:

None

Example of a gbssub.bat:

@ECHO OFF
::=============================================================================
::  [%SUBSYS%] gbssub.bat
::	Requires 1 parameter: action
::	Called to cleanup, gen, make or audit a non-GBS SubSystem
::	For 'MSVS' (MicroSoft Visual Studio) SubSystems
::=============================================================================
::
::  Currently in $GBS_ROOT_PATH/dev/$GBS_SUBSYS
::  Applicable EnvVars:
::      GBS_TARGET
::      GBS_AUDIT (for Audit only)
::
::  Availabe EnvVars:
::      GBS_ROOT_PATH
::      GBS_SUBSYS
::      GBS_SUBSYS_PATH
::      GBS_AUDIT_PATH
::      GBS_BUILD_PATH
::      GBS_APP_PATH
::
::	GBS_MAKE		
::      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_      
::      GBS_SYSFLAGS_
::      GBS_FLAGS_
::      GBS_SYSINCS_
::      GBS_INCS_
::
::      GBS_MSBUILD_CONFIG	if MODE==DEBUG: Debug. If MODE==FINAL: release. Else: Empty
::
::=============================================================================
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)
::

cd app

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 GBSSUB_: ** SubSys=%GBS_SUBSYS% - Target=%GBS_TARGET% - 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:
    %GBSEXT_MSBUILD_PATH%\msbuild /m /property:Configuration=%GBS_MSBUILD_CONFIG% /target:Clean
    set rc=%ERRORLEVEL%
    goto CASE_END
:CASE_GEN
    ::
    ::	GEN
    ::
    echo GBSSUB_: ** SubSys=%GBS_SUBSYS% - Target=%GBS_TARGET% - 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:
    %GBSEXT_MSBUILD_PATH%\msbuild /m /property:Configuration=%GBS_MSBUILD_CONFIG%
    set rc=%ERRORLEVEL%
    goto CASE_END
:CASE_MAKE
    ::
    ::	MAKE
    ::
    echo GBSSUB_: ** SubSys=%GBS_SUBSYS% - Target=%GBS_TARGET% - 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:
    %GBSEXT_MSBUILD_PATH%\msbuild /m /property:Configuration=%GBS_MSBUILD_CONFIG%
    set rc=%ERRORLEVEL%
    goto CASE_END
:CASE_CLEANUP_AUD
    ::
    ::	CLEANUP_AUD
    ::
    echo GBSSUB_: ** SubSys=%GBS_SUBSYS% - Target=%GBS_TARGET% - 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:
    echo GBSSUB_: No audits for non-GBS SubSystems
    set rc=%ERRORLEVEL%
    goto CASE_END
:CASE_AUDIT
    ::
    ::	AUDIT
    ::
    echo GBSSUB_: ** SubSys=%GBS_SUBSYS% - Target=%GBS_TARGET% - 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:
    echo GBSSUB_: No audits for non-GBS SubSystems
    set rc=%ERRORLEVEL%
    goto CASE_END
:CASE_DEFAULT
    ::
    ::	DEFAULT
    ::
    echo GBSSUB_: ***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:::