From: David Griffith Date: Tue, 31 Jul 2018 09:58:38 +0000 (-0700) Subject: Get version string from Git instead of the Makefile. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=897cb4b2597f2d9f25d27cd70208058870e1970c;p=liskon_frotz.git Get version string from Git instead of the Makefile. If I need access to the major or minor portion of the version/tag string, I'll just add some C code where appropriate when the time comes. --- diff --git a/Makefile b/Makefile index 5b5062c..86974e7 100644 --- a/Makefile +++ b/Makefile @@ -98,12 +98,6 @@ export LIBDIR export COLOR -# Versioning -MAJOR=2 -MINOR=44 -VERSION = $(MAJOR).$(MINOR) - - # If we're working from git, we have access to proper variables. If # not, make it clear that we're working from a release. GIT_DIR ?= .git @@ -208,10 +202,7 @@ common_strings: $(COMMON_STRINGS) $(COMMON_STRINGS): @echo "** Generating $@" @echo "#include \"frotz.h\"" > $@ - @echo "const char frotz_version[] = \"$(VERSION)\";" >> $@ - @echo "const char frotz_v_major[] = \"$(MAJOR)\";" >> $@ - @echo "const char frotz_v_minor[] = \"$(MINOR)\";" >> $@ - @echo "const char frotz_v_build[] = \"$(BUILD_DATE_TIME)\";" >> $@ + @echo "const char build_timestamp[] = \"$(BUILD_DATE_TIME)\";" >> $@ common_defines: $(COMMON_DEFINES) $(COMMON_DEFINES): diff --git a/src/common/frotz.h b/src/common/frotz.h index 6883e28..4cfb05b 100644 --- a/src/common/frotz.h +++ b/src/common/frotz.h @@ -147,8 +147,7 @@ typedef struct { #define STACK_SIZE 1024 #endif -extern const char - frotz_version[], frotz_v_major[], frotz_v_minor[], frotz_v_build[]; +extern const char build_timestamp[]; /* Assorted filename extensions */ diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index 5b0f958..85f02c1 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -296,7 +296,7 @@ void os_process_arguments (int argc, char *argv[]) } while (c != EOF); if (zoptind != argc - 1) { - printf("FROTZ V%s\t", frotz_version); + printf("FROTZ V%s\t", GIT_TAG); #ifndef NO_SOUND printf("Audio output enabled."); @@ -1133,13 +1133,13 @@ error: static void print_version(void) { - printf("FROTZ V%s\t ", frotz_version); + printf("FROTZ V%s\t ", GIT_TAG); #ifndef NO_SOUND printf("Audio output enabled."); #else printf("Audio output disabled."); #endif - printf("\nBuild:\t\t %s\n", frotz_v_build); + printf("\nBuild:\t\t %s\n", build_timestamp); printf("Git commit:\t %s\n", GIT_HASH); printf("Git commit short: %s\n", GIT_HASH_SHORT); printf("Git tag:\t %s\n", GIT_TAG); diff --git a/src/dumb/dumb_init.c b/src/dumb/dumb_init.c index e1db6f9..995f85e 100644 --- a/src/dumb/dumb_init.c +++ b/src/dumb/dumb_init.c @@ -127,7 +127,7 @@ void os_process_arguments(int argc, char *argv[]) } while (c != EOF); if (((argc - zoptind) != 1) && ((argc - zoptind) != 2)) { - printf("FROTZ V%s\tDumb interface.\n", frotz_version); + printf("FROTZ V%s\tDumb interface.\n", GIT_TAG); puts(INFORMATION); printf("\t-Z # error checking mode (default = %d)\n" "\t %d = don't report errors %d = report first error\n" @@ -298,7 +298,7 @@ char *my_strdup(char *src) static void print_version(void) { - printf("FROTZ V%s\t", frotz_version); + printf("FROTZ V%s\t", GIT_TAG); printf("Dumb interface.\n"); printf("Git commit:\t%s\n", GIT_HASH); printf("Git tag:\t%s\n", GIT_TAG); diff --git a/src/sdl/sf_util.c b/src/sdl/sf_util.c index 6a6c056..2b8290b 100644 --- a/src/sdl/sf_util.c +++ b/src/sdl/sf_util.c @@ -146,7 +146,7 @@ static char *info2 = static void usage() { char **p = infos; int i=0,len=0; - printf(info1, frotz_version, frotz_v_build); + printf(info1, GIT_TAG, build_timestamp); while (*p) { if (i) diff --git a/src/sdl/sf_video.c b/src/sdl/sf_video.c index 65d3fa6..1a4b047 100644 --- a/src/sdl/sf_video.c +++ b/src/sdl/sf_video.c @@ -428,7 +428,7 @@ void sf_initvideo( int W, int H, int full) Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO; sprintf(banner, "SDL Frotz v%s - %s (z%d)", - frotz_version, f_setup.story_name, h_version); + GIT_TAG, f_setup.story_name, h_version); if ( SDL_Init(initflags) < 0 ) { os_fatal("Couldn't initialize SDL: %s", SDL_GetError());