Get version string from Git instead of the Makefile.
authorDavid Griffith <dave@661.org>
Tue, 31 Jul 2018 09:58:38 +0000 (02:58 -0700)
committerDavid Griffith <dave@661.org>
Wed, 1 Aug 2018 04:33:47 +0000 (21:33 -0700)
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.

Makefile
src/common/frotz.h
src/curses/ux_init.c
src/dumb/dumb_init.c
src/sdl/sf_util.c
src/sdl/sf_video.c

index 5b5062c97efae08d05f9ce5bcd30cb8a1587be64..86974e7150a408484d5054abc9a660675f01b4d6 100644 (file)
--- 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):
index 6883e289a28ade5d47041f37845d3b6bc1c1da20..4cfb05b514fbe148ccf42f2d192aab19d584cf17 100644 (file)
@@ -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 */
 
index 5b0f958f20c7fd5e777d2e96b4e171d5c03b1b8b..85f02c169c16aad0af607c4fe247a4cf728dd1d9 100644 (file)
@@ -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);
index e1db6f92b3094ac59678fe47977359388e06269d..995f85e86ed71d82eb9c09a00414ad4cc6d5ef02 100644 (file)
@@ -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);
index 6a6c056055f81a116ac60c07d65a821c483d0dac..2b8290b65e7c8b175e644787fd3e82b54eab15c3 100644 (file)
@@ -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)
index 65d3fa6171d47d0623af59dbfa77d3b175273230..1a4b047ffdf3ecd1f4b7346015f9354878bc89ae 100644 (file)
@@ -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());