src/Makefile

changeset 753
24dc84788dee
child 754
4bc7d966c9db
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Makefile	Thu Oct 12 00:00:35 2023 +0200
@@ -0,0 +1,107 @@
+# 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 \
+  linked_list.c list.c map.c mempool.c printf.c string.c utils.c
+
+OBJ_EXT=.o
+OBJ=$(SRC:%.c=$(BUILD_DIR)/%$(OBJ_EXT))
+
+static: $(BUILD_DIR)/libucx$(STLIB_EXT)
+
+shared: $(BUILD_DIR)/libucx$(SHLIB_EXT)
+
+$(BUILD_DIR)/libucx$(STLIB_EXT): $(OBJ)
+	$(AR) $(ARFLAGS) $@ $^
+
+$(BUILD_DIR)/libucx$(SHLIB_EXT): $(OBJ)
+	$(CC) $(LDFLAGS) -o $@ $^
+
+install:
+	@echo "[ not supported yet ]"
+
+
+$(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
+	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/string.h cx/hash_key.h \
+ cx/utils.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/utils.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
+	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/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)/utils$(OBJ_EXT): utils.c cx/utils.h cx/common.h
+	echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+

mercurial