diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-03-04 15:05:17 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-03-04 15:05:17 +0100 |
commit | 9c2375b6d4e725f0757d7df83473177234425dc4 (patch) | |
tree | 2167d1f6f07586d3e5520e950a6508347e2d0c05 /src | |
parent | 0249b2cb0b0da272a78b4967b9c9f6f02d73cad5 (diff) |
shl: move githead into a source file
This moves githead.h to shl_githead.c so we can skip recompilations on
GIT-HEAD changes. We only need to relink now (which we cannot skip).
This speeds up build-processes considerably on slower machines.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/genversion.sh | 6 | ||||
-rw-r--r-- | src/kmscon_module.c | 6 | ||||
-rw-r--r-- | src/kmscon_module_interface.h | 4 | ||||
-rw-r--r-- | src/shl_githead.h | 31 | ||||
-rw-r--r-- | src/shl_log.c | 4 |
5 files changed, 41 insertions, 10 deletions
diff --git a/src/genversion.sh b/src/genversion.sh index 4d49fa1..0d392e4 100755 --- a/src/genversion.sh +++ b/src/genversion.sh @@ -2,7 +2,7 @@ # # Generate $1 with: -# #define BUILD_GIT_HEAD "<git-head-revision>" +# const char shl_git_head[] = "<git-head-revision>"; # But do not touch $1 if the git-revision is already up-to-date. # @@ -31,7 +31,7 @@ if test -f "$1" ; then else if test $ISGIT = 0 ; then echo "WARNING: version file $1 is missing" - echo "#define BUILD_GIT_HEAD \"unknown-revision\"" + echo "const char shl_git_head[] = \"UnknownRevision\";" >"$1" exit 0 fi @@ -48,7 +48,7 @@ if test $ISGIT = 0 ; then fi NEWREV=`git describe` -NEWREV="#define BUILD_GIT_HEAD \"$NEWREV\"" +NEWREV="const char shl_git_head[] = \"$NEWREV\";" # # Exit if the file is already up to date. diff --git a/src/kmscon_module.c b/src/kmscon_module.c index 471f5af..2bf0576 100644 --- a/src/kmscon_module.c +++ b/src/kmscon_module.c @@ -30,10 +30,10 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> -#include "githead.h" #include "kmscon_module.h" #include "kmscon_module_interface.h" #include "shl_dlist.h" +#include "shl_githead.h" #include "shl_log.h" #include "shl_misc.h" @@ -66,9 +66,9 @@ int kmscon_module_open(struct kmscon_module **out, const char *file) goto err_unload; } - if (strcmp(module->info.githead, BUILD_GIT_HEAD)) { + if (strcmp(module->info.githead, shl_git_head)) { log_error("incompatible module %s (%s != %s)", - file, module->info.githead, BUILD_GIT_HEAD); + file, module->info.githead, shl_git_head); ret = -EFAULT; goto err_unload; } diff --git a/src/kmscon_module_interface.h b/src/kmscon_module_interface.h index 8203a34..f13f724 100644 --- a/src/kmscon_module_interface.h +++ b/src/kmscon_module_interface.h @@ -32,9 +32,9 @@ #include <stdbool.h> #include <stdlib.h> -#include "githead.h" #include "kmscon_module.h" #include "shl_dlist.h" +#include "shl_githead.h" #include "shl_misc.h" struct kmscon_module_info { @@ -59,7 +59,7 @@ struct kmscon_module { #define KMSCON_MODULE(_init, _load, _unload, _exit) \ struct kmscon_module module = { \ .info = { \ - .githead = BUILD_GIT_HEAD, \ + .githead = shl_git_head, \ .date = __DATE__, \ .time = __TIME__, \ .init = _init, \ diff --git a/src/shl_githead.h b/src/shl_githead.h new file mode 100644 index 0000000..a368cba --- /dev/null +++ b/src/shl_githead.h @@ -0,0 +1,31 @@ +/* + * shl - GIT-HEAD + * + * Copyright (c) 2011-2013 David Herrmann <dh.herrmann@googlemail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef SHL_GITHEAD_H +#define SHL_GITHEAD_H + +extern const char shl_git_head[]; + +#endif /* SHL_GITHEAD_H */ diff --git a/src/shl_log.c b/src/shl_log.c index d35a31f..5b726a4 100644 --- a/src/shl_log.c +++ b/src/shl_log.c @@ -19,7 +19,7 @@ #include <stdlib.h> #include <string.h> #include <sys/time.h> -#include "githead.h" +#include "shl_githead.h" #include "shl_log.h" #include "shl_misc.h" @@ -505,5 +505,5 @@ void log_print_init(const char *appname) appname = "<unknown>"; log_format(LOG_DEFAULT_CONF, NULL, LOG_NOTICE, "%s Revision %s %s %s", appname, - BUILD_GIT_HEAD, __DATE__, __TIME__); + shl_git_head, __DATE__, __TIME__); } |