refactor: separate directory for thirdparty code

package
Jef Roosens 2023-02-02 11:16:47 +01:00 committed by GreekStapler
parent b6d97df1bc
commit 46e7e093d9
3 changed files with 10 additions and 2 deletions

View File

@ -6,15 +6,20 @@ LIB_FILENAME ?= libvieter.a
BUILD_DIR ?= build BUILD_DIR ?= build
SRC_DIR ?= src SRC_DIR ?= src
TEST_DIR ?= test TEST_DIR ?= test
INC_DIRS ?= include 3RDPARTY_DIR ?= thirdparty
INCLUDE_DIR ?= include
INC_DIRS ?= $(INCLUDE_DIR) $(3RDPARTY_DIR)/include
LIB := $(BUILD_DIR)/$(LIB_FILENAME) LIB := $(BUILD_DIR)/$(LIB_FILENAME)
SRCS != find '$(SRC_DIR)' -iname '*.c' SRCS != find '$(SRC_DIR)' -iname '*.c'
SRCS_H != find $(INC_DIRS) '$(SRC_DIR)' -iname '*.h' SRCS_H != find $(INC_DIRS) '$(SRC_DIR)' -iname '*.h'
SRCS_TEST != find '$(TEST_DIR)' -iname '*.c' 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) OBJS_TEST := $(SRCS_TEST:%=$(BUILD_DIR)/%.o)
DEPS := $(SRCS:%=$(BUILD_DIR)/%.d) $(SRCS_TEST:%=$(BUILD_DIR)/%.d) 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 $@) mkdir -p $(dir $@)
$(CC) $(VIETERCFLAGS) -c $< -o $@ $(CC) $(VIETERCFLAGS) -c $< -o $@
$(BUILD_DIR)/$(3RDPARTY_DIR)/src/%.c.o: $(3RDPARTY_DIR)/src/%.c
mkdir -p $(dir $@)
$(CC) $(VIETERCFLAGS) -c $< -o $@
# =====TESTING===== # =====TESTING=====
.PHONY: test .PHONY: test