diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-05-01 00:31:54 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-05-01 00:31:54 -0400 |
commit | 1dcd0f2efb6ecb2d4cbcd7302179c3b48b5c8c23 (patch) | |
tree | 24e8fff82afef8b90bb2a40a5eec3566219dfe5c | |
parent | 0c1b29f06ddcfda2cf47461f846ddee0a320567d (diff) |
Update makefile
-rw-r--r-- | Makefile | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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) |