#!/bin/sh
# Compile smoke-test against the installed CANvenient library to verify the
# -dev package is usable.
set -e

WORKDIR="$(mktemp -d)"
trap 'rm -rf "$WORKDIR"' EXIT

cp debian/tests/smoke-test.c "$WORKDIR/smoke-test.c"
cd "$WORKDIR"

: "${CC:=cc}"

# shellcheck disable=SC2046
"$CC" $CFLAGS $CPPFLAGS smoke-test.c -o smoke-test $(pkgconf --cflags --libs canvenient) $LDFLAGS
echo "build: OK"

./smoke-test
echo "run: OK"
