tests/Makefile

changeset 1710
d53be93acc10
parent 1591
ef2f47fc5f0c
equal deleted inserted replaced
1709:560a60fcf6ee 1710:d53be93acc10
38 ucxtest.c 38 ucxtest.c
39 39
40 OBJ_EXT=.o 40 OBJ_EXT=.o
41 OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT)) 41 OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT))
42 42
43 all: $(TEST_DIR) $(TEST_DIR)/ucxtest 43 all: $(TEST_DIR) $(TEST_DIR)/ucxtest $(TEST_DIR)/test_header_only$(OBJ_EXT)
44 44
45 $(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a 45 $(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a
46 $(CC) -o $@ $(LDFLAGS) $+ 46 $(CC) -o $@ $(LDFLAGS) $+
47
48 # tests that the test.h can be used header-only
49 $(TEST_DIR)/test_header_only$(OBJ_EXT): ../src/cx/test.h
50 @echo "Checking if test.h is standalone"
51 $(CC) -o "$@" -c test_header_only.c
47 52
48 $(build_dir)/libucx_static.a: 53 $(build_dir)/libucx_static.a:
49 test -f "$@" 54 test -f "$@"
50 55
51 $(TEST_DIR): 56 $(TEST_DIR):
52 $(MKDIR) $@/ 57 $(MKDIR) $@/
53 58
54 FORCE: 59 FORCE:
55 60
56 $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \ 61 $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \
57 ../src/cx/common.h ../src/cx/allocator.h 62 ../src/cx/allocator.h ../src/cx/common.h
58 @echo "Compiling $<" 63 @echo "Compiling $<"
59 $(CC) -o $@ $(CFLAGS) -I../src -c $< 64 $(CC) -o $@ $(CFLAGS) -I../src -c $<
60 65
61 $(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \ 66 $(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \
62 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 67 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
63 ../src/cx/buffer.h ../src/cx/allocator.h ../src/cx/string.h 68 ../src/cx/buffer.h ../src/cx/allocator.h ../src/cx/string.h
64 @echo "Compiling $<" 69 @echo "Compiling $<"
65 $(CC) -o $@ $(CFLAGS) -I../src -c $< 70 $(CC) -o $@ $(CFLAGS) -I../src -c $<
66 71
67 $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \ 72 $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \
68 ../src/cx/common.h ../src/cx/compare.h 73 ../src/cx/compare.h ../src/cx/common.h
69 @echo "Compiling $<" 74 @echo "Compiling $<"
70 $(CC) -o $@ $(CFLAGS) -I../src -c $< 75 $(CC) -o $@ $(CFLAGS) -I../src -c $<
71 76
72 $(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \ 77 $(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \
73 ../src/cx/common.h ../src/cx/hash_key.h ../src/cx/string.h \ 78 ../src/cx/hash_key.h ../src/cx/common.h ../src/cx/string.h \
74 ../src/cx/allocator.h ../src/cx/string.h 79 ../src/cx/allocator.h ../src/cx/string.h
75 @echo "Compiling $<" 80 @echo "Compiling $<"
76 $(CC) -o $@ $(CFLAGS) -I../src -c $< 81 $(CC) -o $@ $(CFLAGS) -I../src -c $<
77 82
78 $(TEST_DIR)/test_hash_map$(OBJ_EXT): test_hash_map.c ../src/cx/test.h \ 83 $(TEST_DIR)/test_hash_map$(OBJ_EXT): test_hash_map.c ../src/cx/test.h \
79 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 84 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
80 ../src/cx/array_list.h ../src/cx/list.h ../src/cx/collection.h \ 85 ../src/cx/array_list.h ../src/cx/list.h ../src/cx/collection.h \
81 ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \ 86 ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \
82 ../src/cx/list.h ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/string.h \ 87 ../src/cx/list.h ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/string.h \
83 ../src/cx/hash_key.h 88 ../src/cx/hash_key.h
84 @echo "Compiling $<" 89 @echo "Compiling $<"
85 $(CC) -o $@ $(CFLAGS) -I../src -c $< 90 $(CC) -o $@ $(CFLAGS) -I../src -c $<
86 91
87 $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \ 92 $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \
88 ../src/cx/common.h ../src/cx/iterator.h 93 ../src/cx/iterator.h ../src/cx/common.h
89 @echo "Compiling $<" 94 @echo "Compiling $<"
90 $(CC) -o $@ $(CFLAGS) -I../src -c $< 95 $(CC) -o $@ $(CFLAGS) -I../src -c $<
91 96
92 $(TEST_DIR)/test_json$(OBJ_EXT): test_json.c util_allocator.h \ 97 $(TEST_DIR)/test_json$(OBJ_EXT): test_json.c util_allocator.h \
93 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/test.h \ 98 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/test.h \
97 ../src/cx/map.h ../src/cx/hash_key.h ../src/cx/compare.h 102 ../src/cx/map.h ../src/cx/hash_key.h ../src/cx/compare.h
98 @echo "Compiling $<" 103 @echo "Compiling $<"
99 $(CC) -o $@ $(CFLAGS) -I../src -c $< 104 $(CC) -o $@ $(CFLAGS) -I../src -c $<
100 105
101 $(TEST_DIR)/test_kv_list$(OBJ_EXT): test_kv_list.c ../src/cx/test.h \ 106 $(TEST_DIR)/test_kv_list$(OBJ_EXT): test_kv_list.c ../src/cx/test.h \
102 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 107 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
103 ../src/cx/kv_list.h ../src/cx/list.h ../src/cx/collection.h \ 108 ../src/cx/kv_list.h ../src/cx/list.h ../src/cx/collection.h \
104 ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \ 109 ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \
105 ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h 110 ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h
106 @echo "Compiling $<" 111 @echo "Compiling $<"
107 $(CC) -o $@ $(CFLAGS) -I../src -c $< 112 $(CC) -o $@ $(CFLAGS) -I../src -c $<
108 113
109 $(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \ 114 $(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \
110 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 115 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
111 ../src/cx/compare.h ../src/cx/array_list.h ../src/cx/list.h \ 116 ../src/cx/compare.h ../src/cx/array_list.h ../src/cx/list.h \
112 ../src/cx/collection.h ../src/cx/allocator.h ../src/cx/iterator.h \ 117 ../src/cx/collection.h ../src/cx/allocator.h ../src/cx/iterator.h \
113 ../src/cx/compare.h ../src/cx/linked_list.h ../src/cx/kv_list.h \ 118 ../src/cx/compare.h ../src/cx/linked_list.h ../src/cx/kv_list.h \
114 ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h 119 ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h
115 @echo "Compiling $<" 120 @echo "Compiling $<"
116 $(CC) -o $@ $(CFLAGS) -I../src -c $< 121 $(CC) -o $@ $(CFLAGS) -I../src -c $<
117 122
118 $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \ 123 $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \
119 ../src/cx/common.h ../src/cx/mempool.h ../src/cx/allocator.h 124 ../src/cx/mempool.h ../src/cx/common.h ../src/cx/allocator.h
120 @echo "Compiling $<" 125 @echo "Compiling $<"
121 $(CC) -o $@ $(CFLAGS) -I../src -c $< 126 $(CC) -o $@ $(CFLAGS) -I../src -c $<
122 127
123 $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \ 128 $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \
124 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 129 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
125 ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \ 130 ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \
126 ../src/cx/buffer.h 131 ../src/cx/buffer.h
127 @echo "Compiling $<" 132 @echo "Compiling $<"
128 $(CC) -o $@ $(CFLAGS) -I../src -c $< 133 $(CC) -o $@ $(CFLAGS) -I../src -c $<
129 134
130 $(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \ 135 $(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \
131 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 136 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
132 ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \ 137 ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \
133 ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \ 138 ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \
134 ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/buffer.h \ 139 ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/buffer.h \
135 ../src/cx/hash_map.h 140 ../src/cx/hash_map.h
136 @echo "Compiling $<" 141 @echo "Compiling $<"
137 $(CC) -o $@ $(CFLAGS) -I../src -c $< 142 $(CC) -o $@ $(CFLAGS) -I../src -c $<
138 143
139 $(TEST_DIR)/test_streams$(OBJ_EXT): test_streams.c ../src/cx/test.h \ 144 $(TEST_DIR)/test_streams$(OBJ_EXT): test_streams.c ../src/cx/test.h \
140 ../src/cx/common.h ../src/cx/streams.h ../src/cx/buffer.h \ 145 ../src/cx/streams.h ../src/cx/common.h ../src/cx/buffer.h \
141 ../src/cx/allocator.h ../src/cx/string.h 146 ../src/cx/allocator.h ../src/cx/string.h
142 @echo "Compiling $<" 147 @echo "Compiling $<"
143 $(CC) -o $@ $(CFLAGS) -I../src -c $< 148 $(CC) -o $@ $(CFLAGS) -I../src -c $<
144 149
145 $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \ 150 $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \
146 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 151 util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
147 ../src/cx/string.h ../src/cx/allocator.h ../src/cx/compare.h 152 ../src/cx/string.h ../src/cx/allocator.h ../src/cx/compare.h
148 @echo "Compiling $<" 153 @echo "Compiling $<"
149 $(CC) -o $@ $(CFLAGS) -I../src -c $< 154 $(CC) -o $@ $(CFLAGS) -I../src -c $<
150 155
151 $(TEST_DIR)/test_szmul$(OBJ_EXT): test_szmul.c ../src/cx/test.h \ 156 $(TEST_DIR)/test_szmul$(OBJ_EXT): test_szmul.c ../src/cx/test.h \

mercurial