# distutils/setuptools cause trouble on distcheck. Disable for now.
DISTCHECK_CONFIGURE_FLAGS = --disable-python
+CLEAN_EXTRA =
+
FIRMWARE_DIR = $(datadir)/sigrok-firmware
local_includes = -Iinclude -I$(srcdir)/include -I$(srcdir)/src -I. @RPC_CFLAGS@
include/libsigrok/version.h
noinst_HEADERS = src/libsigrok-internal.h
+$(builddir)/src/version.lo: $(builddir)/include/libsigrok/git-version.h
+
+# Create the git-version.h file even for non-versioned source trees,
+# to reduce complexity in the library code. Re-create the header file
+# when branches change, when revisions change, or upon re-configuration.
+# Use the verbatim tagged version number when applicable, or append the
+# "-git-<hash>[-dirty]" suffix for non-tagged source trees.
+if VCS_IS_GIT
+
+$(builddir)/include/libsigrok/git-version.h: Makefile $(VERSION_GITVERSION_DEPS)
+ $(AM_V_GEN) \
+ HASH=`git -C "$(srcdir)" describe --match "@VERSION_TAG_MATCH@" --always --dirty` && \
+ HASH=`echo "$${HASH}" | sed 's/@VERSION_TAG_MATCH@-//'` && \
+ SUFFIX=`git -C "$(srcdir)" describe --match "@VERSION_TAG_MATCH@" --exact-match > /dev/null 2> /dev/null || echo "-$${HASH}"` && \
+ echo "#undef SR_PACKAGE_VERSION_STRING_SUFFIX" > $@ && \
+ echo "#define SR_PACKAGE_VERSION_STRING_SUFFIX \"$${SUFFIX}\"" >> $@
+
+else
+
+$(builddir)/include/libsigrok/git-version.h:
+ $(AM_V_GEN)echo '#define SR_PACKAGE_VERSION_STRING_SUFFIX ""' > $@
+
+endif
+
+version-clean:
+ rm -f $(builddir)/include/libsigrok/git-version.h
+
+CLEAN_EXTRA += version-clean
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsigrok.pc
BUILD_EXTRA =
INSTALL_EXTRA =
UNINSTALL_EXTRA =
-CLEAN_EXTRA =
libsigrok-uninstall:
-rmdir $(DESTDIR)$(includedir)/libsigrok