src/Makefile

Wed, 18 Sep 2024 00:02:18 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 18 Sep 2024 00:02:18 +0200
changeset 889
f549fd9fbd8f
parent 854
fe0d69d72bcd
child 899
303a981e6834
permissions
-rw-r--r--

apply binary search in cx_array_insert_sorted()

resolves #416
relates to #424

# Copyright 2023 Mike Becker. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

include ../config.mk

SRC = allocator.c array_list.c buffer.c compare.c hash_key.c hash_map.c \
  iterator.c linked_list.c list.c map.c mempool.c printf.c string.c tree.c \
  utils.c

OBJ_EXT=.o
OBJ=$(SRC:%.c=$(build_dir)/%$(OBJ_EXT))
GCOV=$(SRC:%.c=%.c.gcov)

static: $(build_dir)/libucx_static$(STLIB_EXT)

shared: $(build_dir)/libucx$(SHLIB_EXT)

check-coverage: $(GCOV)
	mv *.gcov "$(build_dir)"

%.c.gcov: %.c $(build_dir)/%.gcno
	@printf '%16s - %s\n' "$<" "`gcov -Ho "$(build_dir)" $< | grep --max-count=1 -i 'lines executed'`"

$(build_dir)/%.gcno:
	test -f "$@"

$(build_dir)/libucx_static$(STLIB_EXT): $(OBJ)
	$(AR) $(ARFLAGS) $@ $^

$(build_dir)/libucx$(SHLIB_EXT): $(OBJ)
	$(CC) $(LDFLAGS) -o $@ $^

install: $(build_dir)/libucx_static$(STLIB_EXT) $(build_dir)/libucx$(SHLIB_EXT)
	$(MKDIR) $(libdir) $(includedir)/cx
	$(RMFILE) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR)
	$(RMFILE) $(libdir)/libucx$(SHLIB_EXT)
	$(COPYFILE) $(build_dir)/libucx_static$(STLIB_EXT) $(libdir)/libucx_static$(STLIB_EXT)
	$(COPYFILE) $(build_dir)/libucx$(SHLIB_EXT) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION)
	$(COPYALL) $(src_dir)/src/cx $(includedir)
	$(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR)
	$(SYMLINK) $(libdir)/libucx$(SHLIB_EXT).$(LIBVERSION_MAJOR) $(libdir)/libucx$(SHLIB_EXT)

FORCE:

$(build_dir)/allocator$(OBJ_EXT): allocator.c cx/allocator.h cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/array_list$(OBJ_EXT): array_list.c cx/array_list.h cx/list.h \
 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \
 cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/buffer$(OBJ_EXT): buffer.c cx/buffer.h cx/common.h \
 cx/allocator.h cx/utils.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/compare$(OBJ_EXT): compare.c cx/compare.h cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/hash_key$(OBJ_EXT): hash_key.c cx/hash_key.h cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/hash_map$(OBJ_EXT): hash_map.c cx/hash_map.h cx/map.h \
 cx/common.h cx/collection.h cx/allocator.h cx/iterator.h cx/compare.h \
 cx/string.h cx/hash_key.h cx/utils.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/iterator$(OBJ_EXT): iterator.c cx/iterator.h cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/linked_list$(OBJ_EXT): linked_list.c cx/linked_list.h \
 cx/common.h cx/list.h cx/collection.h cx/allocator.h cx/iterator.h \
 cx/compare.h cx/utils.h cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/list$(OBJ_EXT): list.c cx/list.h cx/common.h cx/collection.h \
 cx/allocator.h cx/iterator.h cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/map$(OBJ_EXT): map.c cx/map.h cx/common.h cx/collection.h \
 cx/allocator.h cx/iterator.h cx/compare.h cx/string.h cx/hash_key.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/mempool$(OBJ_EXT): mempool.c cx/mempool.h cx/common.h \
 cx/allocator.h cx/utils.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/printf$(OBJ_EXT): printf.c cx/printf.h cx/common.h \
 cx/string.h cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/string$(OBJ_EXT): string.c cx/string.h cx/common.h \
 cx/allocator.h cx/utils.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/szmul$(OBJ_EXT): szmul.c
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/tree$(OBJ_EXT): tree.c cx/tree.h cx/common.h cx/iterator.h \
 cx/array_list.h cx/list.h cx/collection.h cx/allocator.h cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(build_dir)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

mercurial