universe@753: # Copyright 2023 Mike Becker. All rights reserved. universe@753: # universe@753: # Redistribution and use in source and binary forms, with or without universe@753: # modification, are permitted provided that the following conditions are met: universe@753: # universe@753: # 1. Redistributions of source code must retain the above copyright universe@753: # notice, this list of conditions and the following disclaimer. universe@753: # universe@753: # 2. Redistributions in binary form must reproduce the above copyright universe@753: # notice, this list of conditions and the following disclaimer in the universe@753: # documentation and/or other materials provided with the distribution. universe@753: # universe@753: # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@753: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@753: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE universe@753: # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE universe@753: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL universe@753: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR universe@753: # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER universe@753: # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, universe@753: # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE universe@753: # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. universe@753: universe@753: include ../config.mk universe@753: universe@753: SRC = allocator.c array_list.c buffer.c compare.c hash_key.c hash_map.c \ universe@816: linked_list.c list.c map.c tree.c mempool.c printf.c string.c utils.c universe@753: universe@753: OBJ_EXT=.o universe@754: OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT)) universe@774: GCOV=$(SRC:%.c=%.c.gcov) universe@753: universe@754: static: $(build_dir)/libucx_static$(STLIB_EXT) universe@753: universe@754: shared: $(build_dir)/libucx$(SHLIB_EXT) universe@753: universe@774: check-coverage: $(GCOV) universe@774: mv *.gcov "$(build_dir)" universe@774: universe@774: %.c.gcov: %.c $(build_dir)/%.gcno universe@794: @printf '%16s - %s\n' "$<" "`gcov -Ho "$(build_dir)" $< | grep --max-count=1 -i 'lines executed'`" universe@774: universe@774: $(build_dir)/%.gcno: universe@774: test -f "$@" universe@774: universe@754: $(build_dir)/libucx_static$(STLIB_EXT): $(OBJ) universe@753: $(AR) $(ARFLAGS) $@ $^ universe@753: universe@754: $(build_dir)/libucx$(SHLIB_EXT): $(OBJ) universe@753: $(CC) $(LDFLAGS) -o $@ $^ universe@753: universe@754: install: $(build_dir)/libucx_static$(STLIB_EXT) $(build_dir)/libucx$(SHLIB_EXT) universe@765: $(MKDIR) $(libdir) $(includedir)/cx universe@754: $(RMFILE) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) universe@754: $(RMFILE) $(libdir)/libucx$(SHLIB_EXT) universe@754: $(COPYFILE) $(build_dir)/libucx_static$(STLIB_EXT) $(libdir)/libucx_static$(STLIB_EXT) universe@754: $(COPYFILE) $(build_dir)/libucx$(SHLIB_EXT) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) universe@765: $(COPYALL) $(src_dir)/src/cx $(includedir) universe@754: $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) universe@754: $(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) $(libdir)/libucx$(SHLIB_EXT) universe@753: universe@755: FORCE: universe@755: universe@754: $(build_dir)/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@754: $(build_dir)/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \ universe@766: cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h \ universe@755: cx/allocator.h cx/utils.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@754: $(build_dir)/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@754: $(build_dir)/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h \ universe@755: cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/string.h \ universe@755: cx/hash_key.h cx/utils.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h \ universe@755: cx/common.h cx/list.h cx/collection.h cx/allocator.h cx/iterator.h \ universe@766: cx/utils.h cx/compare.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@754: $(build_dir)/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \ universe@753: cx/allocator.h cx/iterator.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@754: $(build_dir)/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \ universe@753: cx/allocator.h cx/iterator.h cx/string.h cx/hash_key.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h \ universe@755: cx/allocator.h cx/utils.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h \ universe@755: cx/string.h cx/allocator.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@755: $(build_dir)/string$(OBJ_EXT): string.c cx/string.h cx/common.h \ universe@755: cx/allocator.h cx/utils.h universe@755: @echo "Compiling $<" universe@755: $(CC) -o $@ $(CFLAGS) -c $< universe@755: universe@755: $(build_dir)/szmul$(OBJ_EXT): szmul.c universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: universe@833: $(build_dir)/tree$(OBJ_EXT): tree.c cx/tree.h cx/common.h cx/iterator.h \ universe@833: cx/array_list.h cx/list.h cx/collection.h cx/allocator.h universe@816: @echo "Compiling $<" universe@816: $(CC) -o $@ $(CFLAGS) -c $< universe@816: universe@754: $(build_dir)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h universe@755: @echo "Compiling $<" universe@753: $(CC) -o $@ $(CFLAGS) -c $< universe@753: