tests/Makefile

changeset 766
e59b76889f00
parent 756
0b635553b86a
child 767
d31f4d4075dc
--- a/tests/Makefile	Mon Dec 18 18:54:17 2023 +0100
+++ b/tests/Makefile	Wed Dec 20 16:46:14 2023 +0100
@@ -23,13 +23,42 @@
 
 include ../config.mk
 
+CFLAGS += -I../src
+
 TEST_DIR=$(build_dir)/tests
 
-all: $(TEST_DIR) $(build_dir)/libucx_static.a
-	cd $(TEST_DIR) && $(CMAKE) -DSTLIB_EXT="$(STLIB_EXT)" "$(src_dir)/tests" && $(CMAKE) --build .
-	@echo "[ Tests complete ]"
+SRC = test_utils.c ucxtest.o
+
+OBJ_EXT=.o
+OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT))
 
-# do not define libucx.a target - if it wasn't build, we simply fail!
+all: $(TEST_DIR) $(TEST_DIR)/ucxtest
+
+$(TEST_DIR)/ucxtest: $(build_dir)/libucx_static.a $(OBJ)
+	$(CC) -o $@ $+
+
+$(build_dir)/libucx_static.a:
+	test -f "$@"
 
 $(TEST_DIR):
-	$(MKDIR) $@
\ No newline at end of file
+	$(MKDIR) $@
+
+FORCE:
+
+$(TEST_DIR)/test_map_generics$(OBJ_EXT): test_map_generics.c \
+ test_map_generics.h ../src/cx/map.h ../src/cx/common.h \
+ ../src/cx/collection.h ../src/cx/allocator.h ../src/cx/iterator.h \
+ ../src/cx/string.h ../src/cx/hash_key.h ../src/cx/hash_map.h \
+ ../src/cx/map.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(TEST_DIR)/test_utils$(OBJ_EXT): test_utils.c test_utils.h \
+ ../src/cx/test.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c test_utils.h ../src/cx/test.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+

mercurial