summaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
index f602b1e8..98d08a2c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -55,6 +55,17 @@ ${BUILD_ROOT}/rollback_index_test: rollback_index_test.c ${HOSTLIB}
$(CC) $(CFLAGS) -I/usr/include $(INCLUDES) $< -o $@ \
-ltlcl ${HOSTLIB} -lcrypto -lrt
+# Compile rollback_index.c for unit test, so it uses the same implementation
+# as it does in the firmware.
+${BUILD_ROOT}/rollback_index_for_test.o : $(FWDIR)/lib/rollback_index.c
+ $(CC) $(CFLAGS) -DROLLBACK_UNITTEST $(INCLUDES) \
+ -MMD -MF $@.d -c -o $@ $<
+
+${BUILD_ROOT}/rollback_index2_tests: rollback_index2_tests.c \
+ ${BUILD_ROOT}/rollback_index_for_test.o ${LIBS}
+ $(CC) $(CFLAGS) $(INCLUDES) $< ${BUILD_ROOT}/rollback_index2.o \
+ ${LIBS} -o $@ -lcrypto -lrt
+
${BUILD_ROOT}/%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -MMD -MF $@.d -c -o $@ $<