Remove version.c and put build date back into git_hash.h.
authorDavid Griffith <dave@661.org>
Sat, 31 Aug 2019 00:45:56 +0000 (17:45 -0700)
committerDavid Griffith <dave@661.org>
Sat, 31 Aug 2019 00:47:49 +0000 (17:47 -0700)
I was never quite satisfied with the way I did version.c.  I seem to
recall someone telling me it was improper to put the build date into
git_hash.h.  After a couple months of this, I looked again and realized
that I picked an irritating solution -- Frotz will always be rebuilt
when doing "make install".  The difference between when version.c is
created and when someone is done monkeying with the build process does
not seem to be of much consequence.

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

index 255aed25bbb706782ba7c78cd2058b0cc8af2da0..1e0ff1a6ce986afa1b1c7f9561e889dace2e09fd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -201,7 +201,6 @@ endif
 SRCDIR = src
 COMMON_DIR = $(SRCDIR)/common
 COMMON_LIB = $(COMMON_DIR)/frotz_common.a
-COMMON_STRINGS = $(COMMON_DIR)/version.c
 COMMON_DEFINES = $(COMMON_DIR)/defs.h
 HASH = $(COMMON_DIR)/git_hash.h
 
@@ -275,7 +274,7 @@ dumb_lib:   $(DUMB_LIB)
 blorb_lib:     $(BLORB_LIB)
 dos_lib:       $(DOS_LIB)
 
-$(COMMON_LIB): $(COMMON_DEFINES) $(COMMON_STRINGS) $(HASH)
+$(COMMON_LIB): $(COMMON_DEFINES) $(HASH)
        $(MAKE) -C $(COMMON_DIR)
 
 $(CURSES_LIB): $(COMMON_DEFINES) $(CURSES_DEFINES) $(HASH)
@@ -298,12 +297,6 @@ $(SUB_CLEAN):
 
 # Compile-time generated defines and strings
 #
-common_strings:        $(COMMON_STRINGS)
-$(COMMON_STRINGS):
-       @echo "** Generating $@"
-       @echo "#include \"frotz.h\"" > $@
-       @echo "const char build_timestamp[] = \"$(BUILD_DATE)\";" >> $@
-
 common_defines: $(COMMON_DEFINES)
 $(COMMON_DEFINES):
        @echo "** Generating $@"
@@ -376,6 +369,7 @@ $(HASH):
        @echo "#define GIT_HASH \"$(GIT_HASH)\"" >> $@
        @echo "#define GIT_HASH_SHORT \"$(GIT_HASH_SHORT)\"" >> $@
        @echo "#define GIT_DATE \"$(GIT_DATE)\"" >> $@
+       @echo "#define BUILD_DATE \"$(BUILD_DATE)\"" >> $@
 
 
 # Administrative stuff
@@ -429,7 +423,6 @@ endif
 clean: $(SUB_CLEAN)
        rm -rf $(NAME)-$(VERSION)
        rm -rf $(COMMON_DEFINES) \
-               $(COMMON_STRINGS) \
                $(CURSES_DEFINES) \
                $(HASH)
        rm -f FROTZ.BAK FROTZ.EXE FROTZ.LIB
@@ -464,7 +457,7 @@ help:
 
 .PHONY: all clean dist curses ncurses dumb sdl hash help \
        common_defines curses_defines nosound nosound_helper\
-       $(COMMON_DEFINES) $(CURSES_DEFINES) $(COMMON_STRINGS) $(HASH) \
+       $(COMMON_DEFINES) $(CURSES_DEFINES) $(HASH) \
        blorb_lib common_lib curses_lib dumb_lib \
        install install_dfrotz install_sfrotz \
        $(SUBDIRS) $(SUB_CLEAN) \
index 47cbf69e5d364c96753fcec1e8a3952fe9657930..47201682a5a5c2425ce3fda9ebef00d72226f571 100644 (file)
@@ -3,8 +3,7 @@
 
 SOURCES = buffer.c err.c fastmem.c files.c getopt.c hotkey.c input.c \
        main.c math.c missing.c object.c process.c quetzal.c random.c \
-       redirect.c screen.c sound.c stream.c table.c text.c variable.c \
-       version.c
+       redirect.c screen.c sound.c stream.c table.c text.c variable.c
 
 HEADERS = frotz.h setup.h unused.h
 
index cb8e4c7f8640e1c58d78219876fdc79d027412a5..0fcbfcfa4ea5197a737feb5a97e394b6c91974c7 100644 (file)
@@ -1211,7 +1211,7 @@ static void print_version(void)
 #else
        printf("Audio output disabled.");
 #endif
-    printf("\nBuild date:\t%s\n", build_timestamp);
+    printf("\nBuild date:\t%s\n", BUILD_DATE);
     printf("Commit date:\t%s\n", GIT_DATE);
     printf("Git commit:\t%s\n", GIT_HASH);
     printf("Git branch:\t%s\n", GIT_BRANCH);
index 86289696acc049986e2b5eff4b149bed31f302b5..026f78c64382661775668ed4451dfa9584c6324b 100644 (file)
@@ -318,7 +318,7 @@ static void print_version(void)
 {
     printf("FROTZ V%s\t", VERSION);
     printf("Dumb interface.\n");
-    printf("Build date:\t%s\n", build_timestamp);
+    printf("Build date:\t%s\n", BUILD_DATE);
     printf("Commit date:\t%s\n", GIT_DATE);
     printf("Git commit:\t%s\n", GIT_HASH);
     printf("Git branch:\t%s\n", GIT_BRANCH);
index 7c9db4da39741ac94151570716276c94534e8eab..e5952e4b36e54cf4b5458087056f97be9f8ec86c 100644 (file)
@@ -288,7 +288,7 @@ static void parse_options (int argc, char **argv)
 static void print_version(void)
 {
     printf("FROTZ V%s\tSDL interface.\n", VERSION);
-    printf("Build date:\t%s\n", build_timestamp);
+    printf("Build date:\t%s\n", BUILD_DATE);
     printf("Commit date:\t%s\n", GIT_DATE);
     printf("Git commit:\t%s\n", GIT_HASH);
     printf("Git branch:\t%s\n", GIT_BRANCH);