diff --git a/hermit/Makefile b/hermit/Makefile index 5fb3aa38c..b7e3556d8 100644 --- a/hermit/Makefile +++ b/hermit/Makefile @@ -1,10 +1,12 @@ TERM = xterm -TOPDIR = $(shell pwd) +TOPDIR := $(shell pwd) ARCH = x86 NAME = hermit LWIPDIRS = lwip/src/arch lwip/src/api lwip/src/core lwip/src/core/ipv4 lwip/src/netif KERNDIRS = kernel mm libkern arch/$(ARCH)/kernel arch/$(ARCH)/mm $(LWIPDIRS) SUBDIRS = $(KERNDIRS) +GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags) +TODAY := $(shell date +'%Y%m%d') # Set your own cross compiler tool chain prefix here CROSSCOMPREFIX = @@ -41,13 +43,13 @@ QEMUSERIALFLAGS = -device pci-serial,chardev=tS0 \ INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/lwip/src/include/ipv4 # Compiler options for final code -CFLAGS = -D_HERMIT -g -m64 -Wall -O2 -mno-red-zone -fstrength-reduce -fomit-frame-pointer -finline-functions -ffreestanding -nostdinc -fno-stack-protector $(INCLUDE) +CFLAGS = -DVERSION=\"$(GIT_VERSION)\" -D_HERMIT -g -m64 -Wall -O2 -mno-red-zone -fstrength-reduce -fomit-frame-pointer -finline-functions -ffreestanding -nostdinc -fno-stack-protector $(INCLUDE) # Compiler options for debugging -debug debug-eclipse : CFLAGS = -D_HERMIT -g -O0 -m64 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc -mno-red-zone -fno-stack-protector $(INCLUDE) +debug debug-eclipse : CFLAGS = -DVERSION=\"$(GIT_VERSION)\" -D_HERMIT -g -O0 -m64 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc -mno-red-zone -fno-stack-protector $(INCLUDE) AR = ar ARFLAGS = rsv RM = rm -rf -LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(shell date +'%Y%m%d') --defsym __BUILD_TIME=$(shell date +'%H%M%S') +LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(TODAY) STRIP_DEBUG = --strip-debug KEEP_DEBUG = --only-keep-debug OUTPUT_FORMAT = -O elf32-i386 diff --git a/hermit/include/hermit/config.h b/hermit/include/hermit/config.h index 5b48f85f4..e1e2f82ba 100644 --- a/hermit/include/hermit/config.h +++ b/hermit/include/hermit/config.h @@ -32,7 +32,6 @@ extern "C" { #endif -#define HERMIT_VERSION "0.1" #define MAX_CORES 8 #define MAX_TASKS 16 #define MAX_FNAME 128 diff --git a/hermit/kernel/main.c b/hermit/kernel/main.c index c49af23f9..6e41ffd68 100644 --- a/hermit/kernel/main.c +++ b/hermit/kernel/main.c @@ -58,7 +58,6 @@ extern const void kernel_end; extern const void bss_start; extern const void bss_end; extern char __BUILD_DATE; -extern char __BUILD_TIME; /* Page frame counters */ extern atomic_int32_t total_pages; @@ -141,7 +140,7 @@ int main(void) atomic_int32_inc(&cpu_online); - kprintf("This is Hermit %s Build %u, %u\n", HERMIT_VERSION, &__BUILD_DATE, &__BUILD_TIME); + kprintf("This is Hermit %s, build date %u\n", VERSION, &__BUILD_DATE); kprintf("Kernel starts at %p and ends at %p\n", &kernel_start, &kernel_end); kprintf("Processor frequency: %u MHz\n", get_cpu_frequency()); kprintf("Total memory: %lu KiB\n", atomic_int32_read(&total_pages) * PAGE_SIZE / 1024);