UNIXworkcode

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. 23 24 include ../config.mk 25 26 TEST_DIR=$(build_dir)/tests 27 28 SRC = util_allocator.c \ 29 test_szmul.c test_allocator.c \ 30 test_compare.c \ 31 test_string.c test_buffer.c \ 32 test_hash_key.c test_hash_map.c \ 33 test_iterator.c test_list.c test_tree.c \ 34 test_kv_list.c \ 35 test_properties.c test_json.c \ 36 test_printf.c test_streams.c \ 37 test_mempool.c \ 38 ucxtest.c 39 40 OBJ_EXT=.o 41 OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT)) 42 43 all: $(TEST_DIR) $(TEST_DIR)/ucxtest 44 45 $(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a 46 $(CC) -o $@ $(LDFLAGS) $+ 47 48 $(build_dir)/libucx_static.a: 49 test -f "$@" 50 51 $(TEST_DIR): 52 $(MKDIR) $@/ 53 54 FORCE: 55 56 $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \ 57 ../src/cx/common.h ../src/cx/allocator.h 58 @echo "Compiling $<" 59 $(CC) -o $@ $(CFLAGS) -I../src -c $< 60 61 $(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 \ 63 ../src/cx/buffer.h ../src/cx/allocator.h 64 @echo "Compiling $<" 65 $(CC) -o $@ $(CFLAGS) -I../src -c $< 66 67 $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \ 68 ../src/cx/common.h ../src/cx/compare.h 69 @echo "Compiling $<" 70 $(CC) -o $@ $(CFLAGS) -I../src -c $< 71 72 $(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 \ 74 ../src/cx/allocator.h ../src/cx/string.h 75 @echo "Compiling $<" 76 $(CC) -o $@ $(CFLAGS) -I../src -c $< 77 78 $(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 \ 80 ../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 \ 82 ../src/cx/list.h ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/string.h \ 83 ../src/cx/hash_key.h 84 @echo "Compiling $<" 85 $(CC) -o $@ $(CFLAGS) -I../src -c $< 86 87 $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \ 88 ../src/cx/common.h ../src/cx/iterator.h 89 @echo "Compiling $<" 90 $(CC) -o $@ $(CFLAGS) -I../src -c $< 91 92 $(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 \ 94 ../src/cx/json.h ../src/cx/allocator.h ../src/cx/string.h \ 95 ../src/cx/buffer.h ../src/cx/array_list.h ../src/cx/list.h \ 96 ../src/cx/collection.h ../src/cx/iterator.h ../src/cx/compare.h \ 97 ../src/cx/map.h ../src/cx/hash_key.h ../src/cx/compare.h 98 @echo "Compiling $<" 99 $(CC) -o $@ $(CFLAGS) -I../src -c $< 100 101 $(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 \ 103 ../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 \ 105 ../src/cx/map.h ../src/cx/string.h ../src/cx/hash_key.h 106 @echo "Compiling $<" 107 $(CC) -o $@ $(CFLAGS) -I../src -c $< 108 109 $(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 \ 111 ../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 \ 113 ../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 115 @echo "Compiling $<" 116 $(CC) -o $@ $(CFLAGS) -I../src -c $< 117 118 $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \ 119 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 120 ../src/cx/mempool.h ../src/cx/allocator.h 121 @echo "Compiling $<" 122 $(CC) -o $@ $(CFLAGS) -I../src -c $< 123 124 $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \ 125 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 126 ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \ 127 ../src/cx/buffer.h 128 @echo "Compiling $<" 129 $(CC) -o $@ $(CFLAGS) -I../src -c $< 130 131 $(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \ 132 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 133 ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \ 134 ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \ 135 ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/buffer.h \ 136 ../src/cx/hash_map.h 137 @echo "Compiling $<" 138 $(CC) -o $@ $(CFLAGS) -I../src -c $< 139 140 $(TEST_DIR)/test_streams$(OBJ_EXT): test_streams.c ../src/cx/test.h \ 141 ../src/cx/common.h ../src/cx/streams.h ../src/cx/buffer.h \ 142 ../src/cx/allocator.h 143 @echo "Compiling $<" 144 $(CC) -o $@ $(CFLAGS) -I../src -c $< 145 146 $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \ 147 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \ 148 ../src/cx/string.h ../src/cx/allocator.h ../src/cx/compare.h 149 @echo "Compiling $<" 150 $(CC) -o $@ $(CFLAGS) -I../src -c $< 151 152 $(TEST_DIR)/test_szmul$(OBJ_EXT): test_szmul.c ../src/cx/test.h \ 153 ../src/cx/common.h ../src/szmul.c ../src/cx/common.h 154 @echo "Compiling $<" 155 $(CC) -o $@ $(CFLAGS) -I../src -c $< 156 157 $(TEST_DIR)/test_tree$(OBJ_EXT): test_tree.c ../src/cx/tree.h \ 158 ../src/cx/common.h ../src/cx/collection.h ../src/cx/allocator.h \ 159 ../src/cx/iterator.h ../src/cx/compare.h ../src/cx/test.h \ 160 util_allocator.h ../src/cx/allocator.h 161 @echo "Compiling $<" 162 $(CC) -o $@ $(CFLAGS) -I../src -c $< 163 164 $(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c util_allocator.h \ 165 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/common.h \ 166 ../src/cx/test.h 167 @echo "Compiling $<" 168 $(CC) -o $@ $(CFLAGS) -I../src -c $< 169 170 $(TEST_DIR)/util_allocator$(OBJ_EXT): util_allocator.c util_allocator.h \ 171 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/test.h 172 @echo "Compiling $<" 173 $(CC) -o $@ $(CFLAGS) -I../src -c $< 174 175