genunifont
src/static_shaders.c
src/genshader.c
+src/githead.h
src/text_font_unifont_data.c
docs/reference/*.txt
docs/reference/*.bak
$(SHL_DLIST)
#
+# GIT-HEAD helper
+# The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
+# to the string returned by "git describe". We need to adjust this string for
+# every build and correctly rebuild any sources that depend on it. Therefore,
+# you should use this file rarely as it causes rebuilds on every git-commit.
+#
+# We have a helper-script ./src/genversion.sh that takes as argument the header
+# file and creates it if necessary. It updates it only if the new git-describe
+# string is different to the old one. So the file is only modified on changes.
+# Hence, we can use it as normal dependency in this Makefile.
+# However, we need to run this script on _every_ "make" invocation before any
+# recipy is executed. To achieve this, we use $(shell ...) and assign it to a
+# "simply expanded" variable (:=) so the shell command is executed on
+# variable-declaration and not during expansion.
+#
+# Note that we must not clean ./src/githead.h ever! If we would, a distribution
+# tarball might delete that file and have no way to recreate it.
+# We could delete it on something like "make maintainerclean", but then again,
+# it seems unnecessary so lets simply not clean it at all.
+#
+# If the helper-script is executed in a directory that is not a git-repository
+# (like a distribution tarball) and githead.h exists, then it does nothing as it
+# expects githead.h to be correctly written by "make dist".
+# However, if githead.h does not exist, it will print a warning and write
+# "<unknown>" as git-revision.
+# This guarantees, that githead.h is always present and has the most correct
+# value that we can get under any conditions.
+#
+# The $(emptyvariable) expansion below is used for broken $(shell ...)
+# syntax-highlighting algorithms in many existing editors.
+#
+
+EXTRA_DIST += src/genversion.sh
+GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
+
+#
# libeloop
# This library contains the whole event-loop implementation of kmscon. It is
# compiled into a separate object to allow using it in several other programs.
$(SHL_TIMER) \
$(SHL_HOOK) \
$(SHL_REGISTER) \
+ src/githead.h \
src/conf.h \
src/conf.c \
src/log.h \
--- /dev/null
+#!/bin/sh
+
+#
+# Generate $1 with:
+# #define BUILD_GIT_HEAD "<git-head-revision>"
+# But do not touch $1 if the git-revision is already up-to-date.
+#
+
+if test "x$1" = "x" ; then
+ echo "usage: ./genversion <file>"
+ exit 1
+fi
+
+#
+# Check whether this is a valid git repository.
+# Set ISGIT to 1=true or 0=false.
+#
+
+ISGIT=0
+REV=`git rev-parse --git-dir 2>/dev/null`
+if test "x$?" = "x0" ; then
+ ISGIT=1
+fi
+
+#
+# Check the old revision from $1.
+#
+
+if test -f "$1" ; then
+ OLDREV=`cat "$1"`
+else
+ if test $ISGIT = 0 ; then
+ echo "WARNING: version file $1 is missing"
+ echo "#define BUILD_GIT_HEAD \"unknown-revision\""
+ exit 0
+ fi
+
+ OLDREV=""
+fi
+
+#
+# Check new revision from "git describe". However, if this is no valid
+# git-repository, return success and do nothing.
+#
+
+if test $ISGIT = 0 ; then
+ exit 0
+fi
+
+NEWREV=`git describe`
+NEWREV="#define BUILD_GIT_HEAD \"$NEWREV\""
+
+#
+# Exit if the file is already up to date.
+# Otherwise, write the new revision into the file.
+#
+
+if test "x$OLDREV" = "x$NEWREV" ; then
+ exit 0
+fi
+
+echo "$NEWREV" >"$1"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "githead.h"
#include "log.h"
/*
}
/*
- * Build-Count
- * This is incremented for every build. ISO-C does not provide a method to do
- * this so we default to 1 if no external build-number is specified.
- */
-
-/* TODO: define LOG_BUILD as incremental build number */
-#ifdef LOG_BUILD
-static unsigned long log_build = LOG_BUILD;
-#else
-static unsigned long log_build = 1;
-#endif
-
-/*
* Default Values
* Several logging-parameters may be omitted by applications. To provide sane
* default values we provide constants here.
if (!appname)
appname = "<unknown>";
log_format(LOG_DEFAULT_CONF, NULL, LOG_NOTICE,
- "%s Build #%lu %s %s", appname,
- log_build, __DATE__, __TIME__);
+ "%s Revision %s %s %s", appname,
+ BUILD_GIT_HEAD, __DATE__, __TIME__);
}