aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--README.md5
2 files changed, 14 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index b0b5bba..0f4c371 100644
--- a/Makefile
+++ b/Makefile
@@ -14,3 +14,12 @@ src/ffi.rs: ${LIBNITROKEY}/NK_C_API.h
"$<" \
-- "-I${LIBNITROKEY}/libnitrokey"
quilt push -a --refresh
+
+.PHONY: verify-bindings
+verify-bindings:
+ @git diff --exit-code src/ffi.rs || \
+ (echo "This test can only be executed on a clean working tree"; exit 1)
+ @$(MAKE) --always-make src/ffi.rs > /dev/null
+ @git diff --exit-code src/ffi.rs && \
+ (echo "The generated bindings have been verified successfully!") || \
+ (echo "Error: The generated bindings differ from the pre-generated bindings!"; exit 1)
diff --git a/README.md b/README.md
index 2646a33..e94874d 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,11 @@ including layout tests, specifically for your platform during the build,
activate the `bindgen` feature. In this case, you will also need `clang` and
`libclang` in the default search path.
+Alternatively, you can execute `make verify-bindings` to compare the
+pre-generated bindings with the bindings that `bindgen` generates for your
+platform. This check only works on a clean Git working tree and requires the
+`bindgen` binary, `git` and `quilt`.
+
## Versioning
The major and minor version of the `nitrokey-sys` crate map to the major and