tests/Makefile

Sun, 03 Nov 2024 16:01:55 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 03 Nov 2024 16:01:55 +0100
changeset 979
bbae1ebf309b
parent 971
cc204fc56c9c
permissions
-rw-r--r--

fix broken docs target after uwproj update

# 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

CFLAGS += -I../src

TEST_DIR=$(build_dir)/tests

SRC = util_allocator.c \
	test_szmul.c test_allocator.c \
	test_compare.c \
	test_string.c test_buffer.c \
	test_hash_key.c test_hash_map.c \
	test_iterator.c test_list.c test_tree.c \
	test_properties.c test_json.c \
	test_printf.c test_streams.c \
	test_mempool.c \
	ucxtest.c

OBJ_EXT=.o
OBJ=$(SRC:%.c=$(TEST_DIR)/%$(OBJ_EXT))

all: $(TEST_DIR) $(TEST_DIR)/ucxtest

$(TEST_DIR)/ucxtest: $(OBJ) $(build_dir)/libucx_static.a
	$(CC) -o $@ $(LDFLAGS) $+

$(build_dir)/libucx_static.a:
	test -f "$@"

$(TEST_DIR):
	$(MKDIR) $@

FORCE:

$(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/buffer.h ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/hash_key.h ../src/cx/string.h \
 ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

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

$(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/iterator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_json$(OBJ_EXT): test_json.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/json.h ../src/cx/string.h \
 ../src/cx/allocator.h ../src/cx/array_list.h ../src/cx/list.h \
 ../src/cx/collection.h ../src/cx/iterator.h ../src/cx/compare.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/compare.h ../src/cx/array_list.h ../src/cx/list.h \
 ../src/cx/collection.h ../src/cx/allocator.h ../src/cx/iterator.h \
 ../src/cx/compare.h ../src/cx/linked_list.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/mempool.h ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \
 ../src/cx/buffer.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \
 ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \
 ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/array_list.h \
 ../src/cx/list.h ../src/cx/hash_map.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_streams$(OBJ_EXT): test_streams.c ../src/cx/test.h \
 ../src/cx/common.h ../src/cx/streams.h ../src/cx/buffer.h \
 ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \
 ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
 ../src/cx/string.h ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_szmul$(OBJ_EXT): test_szmul.c ../src/cx/test.h \
 ../src/cx/common.h ../src/szmul.c ../src/cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/test_tree$(OBJ_EXT): test_tree.c ../src/cx/tree.h \
 ../src/cx/common.h ../src/cx/collection.h ../src/cx/allocator.h \
 ../src/cx/iterator.h ../src/cx/compare.h ../src/cx/test.h \
 util_allocator.h ../src/cx/allocator.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c ../src/cx/common.h \
 ../src/cx/test.h ../src/cx/common.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

$(TEST_DIR)/util_allocator$(OBJ_EXT): util_allocator.c util_allocator.h \
 ../src/cx/allocator.h ../src/cx/common.h ../src/cx/test.h
	@echo "Compiling $<"
	$(CC) -o $@ $(CFLAGS) -c $<

mercurial