From 1dcd0f2efb6ecb2d4cbcd7302179c3b48b5c8c23 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Wed, 1 May 2024 00:31:54 -0400 Subject: Update makefile --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fee1c82..9c1555e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,21 @@ SRC_DIR = src BUILD_DIR = build -INCLUDE_DIR = include +OBJ_DIR = $(BUILD_DIR)/artifacts +INCLUDE_DIR = ./include -SRCS = $(wildcard $SRC_DIR/*.c) -OBJS = $(addprefix $(BUILD_DIR)/artifacts, $(addsuffix .o, $(basename $(SRCS)))) +SRCS = $(notdir $(wildcard $(SRC_DIR)/*.c)) +OBJS = $(addsuffix .o, $(basename $(SRCS))) + +CFLAGS ?= -Werror -Wall + +build: build_dir $(OBJS) + $(CC) -shared -o $(BUILD_DIR)/libopensmarts.so $(addprefix $(OBJ_DIR)/, $(OBJS)) + +%.o: $(SRC_DIR)/%.c + $(CC) $(CFLAGS) -c -fpic -I$(INCLUDE_DIR) -o $(BUILD_DIR)/artifacts/$@ $< + +build_dir: + mkdir -p $(BUILD_DIR) + mkdir -p $(OBJ_DIR) -build: $(OBJS) - gcc -shared -o $(BUILD_DIR)/libopensmarts.so $(OBJS) -- cgit v1.2.3