Define __RGBDS_VERSION__ as the output of rgbasm --version (sans "rgbasm")

Fixes #824
This commit is contained in:
Rangi
2021-04-09 12:08:11 -04:00
committed by Eldred Habert
parent de7d1facf3
commit bcb78f5d18
3 changed files with 4 additions and 0 deletions

View File

@@ -1272,6 +1272,7 @@ The following symbols are defined by the assembler:
.It Dv __RGBDS_MINOR__ Ta Ic EQU Ta Minor version number of RGBDS .It Dv __RGBDS_MINOR__ Ta Ic EQU Ta Minor version number of RGBDS
.It Dv __RGBDS_PATCH__ Ta Ic EQU Ta Patch version number of RGBDS .It Dv __RGBDS_PATCH__ Ta Ic EQU Ta Patch version number of RGBDS
.It Dv __RGBDS_RC__ Ta Ic EQU Ta Release candidate ID of RGBDS, not defined for final releases .It Dv __RGBDS_RC__ Ta Ic EQU Ta Release candidate ID of RGBDS, not defined for final releases
.It Dv __RGBDS_VERSION__ Ta Ic EQUS Ta Version of RGBDS, as printed by Ql rgbasm --version
.El .El
.Pp .Pp
The current time values will be taken from the The current time values will be taken from the

View File

@@ -774,6 +774,7 @@ void sym_Init(time_t now)
addString("__UTC_HOUR__", removeLeadingZeros(savedHOUR)); addString("__UTC_HOUR__", removeLeadingZeros(savedHOUR));
addString("__UTC_MINUTE__", removeLeadingZeros(savedMINUTE)); addString("__UTC_MINUTE__", removeLeadingZeros(savedMINUTE));
addString("__UTC_SECOND__", removeLeadingZeros(savedSECOND)); addString("__UTC_SECOND__", removeLeadingZeros(savedSECOND));
addString("__RGBDS_VERSION__", get_package_version_string());
#undef addString #undef addString
labelScope = NULL; labelScope = NULL;

View File

@@ -38,12 +38,14 @@ tryCmp () {
# Add the version constants test, outputting the closest tag to the HEAD # Add the version constants test, outputting the closest tag to the HEAD
if git describe --tags --abbrev=0 > version.out; then if git describe --tags --abbrev=0 > version.out; then
$RGBASM --version >> version.out
cat > version.asm <<EOF cat > version.asm <<EOF
IF !DEF(__RGBDS_RC__) IF !DEF(__RGBDS_RC__)
PRINTLN "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}" PRINTLN "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}"
ELSE ELSE
PRINTLN "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}-rc{d:__RGBDS_RC__}" PRINTLN "v{d:__RGBDS_MAJOR__}.{d:__RGBDS_MINOR__}.{d:__RGBDS_PATCH__}-rc{d:__RGBDS_RC__}"
ENDC ENDC
PRINTLN "rgbasm {__RGBDS_VERSION__}"
EOF EOF
else else
echo "${bold}${orange}Warning: cannot run version test!${rescolors}${resbold}" echo "${bold}${orange}Warning: cannot run version test!${rescolors}${resbold}"