# Copyright © 2005 Adam Jackson.
-# Copyright © 2009 Intel Corporation
+# Copyright © 2009,2013 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
MAINTAINERCLEANFILES = ChangeLog INSTALL
+.PHONY: version.h.tmp
+version.h.tmp:
+ @touch $@
+ @if test -d .git; then \
+ if which git > /dev/null; then git log -n 1 --oneline | \
+ sed 's/^\([^ ]*\) .*/#define IGT_GIT_SHA1 "g\1"/' \
+ >> $@ ; \
+ fi \
+ else \
+ echo '#define IGT_GIT_SHA1 "NOT-GIT"' >> $@ ; \
+ fi
+
+version.h: version.h.tmp
+ @echo "updating version.h"
+ @if ! cmp -s version.h.tmp version.h; then \
+ mv version.h.tmp version.h ;\
+ else \
+ rm version.h.tmp ;\
+ fi
+
+BUILT_SOURCES = version.h
+CLEANFILES = version.h version.h.tmp
+
.PHONY: ChangeLog INSTALL
INSTALL:
#include "intel_chipset.h"
#include "intel_gpu_tools.h"
#include "igt_debugfs.h"
+#include "../version.h"
+#include "config.h"
/* This file contains a bunch of wrapper functions to directly use gem ioctls.
* Mostly useful to write kernel tests. */
assert(sig != 0 || igt_exit_called);
}
+
+static void print_version(void)
+{
+ if (list_subtests)
+ return;
+
+ fprintf(stdout, "IGT-Version: %s-%s\n", PACKAGE_VERSION, IGT_GIT_SHA1);
+}
+
static void print_usage(const char *command_str, const char *help_str,
bool output_on_stderr)
{
oom_adjust_for_doom();
out:
+ print_version();
+
return ret;
}