src/Makefile

Tue, 26 Nov 2024 21:53:06 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 26 Nov 2024 21:53:06 +0100
changeset 991
ec49db06dae0
parent 988
15b3ca7ee33f
permissions
-rw-r--r--

cxBufferFree() now calls cxBufferDestroy()

# 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 \
  streams.c szmul.c properties.c json.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
	@tabs 22
	@gcov -Ho "$(build_dir)" $< | grep -A1 'File' | grep -v '\--' \
		| sed 's/File /  /' | sed 's/Lines executed:/\t/' | tr -d '\n'"'" \
		| sed -E 's/(of [0-9]+)/\1\n/g'
	@tabs -8

$(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
	@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
	@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)/json$(OBJ_EXT): json.c cx/json.h cx/common.h cx/string.h \
 cx/allocator.h cx/array_list.h cx/list.h cx/collection.h cx/iterator.h \
 cx/compare.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/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
	@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)/properties$(OBJ_EXT): properties.c cx/properties.h \
 cx/common.h cx/string.h cx/allocator.h cx/map.h cx/collection.h \
 cx/iterator.h cx/compare.h cx/hash_key.h cx/array_list.h cx/list.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS)  -c $<

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

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

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

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

mercurial