diff --git a/Makefile b/Makefile index 531122c..1ba24c3 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ HOSTCC ?= cc # ---- common flags ---- -AMIGA_DATE ?= $(shell date '+%-d.%-m.%Y') +AMIGA_DATE ?= $(shell LC_ALL=C date '+%d.%m.%Y') ODFS_GIT_VERSION ?= $(shell desc=$$(git describe --tags --match "v*" --dirty --always 2>/dev/null || echo unknown); printf '%s\n' "$$desc" | grep -q '^v' && printf '%s' "$$desc" || printf 'early-0-g%s' "$$desc") ODFS_VERSION_MAJOR ?= $(or $(shell printf '%s\n' "$(ODFS_GIT_VERSION)" | sed -n 's/^v\([0-9][0-9]*\)\..*/\1/p'),0) ODFS_VERSION_MINOR ?= $(or $(shell printf '%s\n' "$(ODFS_GIT_VERSION)" | sed -n 's/^v[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/p'),0) diff --git a/platform/amiga/handler_main.c b/platform/amiga/handler_main.c index 4121cf5..a17e868 100644 --- a/platform/amiga/handler_main.c +++ b/platform/amiga/handler_main.c @@ -73,9 +73,14 @@ #define DMDF_REMOVEDEVICE (1L << 1) #endif +#define ODFS_STR_(x) #x +#define ODFS_STR(x) ODFS_STR_(x) + +/* Version reads the token after the name as . */ const char version_string[] __attribute__((used)) = - "$VER: ODFileSystem " ODFS_GIT_VERSION - " (" ODFS_AMIGA_DATE ")"; + "$VER: ODFileSystem " + ODFS_STR(ODFS_VERSION_MAJOR) "." ODFS_STR(ODFS_VERSION_MINOR) + " (" ODFS_AMIGA_DATE ") " ODFS_GIT_VERSION; #define VOLUME_PUBLISH_RETRY_MICROS 100000UL diff --git a/platform/amiga/resident.c b/platform/amiga/resident.c index e4ef205..dcab703 100644 --- a/platform/amiga/resident.c +++ b/platform/amiga/resident.c @@ -34,8 +34,8 @@ extern const char version_string[]; static const char name_string[] = "ODFileSystem"; -static const char creator_string[] = - "ODFileSystem " ODFS_GIT_VERSION " (" ODFS_AMIGA_DATE ")"; +/* the cookie without its "$VER: " prefix */ +#define ODFS_ID_STRING (&version_string[sizeof("$VER: ") - 1]) void entrypoint(void); static int rt_init(BPTR seglist asm("a0"), struct ExecBase *SysBase asm("a6")); @@ -49,7 +49,7 @@ static const struct Resident __attribute__((used,no_reorder)) romtag = { .rt_Type = NT_UNKNOWN, .rt_Pri = 10, .rt_Name = (APTR)&name_string, - .rt_IdString = (APTR)&version_string, + .rt_IdString = (APTR)ODFS_ID_STRING, .rt_Init = (APTR)rt_init }; @@ -81,7 +81,7 @@ static int rt_init(BPTR seglist asm("a0"), struct ExecBase *SysBase asm("a6")) { if (seglist == NULL) { seglist = MKBADDR((UBYTE *)entrypoint - 4); } - fse->fse_Node.ln_Name = (char *)creator_string; + fse->fse_Node.ln_Name = (char *)ODFS_ID_STRING; fse->fse_DosType = DOSTYPE; fse->fse_GlobalVec = -1; fse->fse_PatchFlags = 0x190;