From 888a48562f19abd166716dfcf73e56c0b3d796b4 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Sun, 22 Sep 2019 21:48:21 +0100 Subject: [PATCH] Generate version.h and print version on boot. Fixes #46 --- .gitignore | 1 + GL/flush.c | 3 +++ Makefile | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 46e6163..c1b78b3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ *.img dc-build.sh .buildconfig +GL/version.h diff --git a/GL/flush.c b/GL/flush.c index 6c68fe7..408c680 100644 --- a/GL/flush.c +++ b/GL/flush.c @@ -6,6 +6,7 @@ #include "../containers/aligned_vector.h" #include "private.h" #include "profiler.h" +#include "version.h" #define TA_SQ_ADDR (unsigned int *)(void *) \ (0xe0000000 | (((unsigned long)0x10000000) & 0x03ffffe0)) @@ -87,6 +88,8 @@ void APIENTRY glKosInitConfig(GLdcConfig* config) { void APIENTRY glKosInitEx(GLdcConfig* config) { TRACE(); + printf("\nWelcome to GLdc! Git revision: %s\n\n", GLDC_VERSION); + _glInitPVR(config->autosort_enabled); _glInitMatrices(); diff --git a/Makefile b/Makefile index 76a1114..f761d3a 100644 --- a/Makefile +++ b/Makefile @@ -6,17 +6,20 @@ # Copyright (C) 2018 Luke Benstead TARGET = libGLdc.a -OBJS = GL/draw.o GL/flush.o GL/framebuffer.o GL/immediate.o GL/lighting.o GL/state.o GL/texture.o GL/glu.o +OBJS = GL/draw.o GL/flush.o GL/framebuffer.o GL/immediate.o GL/lighting.o GL/state.o GL/texture.o GL/glu.o GL/version.h OBJS += GL/matrix.o GL/fog.o GL/error.o GL/clip.o containers/stack.o containers/named_array.o containers/aligned_vector.o GL/profiler.o SUBDIRS = KOS_CFLAGS += -ffast-math -Ofast -Iinclude +GL/version.h: + @echo -e '#pragma once\n#define GLDC_VERSION "$(shell git describe --abbrev=4 --dirty --always --tags)"\n' > $@ + link: $(KOS_AR) rcs $(TARGET) $(OBJS) -build: $(OBJS) link +build: GL/version.h $(OBJS) link samples: build