confdefs.h
conftest
conftest.c
-GIT-VERSION-FILE
+git-version.h
-#!/bin/sh
-
-if test $# -ne 1; then
- echo >&2 "usage: $0 <version file>"
- exit 1
-fi
+#!/usr/bin/env bash
+(($# > 1)) && { echo >&2 "usage: $0 [<version file>]"; exit 1; }
GVF="$1"
-DEF_VER="unnamed_version"
+DEF_VER="unnamed_version"
LF='
'
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f VERSION
-then
+if [[ -f VERSION ]]; then
VN=$(cat VERSION) || VN="$DEF_VER"
-elif test -d .git -o -f .git &&
+elif [[ -d .git || -f .git ]] &&
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
fi
VN=$(expr "$VN" : v*'\(.*\)')
+echo "$VN"
-if test -r $GVF
-then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
-else
- VC=unset
+[[ -z "$GVF" ]] && exit 0
+if [[ -r "$GVF" ]]; then
+ VC=$(sed -e 's/^#define GIT_VERSION "//; s/"$//' < "$GVF")
+ [[ "$VN" == "$VC" ]] && exit 0
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
+echo >&2 "new git version: $VN"
+echo "#define GIT_VERSION \"$VN\"" >$GVF
cc_version := $(shell $(CC) --version | head -n 1)
codename := deterministic entropy
+GIT_VERSION := $(shell ./GIT-VERSION-GEN git-version.h)
+
DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
DEBUG_CPPFLAGS += -Wredundant-decls
# produces false positives
CPPFLAGS += -I/usr/local/include
CPPFLAGS += -I$(cmdline_dir)
CPPFLAGS += @osl_cppflags@
-CPPFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"'
man_pages := $(patsubst %, man/man1/%.1, @executables@)
man_pages_in := $(patsubst %, web/%.man.in.html, @executables@)
Q = @
endif
-.PHONY: dep all clean distclean maintainer-clean install man tarball\
- .FORCE-GIT-VERSION-FILE
+.PHONY: dep all clean distclean maintainer-clean install man tarball
all: dep @executables@ $(man_pages)
dep: $(deps)
man: $(man_pages)
tarball: $(tarball)
-GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
- @./GIT-VERSION-GEN GIT-VERSION-FILE
--include GIT-VERSION-FILE
-@executables@: GIT-VERSION-FILE
-
-include $(ggo_dir)/makefile
%_command_list.c: %.cmd
git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
| tar --delete $(tarball_delete) > $(tarball_pfx).tar
mkdir -p $(tarball_pfx)/$(cmdline_dir)
- echo $(GIT_VERSION) > $(tarball_pfx)/VERSION
+ ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
cp -r $(autocrap) $(tarball_pfx)
cp -r $(cmdline_generated) $(tarball_pfx)/$(cmdline_dir)
tar rf $(tarball_pfx).tar $(tarball_pfx)/*
#include "fd.h"
#include "afh.h"
#include "error.h"
+#include "version.h"
static struct afh_args_info conf;
/** The list of all status items */
#include "net.h"
#include "string.h"
#include "fd.h"
+#include "version.h"
INIT_AUDIOC_ERRLISTS;
#include "write.h"
#include "write_common.h"
#include "signal.h"
+#include "version.h"
/** define the array of error lists needed by para_audiod */
INIT_AUDIOD_ERRLISTS;
#include "client.h"
#include "hash.h"
#include "buffer_tree.h"
+#include "version.h"
/** The size of the receiving buffer. */
#define CLIENT_BUFSIZE 4000
#include "afs_command_list.h"
#include "sched.h"
#include "signal.h"
+#include "version.h"
/** Commands including options must be shorter than this. */
#define MAX_COMMAND_LEN 32768
#include "fd.h"
#include "string.h"
#include "error.h"
+#include "version.h"
INIT_FADE_ERRLISTS;
static struct fade_args_info conf;
#include "stdin.h"
#include "stdout.h"
#include "error.h"
+#include "version.h"
/** The list of all status items used by para_{server,audiod,gui}. */
const char *status_item_list[] = {STATUS_ITEM_ARRAY};
#include "list.h"
#include "sched.h"
#include "signal.h"
+#include "version.h"
/** define the array of error lists needed by para_gui */
INIT_GUI_ERRLISTS;
va_end(argp); \
}
-/** Version text used by various commands if -V switch was given. */
-#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
- " (" GIT_VERSION ": " CODENAME ")" "\n" \
- "Copyright (C) 2011 Andre Noll\n" \
- "This is free software with ABSOLUTELY NO WARRANTY." \
- " See COPYING for details.\n" \
- "Written by Andre Noll.\n" \
- "Report bugs to <maan@systemlinux.org>.\n"
-
-/** Print out \p VERSION_TEXT and exit if version flag was given. */
-#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
- if (_args_info_struct.version_given) { \
- printf("%s", VERSION_TEXT(_prefix)); \
- exit(EXIT_SUCCESS); \
- }
-
/** Sent by para_client to initiate the authentication procedure. */
#define AUTH_REQUEST_MSG "auth rsa "
/** Sent by para_server for commands that expect a data file. */
#include "error.h"
#include "stdout.h"
#include "buffer_tree.h"
+#include "version.h"
/** The gengetopt args info struct. */
static struct recv_args_info conf;
#include "signal.h"
#include "user_list.h"
#include "color.h"
+#include "version.h"
/** Define the array of error lists needed by para_server. */
INIT_SERVER_ERRLISTS;
--- /dev/null
+#include "git-version.h"
+/** Version text used by various commands if -V switch was given. */
+#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
+ " (" GIT_VERSION ": " CODENAME ")" "\n" \
+ "Copyright (C) 2011 Andre Noll\n" \
+ "This is free software with ABSOLUTELY NO WARRANTY." \
+ " See COPYING for details.\n" \
+ "Written by Andre Noll.\n" \
+ "Report bugs to <maan@systemlinux.org>.\n"
+
+/** Print out \p VERSION_TEXT and exit if version flag was given. */
+#define HANDLE_VERSION_FLAG(_prefix, _args_info_struct) \
+ if (_args_info_struct.version_given) { \
+ printf("%s", VERSION_TEXT(_prefix)); \
+ exit(EXIT_SUCCESS); \
+ }
+
#include "write_common.h"
#include "fd.h"
#include "error.h"
+#include "version.h"
INIT_WRITE_ERRLISTS;