# ignore automatically generated files
src/conftime.h
+src/confhash.h
src/conf_gfx.h
src/conf_snd.h
src/conf_mus.h
conf-time:
@$(MAKE_CMD) conf-time
+conf-hash:
+ @$(MAKE_CMD) conf-hash
+
run: all
@$(MAKE_CMD) run
# get source date string from either GNU / Linux or BSD / Mac OS X style "date"
SOURCE_DATE_STRING := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIMESTAMP_FORMAT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIMESTAMP_FORMAT)" 2>/dev/null || date -u "+$(TIMESTAMP_FORMAT)")
+COMMIT_HASH_FILE = confhash.h
+COMMIT_HASH_NONE = "[changed files]"
+
+# get last Git commit hash, if no files were changed
+SOURCE_HASH_STRING ?= $(shell test -d ../.git && test `git ls-files -m | wc -l` -eq 0 && git show -s --format=%h || echo "$(COMMIT_HASH_NONE)")
+
LIBGAME_DIR = libgame
LIBGAME = $(LIBGAME_DIR)/libgame.a
all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir game_mm_dir $(PROGNAME) graphics_dir
-$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON)
+$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(COMMIT_HASH_FILE) $(OBJS) $(ICON)
$(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME)
ifdef BUILD_DIST
strip $(PROGNAME)
@echo '#define SOURCE_DATE_STRING "$(SOURCE_DATE_STRING)"' \
> $(TIMESTAMP_FILE)
+conf-hash:
+ @echo '#define SOURCE_HASH_STRING "$(SOURCE_HASH_STRING)"' \
+ > $(COMMIT_HASH_FILE)
+
$(TIMESTAMP_FILE): $(SRCS) $(RNDLIBS)
@$(MAKE) conf-time
+$(COMMIT_HASH_FILE): $(SRCS) $(RNDLIBS)
+ @$(MAKE) conf-hash
+
$(ICON):
# $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico
$(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico
#include "config.h"
#include "conftime.h"
+#include "confhash.h"
char *getSourceDateString(void)
return SOURCE_DATE_STRING;
}
+char *getSourceHashString(void)
+{
+ return SOURCE_HASH_STRING;
+}
+
char *getProgramTitleString(void)
{
return program.program_title;
#include "main.h"
char *getSourceDateString(void);
+char *getSourceHashString(void);
char *getProgramTitleString(void);
char *getProgramRealVersionString(void);
char *getProgramVersionString(void);
DrawTextF(xstart1, ystart, font_head, "Source date");
DrawTextF(xstart2, ystart, font_text, getSourceDateString());
+ ystart += ystep_line;
+
+ DrawTextF(xstart1, ystart, font_head, "Commit hash");
+ DrawTextF(xstart2, ystart, font_text, getSourceHashString());
ystart += ystep_para;
DrawTextF(xstart1, ystart, font_head, "Library");