ni845x_spi: Add a `ni845x.h` header stub for build tests

The `ni845x_spi' programmer driver depends on a proprietary library,
only available for Windows. As that's not the best circumstances for
build tests, add a header file that provides exactly the definitions
needed to compile the driver.

The compilation result can never be linked. Hence, add another build
target to test compilation of this file only.

Change-Id: I3d291bc16eecb1777062a61362a8eb1548afb7a3
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/411
diff --git a/Makefile b/Makefile
index 4810c34..9c0a336 100644
--- a/Makefile
+++ b/Makefile
@@ -1026,6 +1026,11 @@
 strip: $(PROGRAM)$(EXEC_SUFFIX)
 	$(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX)
 
+additional_tests: CPPFLAGS += -Iinclude/test
+ifeq ($(CONFIG_NI845X_SPI), no)
+additional_tests: ni845x_spi.o
+endif
+
 # Make sure to add all names of generated binaries here.
 # This includes all frontends and libflashprog.
 # We don't use EXEC_SUFFIX here because we want to clean everything.
@@ -1116,7 +1121,8 @@
 gitconfig:
 	./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh
 
-.PHONY: all install clean distclean config branch tag versioninfo _export export tarball libpayload gitconfig
+.PHONY: all install clean distclean config additional_tests branch tag
+.PHONY: versioninfo _export export tarball libpayload gitconfig
 
 # Disable implicit suffixes and built-in rules (for performance and profit)
 .SUFFIXES:
diff --git a/include/test/ni845x.h b/include/test/ni845x.h
new file mode 100644
index 0000000..cd6a56b
--- /dev/null
+++ b/include/test/ni845x.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2026 Nico Huber <nico.h@gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * This file is merely mimicking the expected API, so we
+ * can build test the ni845x_spi driver. Everything in
+ * here is derived from the usage in `ni845x_spi.c`.
+ */
+
+#ifndef __NI845X_H__
+#define __NI845X_H__ 1
+
+#include <stdint.h>
+
+typedef uint8_t		uInt8;
+typedef uint16_t	uInt16;
+typedef uint32_t	uInt32;
+typedef int32_t		int32;
+typedef uInt32		NiHandle;
+
+enum {
+	kNi845x12Volts,
+	kNi845x15Volts,
+	kNi845x18Volts,
+	kNi845x25Volts,
+	kNi845x33Volts,
+};
+
+void ni845xStatusToString(int32 err, uInt32 buf_size, char *buf);
+
+int32 ni845xFindDevice(char *resource_name, NiHandle *, uInt32 *found_devices_count);
+int32 ni845xFindDeviceNext(NiHandle, char *resource_name);
+int32 ni845xCloseFindDeviceHandle(NiHandle);
+
+int32 ni845xOpen(char *resource_name, uInt32 *opened_handle);
+int32 ni845xSetIoVoltageLevel(uInt32 device_handle, uInt8 selected_voltage_100mV);
+int32 ni845xClose(uInt32 device_handle);
+
+int32 ni845xSpiConfigurationOpen(NiHandle *);
+int32 ni845xSpiConfigurationSetClockRate(NiHandle, uInt16 SCK_freq_in_KHz);
+int32 ni845xSpiConfigurationGetClockRate(NiHandle, uInt16 *clock_freq_read_KHz);
+int32 ni845xSpiWriteRead(uInt32 device_handle, NiHandle, uInt32 write_size, const uInt8 *write_buf, uInt32 *read_size, uInt8 *read_buf);
+int32 ni845xSpiConfigurationClose(NiHandle);
+
+#endif				/* !__NI845X_H__ */
diff --git a/test_build.sh b/test_build.sh
index 17d1caa..7fb3239 100755
--- a/test_build.sh
+++ b/test_build.sh
@@ -29,7 +29,7 @@
 build_and_test() {
 	if [ "${MAKECMD=make}" ]; then
 		${MAKECMD} clean
-		eval ${MAKECMD} -j${CPUS:-$(nproc)} CC="\"${CC}\"" ${MAKEARGS-CONFIG_EVERYTHING=yes}
+		eval ${MAKECMD} -j${CPUS:-$(nproc)} CC="\"${CC}\"" ${MAKEARGS-CONFIG_EVERYTHING=yes all additional_tests}
 		test_prog ./flashprog
 	fi
 
diff --git a/util/manibuilder/Makefile b/util/manibuilder/Makefile
index 7109ce2..a9be1fe 100644
--- a/util/manibuilder/Makefile
+++ b/util/manibuilder/Makefile
@@ -4,7 +4,7 @@
 
 CC := ccache cc
 MAKECMD := make
-MAKEARGS := CONFIG_EVERYTHING=yes
+MAKEARGS := CONFIG_EVERYTHING=yes all additional_tests
 MESONCMD := meson
 MESONARGS := -D programmer=all -D classic_cli_print_wiki=enabled --auto-features enabled