Show version (and git commit) on startup

This commit is contained in:
Thomas Kolb 2013-03-07 20:24:35 +01:00
parent 7d35b1f48d
commit fa98c1e089
2 changed files with 8 additions and 2 deletions

View file

@ -1,8 +1,11 @@
BASE_VERSION=0.1.0
VERSION="\"$(BASE_VERSION)-$(shell git rev-parse --short HEAD)\""
MAGIC_CFLAGS=-DHAVE_MAGIC
MAGIC_LIBS=-lmagic
CC=gcc
CFLAGS+=-Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=20120607L -D_FILE_OFFSET_BITS=64 $(MAGIC_CFLAGS)
CFLAGS+=-Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=20120607L -D_FILE_OFFSET_BITS=64 -DVERSION=$(VERSION) $(MAGIC_CFLAGS)
LIBS=-lmicrohttpd $(MAGIC_LIBS)
TARGET=fileshare

5
main.c
View file

@ -386,13 +386,16 @@ int main(int argc, char ** argv) {
logger_init();
LOG(LVL_INFO, "Welcome to fileshare " VERSION);
#ifndef DEBUG
// don't show debug output in release build
logger_set_verbosity(LVL_INFO);
#endif
if (argc < 2) {
printf("%s <dir> [<port>]\n", argv[0]);
LOG(LVL_ERR, "Too few arguments!");
LOG(LVL_INFO, "Usage: %s <dir> [<port>]", argv[0]);
return 1;
}