Regenerate build date and time every time tinc is built.
This prevents the date and time shown in version information from getting stale because of partial builds. With these changes, date and time information is written to a dedicated object file that gets rebuilt every time make is run, even if there are no changes.
This commit is contained in:
parent
116f2ed27a
commit
aec82bb1c9
6 changed files with 61 additions and 3 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
sbin_PROGRAMS = tincd tinc sptps_test sptps_keypair
|
||||
|
||||
## Make sure version.c is always rebuilt
|
||||
.PHONY: version.c
|
||||
|
||||
if LINUX
|
||||
sbin_PROGRAMS += sptps_speed
|
||||
endif
|
||||
|
@ -88,6 +91,7 @@ tincd_SOURCES = \
|
|||
tincd.c \
|
||||
utils.c utils.h \
|
||||
xalloc.h \
|
||||
version.c version.h \
|
||||
$(ed25519_SOURCES) \
|
||||
$(chacha_poly1305_SOURCES)
|
||||
|
||||
|
@ -106,6 +110,7 @@ tinc_SOURCES = \
|
|||
tincctl.c tincctl.h \
|
||||
top.c top.h \
|
||||
utils.c utils.h \
|
||||
version.c version.h \
|
||||
$(ed25519_SOURCES) \
|
||||
$(chacha_poly1305_SOURCES)
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "subnet.h"
|
||||
#include "utils.h"
|
||||
#include "xalloc.h"
|
||||
#include "version.h"
|
||||
|
||||
/* If zero, don't detach from the terminal. */
|
||||
bool do_detach = true;
|
||||
|
@ -223,7 +224,7 @@ bool detach(void) {
|
|||
openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
|
||||
|
||||
logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
|
||||
VERSION, __DATE__, __TIME__, debug_level);
|
||||
VERSION, BUILD_DATE, BUILD_TIME, debug_level);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "utils.h"
|
||||
#include "tincctl.h"
|
||||
#include "top.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifndef MSG_NOSIGNAL
|
||||
#define MSG_NOSIGNAL 0
|
||||
|
@ -85,7 +86,7 @@ static struct option const long_options[] = {
|
|||
|
||||
static void version(void) {
|
||||
printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE,
|
||||
VERSION, __DATE__, __TIME__, PROT_MAJOR, PROT_MINOR);
|
||||
VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR);
|
||||
printf("Copyright (C) 1998-2012 Ivo Timmermans, Guus Sliepen and others.\n"
|
||||
"See the AUTHORS file for a complete list.\n\n"
|
||||
"tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "protocol.h"
|
||||
#include "utils.h"
|
||||
#include "xalloc.h"
|
||||
#include "version.h"
|
||||
|
||||
/* If nonzero, display usage information and exit. */
|
||||
static bool show_help = false;
|
||||
|
@ -319,7 +320,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
if(show_version) {
|
||||
printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE,
|
||||
VERSION, __DATE__, __TIME__, PROT_MAJOR, PROT_MINOR);
|
||||
VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR);
|
||||
printf("Copyright (C) 1998-2014 Ivo Timmermans, Guus Sliepen and others.\n"
|
||||
"See the AUTHORS file for a complete list.\n\n"
|
||||
"tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
|
||||
|
|
24
src/version.c
Normal file
24
src/version.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
version.c -- version information
|
||||
Copyright (C) 2014 Etienne Dechamps <etienne@edechamps.fr>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "version.h"
|
||||
|
||||
/* This file is always rebuilt (even if there are no changes) so that the following is updated */
|
||||
const char* const BUILD_DATE = __DATE__;
|
||||
const char* const BUILD_TIME = __TIME__;
|
26
src/version.h
Normal file
26
src/version.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
version.h -- header for version.c
|
||||
Copyright (C) 2014 Etienne Dechamps <etienne@edechamps.fr>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __TINC_VERSION_H__
|
||||
#define __TINC_VERSION_H__
|
||||
|
||||
extern const char* const BUILD_DATE;
|
||||
extern const char* const BUILD_TIME;
|
||||
|
||||
#endif /* __TINC_VERSION_H__ */
|
Loading…
Reference in a new issue