diff options
Diffstat (limited to '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) |