refactor: separate directory for thirdparty code

Jef Roosens 2023-02-02 11:16:47 +01:00
parent 031e28ed33
commit bfa1130478
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 11 additions and 3 deletions

View File

@ -6,15 +6,20 @@ LIB_FILENAME ?= libvieter.a
BUILD_DIR ?= build
SRC_DIR ?= src
TEST_DIR ?= test
INC_DIRS ?= include
3RDPARTY_DIR ?= thirdparty
INCLUDE_DIR ?= include
INC_DIRS ?= $(INCLUDE_DIR) $(3RDPARTY_DIR)/include
LIB := $(BUILD_DIR)/$(LIB_FILENAME)
SRCS != find '$(SRC_DIR)' -iname '*.c'
SRCS_H != find $(INC_DIRS) -iname '*.h'
SRCS_H != find $(INCLUDE_DIR) -iname '*.h'
SRCS_TEST != find '$(TEST_DIR)' -iname '*.c'
SRCS_3RDPARTY != find '$(3RDPARTY_DIR)/src' -iname '*.c'
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
$(info ${SRCS})
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) $(SRCS_3RDPARTY:%=$(BUILD_DIR)/%.o)
OBJS_TEST := $(SRCS_TEST:%=$(BUILD_DIR)/%.o)
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d) $(SRCS_TEST:%=$(BUILD_DIR)/%.d)
@ -51,6 +56,9 @@ $(BUILD_DIR)/$(SRC_DIR)/%.c.o: $(SRC_DIR)/%.c
mkdir -p $(dir $@)
$(CC) $(VIETERCFLAGS) -c $< -o $@
$(BUILD_DIR)/$(3RDPARTY_DIR)/src/%.c.o: $(3RDPARTY_DIR)/src/%.c
mkdir -p $(dir $@)
$(CC) $(VIETERCFLAGS) -c $< -o $@
# =====TESTING=====
.PHONY: test