1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 00:10:27 +00:00

Add git commit hash to build to get version.

This commit is contained in:
Calvin Rose 2018-10-31 16:21:21 -04:00
parent 5625023925
commit 853a839f6c
3 changed files with 6 additions and 2 deletions

View File

@ -27,9 +27,11 @@ PREFIX?=/usr/local
INCLUDEDIR=$(PREFIX)/include/janet INCLUDEDIR=$(PREFIX)/include/janet
LIBDIR=$(PREFIX)/lib LIBDIR=$(PREFIX)/lib
BINDIR=$(PREFIX)/bin BINDIR=$(PREFIX)/bin
JANET_VERSION?="\"commit-$(shell git log --pretty=format:'%h' -n 1)\""
#CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -g #CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -g
CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -O2 -fvisibility=hidden CFLAGS=-std=c99 -Wall -Wextra -Isrc/include -fpic -O2 -fvisibility=hidden \
-DJANET_VERSION=$(JANET_VERSION)
CLIBS=-lm -ldl CLIBS=-lm -ldl
JANET_TARGET=janet JANET_TARGET=janet
JANET_LIBRARY=libjanet.so JANET_LIBRARY=libjanet.so

View File

@ -29,7 +29,9 @@ extern "C" {
/***** START SECTION CONFIG *****/ /***** START SECTION CONFIG *****/
#ifndef JANET_VERSION
#define JANET_VERSION "0.0.0 alpha" #define JANET_VERSION "0.0.0 alpha"
#endif
/* /*
* Detect OS and endianess. * Detect OS and endianess.

View File

@ -249,7 +249,7 @@ static void historymove(int delta) {
historyi = history_count - 1; historyi = history_count - 1;
return; return;
} }
strncpy(buf, history[historyi], JANET_LINE_MAX); strncpy(buf, history[historyi], JANET_LINE_MAX - 1);
pos = len = strlen(buf); pos = len = strlen(buf);
buf[len] = '\0'; buf[len] = '\0';