summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-05-01 00:31:54 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-05-01 00:31:54 -0400
commit1dcd0f2efb6ecb2d4cbcd7302179c3b48b5c8c23 (patch)
tree24e8fff82afef8b90bb2a40a5eec3566219dfe5c /Makefile
parent0c1b29f06ddcfda2cf47461f846ddee0a320567d (diff)
Update makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files 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)