# Executable
nqptp
+
+# Version file generated from '$ git describe --dirty'
+gitversion.h
+
AM_CFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread
+if USE_GIT
+nqptp.c: gitversion.h
+gitversion.h: FORCE
+ echo "// Do not edit!" > gitversion.h
+ echo "// This file is automatically generated by 'git describe --dirty', if available." >> gitversion.h
+ echo -n " char git_version_string[] = \"" >> gitversion.h
+ git describe --dirty | tr -d '[[:space:]]' >> gitversion.h
+ echo "\";" >> gitversion.h
+FORCE: ;
+endif
+
install-exec-hook:
-e /lib/systemd/system || mkdir -p /lib/systemd/system
- -f /lib/systemd/system/nqptp.service || cp nqptp.service /lib/systemd/system
\ No newline at end of file
+ -f /lib/systemd/system/nqptp.service || cp nqptp.service /lib/systemd/system
AC_PREREQ([2.68])
AC_INIT([nqptp], [1.1-dev], [4265913+mikebrady@users.noreply.github.com])
AM_INIT_AUTOMAKE
+
+AC_CHECK_PROGS([GIT], [git])
+if test -n "$GIT"; then
+ AC_DEFINE([CONFIG_USE_GIT_VERSION_STRING], 1, [Use the version string produced by running 'git describe --dirty'.])
+fi
+AM_CONDITIONAL([USE_GIT], [test -n "$GIT"])
+
AC_CONFIG_SRCDIR([nqptp.c])
AC_CONFIG_HEADERS([config.h])
#include "nqptp-ptp-definitions.h"
#include "nqptp-utilities.h"
+#ifdef CONFIG_USE_GIT_VERSION_STRING
+#include "gitversion.h"
+#endif
+
#include <arpa/inet.h>
#include <stdio.h> //printf
#include <stdlib.h> //malloc;
for (i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
if (strcmp(argv[i] + 1, "V") == 0) {
+#ifdef CONFIG_USE_GIT_VERSION_STRING
+ if (git_version_string[0] != '\0')
+ fprintf(stdout, "Version: %s. Shared Memory Interface Version: %u.\n", git_version_string,
+ NQPTP_SHM_STRUCTURES_VERSION);
+ else
+#endif
fprintf(stdout, "Version: %s. Shared Memory Interface Version: %u.\n", VERSION,
NQPTP_SHM_STRUCTURES_VERSION);
exit(EXIT_SUCCESS);