Thu, 23 May 2024 20:43:04 +0200
fix name of collection base member (to avoid base.base)
1 # Copyright 2023 Mike Becker. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are met:
5 #
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 #
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 #
13 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 include ../config.mk
26 CFLAGS += -I../src
28 TEST_DIR=$(build_dir)/tests
30 SRC = util_allocator.c test_utils.c test_hash_key.c test_allocator.c \
31 test_compare.c test_string.c test_buffer.c test_iterator.c \
32 test_list.c test_tree.c test_hash_map.c \
33 test_printf.c test_mempool.c ucxtest.c
35 OBJ_EXT=.o
36 OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT))
38 all: $(TEST_DIR) $(TEST_DIR)/ucxtest
40 $(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a
41 $(CC) -o $@ $(LDFLAGS) $+
43 $(build_dir)/libucx_static.a:
44 test -f "$@"
46 $(TEST_DIR):
47 $(MKDIR) $@
49 FORCE:
51 $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \
52 ../src/cx/allocator.h ../src/cx/common.h
53 @echo "Compiling $<"
54 $(CC) -o $@ $(CFLAGS) -c $<
56 $(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \
57 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
58 ../src/cx/buffer.h ../src/cx/allocator.h
59 @echo "Compiling $<"
60 $(CC) -o $@ $(CFLAGS) -c $<
62 $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \
63 ../src/cx/compare.h ../src/cx/common.h
64 @echo "Compiling $<"
65 $(CC) -o $@ $(CFLAGS) -c $<
67 $(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \
68 ../src/cx/hash_key.h ../src/cx/common.h ../src/cx/string.h \
69 ../src/cx/allocator.h
70 @echo "Compiling $<"
71 $(CC) -o $@ $(CFLAGS) -c $<
73 $(TEST_DIR)/test_hash_map$(OBJ_EXT): test_hash_map.c ../src/cx/test.h \
74 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
75 ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/collection.h \
76 ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \
77 ../src/cx/string.h ../src/cx/hash_key.h
78 @echo "Compiling $<"
79 $(CC) -o $@ $(CFLAGS) -c $<
81 $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \
82 ../src/cx/iterator.h ../src/cx/common.h
83 @echo "Compiling $<"
84 $(CC) -o $@ $(CFLAGS) -c $<
86 $(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \
87 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
88 ../src/cx/compare.h ../src/cx/utils.h ../src/cx/array_list.h \
89 ../src/cx/list.h ../src/cx/collection.h ../src/cx/allocator.h \
90 ../src/cx/iterator.h ../src/cx/compare.h ../src/cx/linked_list.h
91 @echo "Compiling $<"
92 $(CC) -o $@ $(CFLAGS) -c $<
94 $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \
95 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
96 ../src/cx/mempool.h ../src/cx/allocator.h
97 @echo "Compiling $<"
98 $(CC) -o $@ $(CFLAGS) -c $<
100 $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \
101 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
102 ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \
103 ../src/cx/buffer.h
104 @echo "Compiling $<"
105 $(CC) -o $@ $(CFLAGS) -c $<
107 $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \
108 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
109 ../src/cx/string.h ../src/cx/allocator.h
110 @echo "Compiling $<"
111 $(CC) -o $@ $(CFLAGS) -c $<
113 $(TEST_DIR)/test_tree$(OBJ_EXT): test_tree.c ../src/cx/tree.h \
114 ../src/cx/common.h ../src/cx/iterator.h ../src/cx/test.h \
115 util_allocator.h ../src/cx/allocator.h
116 @echo "Compiling $<"
117 $(CC) -o $@ $(CFLAGS) -c $<
119 $(TEST_DIR)/test_utils$(OBJ_EXT): test_utils.c ../src/cx/test.h \
120 ../src/cx/utils.h ../src/cx/common.h ../src/cx/buffer.h \
121 ../src/cx/allocator.h ../src/szmul.c
122 @echo "Compiling $<"
123 $(CC) -o $@ $(CFLAGS) -c $<
125 $(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c ../src/cx/test.h
126 @echo "Compiling $<"
127 $(CC) -o $@ $(CFLAGS) -c $<
129 $(TEST_DIR)/util_allocator$(OBJ_EXT): util_allocator.c util_allocator.h \
130 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/test.h
131 @echo "Compiling $<"
132 $(CC) -o $@ $(CFLAGS) -c $<