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