mirror of https://github.com/nirenjan/libx52.git
Generate Git version info at call to make
Prior to this change, the Git version was only getting generated when the call was made to autoreconf. This was resulting in stale version info. This change, by contrast, generates the build info at the call to make. While this doesn't completely eliminate the stale version issue, it's easier to work around, by simply running `make clean`, `make`.reverse-scroll
parent
251ccfde0d
commit
24ce9bc97b
|
@ -0,0 +1 @@
|
|||
/version-info ident
|
15
Makefile.am
15
Makefile.am
|
@ -24,12 +24,25 @@ pkgconfig_DATA =
|
|||
TESTS =
|
||||
EXTRA_DIST =
|
||||
CLEANFILES =
|
||||
BUILT_SOURCES =
|
||||
|
||||
x52includedir = $(includedir)/libx52
|
||||
x52include_HEADERS =
|
||||
|
||||
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
|
||||
|
||||
########################################################################
|
||||
# Get build version
|
||||
########################################################################
|
||||
BUILT_SOURCES += version-info.h
|
||||
CLEANFILES += version-info.h
|
||||
|
||||
version-info.h: ${top_srcdir}/version-info
|
||||
${top_srcdir}/version-info ${top_srcdir} >$@
|
||||
|
||||
########################################################################
|
||||
# Include automake stubs
|
||||
########################################################################
|
||||
include libx52/Makefile.am
|
||||
include libx52util/Makefile.am
|
||||
include libx52io/Makefile.am
|
||||
|
@ -89,7 +102,7 @@ EXTRA_DIST += \
|
|||
LICENSE \
|
||||
README.md \
|
||||
config.rpath \
|
||||
configure.version \
|
||||
version-info \
|
||||
Version \
|
||||
gettext.h \
|
||||
usb-ids.h \
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "libusb.h"
|
||||
#include "hidapi.h"
|
||||
#include "libx52io.h"
|
||||
#include "version-info.h"
|
||||
|
||||
static void print_sysinfo(void)
|
||||
{
|
||||
|
@ -74,6 +75,8 @@ int main(int argc, char **argv)
|
|||
puts("================");
|
||||
printf("Package version: %s\n", VERSION);
|
||||
printf("Build version: %s\n", BUILD_VERSION);
|
||||
printf("Built on: %s\n", BUILD_DATE);
|
||||
printf("version-info %s\n", BUILD_VERSION_INFO_IDENT);
|
||||
|
||||
puts("");
|
||||
puts("Built against:");
|
||||
|
|
|
@ -26,8 +26,6 @@ AX_GCC_FUNC_ATTRIBUTE([format])
|
|||
AX_GCC_FUNC_ATTRIBUTE([noreturn])
|
||||
AC_C_TYPEOF
|
||||
|
||||
AC_DEFINE([BUILD_VERSION], ["m4_esyscmd([./configure.version])"], [Build version])
|
||||
|
||||
AC_MSG_NOTICE([Detected host OS is ${host_os}])
|
||||
build_linux=no
|
||||
# Detect target system
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
# Generate the build_info.h header
|
||||
# Use the Git version if Git is available, otherwise fallback to Version
|
||||
|
||||
top_srcdir="${1-.}"
|
||||
|
@ -13,7 +14,6 @@ version="${top_srcdir}/Version"
|
|||
if ! test -n "${GIT_DIR}"
|
||||
then
|
||||
GIT_DIR="${top_srcdir}/.git"
|
||||
export GIT_DIR
|
||||
fi
|
||||
|
||||
if test -d "${GIT_DIR}"
|
||||
|
@ -31,4 +31,8 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
printf "%s" "${DESCRIBE}"
|
||||
cat <<EOM
|
||||
#define BUILD_VERSION "${DESCRIBE}"
|
||||
#define BUILD_DATE "$(date +%Y-%m-%dT%H:%M:%S%z)"
|
||||
EOM
|
||||
echo '#define BUILD_VERSION_INFO_IDENT "$Id$"'
|
Loading…
Reference in New Issue