1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-11 05:29:33 +00:00

Replaced date with Git hash.

This commit is contained in:
Oliver Schmidt 2014-03-18 22:40:30 +01:00
parent 01a96ece85
commit 22c63e743a
3 changed files with 19 additions and 5 deletions

View File

@ -5,7 +5,7 @@
GH_PAGES = ../gh-pages
all:
date +%F | zip -z cc65
echo $(TRAVIS_COMMIT) | zip -z cc65
ifdef GH_TOKEN
git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/cc65/cc65.git $(GH_PAGES)
cd $(GH_PAGES) && git config user.name "Oliver Schmidt"

View File

@ -39,9 +39,17 @@ ifdef USER_CFLAGS
$(info USER_CFLAGS: $(USER_CFLAGS))
endif
ifndef GIT_SHA
GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A
endif
endif
$(info GIT_SHA: $(GIT_SHA))
CFLAGS += -MMD -MP -O -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
-DGIT_SHA=$(GIT_SHA) -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
-DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
LDLIBS += -lm

View File

@ -33,8 +33,10 @@
#include "version.h"
/* common */
#include "xsprintf.h"
#include "searchpath.h"
#include "version.h"
@ -58,8 +60,12 @@
const char* GetVersionAsString (void)
/* Returns the version number as a string in a static buffer */
{
static char Buf[40];
xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, __DATE__);
static char Buf[60];
#if defined(GIT_SHA)
xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
#else
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
#endif
return Buf;
}