Sat, 08 Jun 2024 20:08:09 +0200
add cxIteratorRef() macro
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@753 | 26 | SRC = allocator.c array_list.c buffer.c compare.c hash_key.c hash_map.c \ |
universe@850 | 27 | iterator.c linked_list.c list.c map.c mempool.c printf.c string.c tree.c \ |
universe@850 | 28 | utils.c |
universe@753 | 29 | |
universe@753 | 30 | OBJ_EXT=.o |
universe@754 | 31 | OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT)) |
universe@774 | 32 | GCOV=$(SRC:%.c=%.c.gcov) |
universe@753 | 33 | |
universe@754 | 34 | static: $(build_dir)/libucx_static$(STLIB_EXT) |
universe@753 | 35 | |
universe@754 | 36 | shared: $(build_dir)/libucx$(SHLIB_EXT) |
universe@753 | 37 | |
universe@774 | 38 | check-coverage: $(GCOV) |
universe@774 | 39 | mv *.gcov "$(build_dir)" |
universe@774 | 40 | |
universe@774 | 41 | %.c.gcov: %.c $(build_dir)/%.gcno |
universe@794 | 42 | @printf '%16s - %s\n' "$<" "`gcov -Ho "$(build_dir)" $< | grep --max-count=1 -i 'lines executed'`" |
universe@774 | 43 | |
universe@774 | 44 | $(build_dir)/%.gcno: |
universe@774 | 45 | test -f "$@" |
universe@774 | 46 | |
universe@754 | 47 | $(build_dir)/libucx_static$(STLIB_EXT): $(OBJ) |
universe@753 | 48 | $(AR) $(ARFLAGS) $@ $^ |
universe@753 | 49 | |
universe@754 | 50 | $(build_dir)/libucx$(SHLIB_EXT): $(OBJ) |
universe@753 | 51 | $(CC) $(LDFLAGS) -o $@ $^ |
universe@753 | 52 | |
universe@754 | 53 | install: $(build_dir)/libucx_static$(STLIB_EXT) $(build_dir)/libucx$(SHLIB_EXT) |
universe@765 | 54 | $(MKDIR) $(libdir) $(includedir)/cx |
universe@754 | 55 | $(RMFILE) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) |
universe@754 | 56 | $(RMFILE) $(libdir)/libucx$(SHLIB_EXT) |
universe@754 | 57 | $(COPYFILE) $(build_dir)/libucx_static$(STLIB_EXT) $(libdir)/libucx_static$(STLIB_EXT) |
universe@754 | 58 | $(COPYFILE) $(build_dir)/libucx$(SHLIB_EXT) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) |
universe@765 | 59 | $(COPYALL) $(src_dir)/src/cx $(includedir) |
universe@754 | 60 | $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) |
universe@754 | 61 | $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) $(libdir)/libucx$(SHLIB_EXT) |
universe@753 | 62 | |
universe@755 | 63 | FORCE: |
universe@755 | 64 | |
universe@754 | 65 | $(build_dir)/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h |
universe@755 | 66 | @echo "Compiling $<" |
universe@753 | 67 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 68 | |
universe@754 | 69 | $(build_dir)/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \ |
universe@854 | 70 | cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \ |
universe@854 | 71 | cx/compare.h |
universe@755 | 72 | @echo "Compiling $<" |
universe@753 | 73 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 74 | |
universe@755 | 75 | $(build_dir)/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h \ |
universe@755 | 76 | cx/allocator.h cx/utils.h |
universe@755 | 77 | @echo "Compiling $<" |
universe@753 | 78 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 79 | |
universe@754 | 80 | $(build_dir)/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h |
universe@755 | 81 | @echo "Compiling $<" |
universe@753 | 82 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 83 | |
universe@754 | 84 | $(build_dir)/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h |
universe@755 | 85 | @echo "Compiling $<" |
universe@753 | 86 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 87 | |
universe@755 | 88 | $(build_dir)/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h \ |
universe@854 | 89 | cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \ |
universe@854 | 90 | cx/string.h cx/hash_key.h cx/utils.h |
universe@755 | 91 | @echo "Compiling $<" |
universe@753 | 92 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 93 | |
universe@850 | 94 | $(build_dir)/iterator$(OBJ_EXT): iterator.c cx/iterator.h cx/common.h |
universe@850 | 95 | @echo "Compiling $<" |
universe@850 | 96 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@850 | 97 | |
universe@755 | 98 | $(build_dir)/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h \ |
universe@755 | 99 | cx/common.h cx/list.h cx/collection.h cx/allocator.h cx/iterator.h \ |
universe@854 | 100 | cx/compare.h cx/utils.h cx/compare.h |
universe@755 | 101 | @echo "Compiling $<" |
universe@753 | 102 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 103 | |
universe@754 | 104 | $(build_dir)/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \ |
universe@854 | 105 | cx/allocator.h cx/iterator.h cx/compare.h |
universe@755 | 106 | @echo "Compiling $<" |
universe@753 | 107 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 108 | |
universe@754 | 109 | $(build_dir)/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \ |
universe@854 | 110 | cx/allocator.h cx/iterator.h cx/compare.h cx/string.h cx/hash_key.h |
universe@755 | 111 | @echo "Compiling $<" |
universe@753 | 112 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 113 | |
universe@755 | 114 | $(build_dir)/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h \ |
universe@755 | 115 | cx/allocator.h cx/utils.h |
universe@755 | 116 | @echo "Compiling $<" |
universe@753 | 117 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 118 | |
universe@755 | 119 | $(build_dir)/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h \ |
universe@755 | 120 | cx/string.h cx/allocator.h |
universe@755 | 121 | @echo "Compiling $<" |
universe@753 | 122 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 123 | |
universe@755 | 124 | $(build_dir)/string$(OBJ_EXT): string.c cx/string.h cx/common.h \ |
universe@755 | 125 | cx/allocator.h cx/utils.h |
universe@755 | 126 | @echo "Compiling $<" |
universe@755 | 127 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@755 | 128 | |
universe@755 | 129 | $(build_dir)/szmul$(OBJ_EXT): szmul.c |
universe@755 | 130 | @echo "Compiling $<" |
universe@753 | 131 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 132 | |
universe@833 | 133 | $(build_dir)/tree$(OBJ_EXT): tree.c cx/tree.h cx/common.h cx/iterator.h \ |
universe@854 | 134 | cx/array_list.h cx/list.h cx/collection.h cx/allocator.h cx/compare.h |
universe@816 | 135 | @echo "Compiling $<" |
universe@816 | 136 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@816 | 137 | |
universe@754 | 138 | $(build_dir)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h |
universe@755 | 139 | @echo "Compiling $<" |
universe@753 | 140 | $(CC) -o $@ $(CFLAGS) -c $< |
universe@753 | 141 |