Although useful, makes other than GNU make do not like this.
Name the prerequisite explicitly instead, and circumvent any
VPATH substitution other makes may do.
It can sometimes happen that .git/HEAD or .git/refs/head/*, which
are added as config.status dependencies during configure, do not
exist anymore at build time. For instance, when the current branch
is deleted after switching to a different one.
Wrap the dependencies inside $(wildcard ...) to avoid this problem.
Note that this is a GNU make feature. However, it should be fine
as it is only used for git builds. Even if a non-GNU make is used,
the construct will hopefully just expand to nothing.
Replace DRIVER() and DRIVER2() by a single SR_DRIVER() macro.
Derive the names of shell variables and preprocessor defines
programatically to cut down on repetition.
version.h and enums.hpp are generated at build time and should
not be included in the distribution tarball. This seems to have
triggered a weird error when doing a VPATH build of the dist
tarball.
It seems automake automatically adds the directory containing
the generated version.h to the include path. Use nostdinc to
disable default includes altogether.
This fixes a build problem due to the reduced include search paths
introduced by my recent changes. Also fix a couple of other
includes to use angle brackets.
Append the git revision hash to the libsigrok package version,
unless HEAD exactly matches a release tag. Note that this does
not affect the version known to autoconf -- e.g. source tarballs
created by make dist will not receive a revision suffix.
Changes to git HEAD automatically trigger a reconfiguration.
Uncommitted changes do not, which is why I left out the -dirty
suffix.
Make it so that $(datadir) is resolved at make time, as per
autotools recommendations. Note that $datadir is not fully
resolved at configure time to begin with, i.e. part of it
already was evaluated at make time.
Use the proper tool for the job and make libsigrok/version.h
a secondary configuration header, so that autoconf's AC_DEFINE
machinery can be used to generate it. Note that the header
template is still hand-written, enabling fine control of the
content.
Move the include flags for files in the source tree from
configure.ac to Makefile.am where they belong. Also use
AM_CPPFLAGS instead of CFLAGS/CXXFLAGS to make sure the
files in the build/source tree are always picked up first.
Also, remove the include/libsigrok sub-directory from the
search path, thereby making the <libsigrok/> prefix mandatory
when building libsigrok itself. This matches the convention
already imposed on users of the library.
- Don't #include <errno.h> in files that don't actually need it.
- Don't use strerror() on error codes from functions that don't set
errno. Replace strerror() with sr_strerror() for libsigrok functions.
Fixes a bug where new acquisition failes due to leftover pipes from
previous acquisitions:
sr: demo: dev_acquisition_start: pipe() failed
Indeed, PulseView had 2024 pipes opened. With this fix, it stabilizes at
33 with sampling thread active.
Signed-off-by: Hubert CHAUMETTE <hchaumette@baylibre.com>
Move the libusb_detach_kernel_driver() call after the code that
sets the usb->devhdl pointer, otherwise it'll be NULL and result
in a segfault.
#0 libusb_kernel_driver_active (dev=0x0, interface_number=0) at libusb/core.c:1711
#1 dev_open (sdi=0x12d99f0) at src/hardware/fx2lafw/api.c:374
[...]
Tested on a device with the default Cypress VID/PID and one with
the Saleae Logic VID/PID, both works fine.