From bfa1130478dcdd1e453120251c13d02b8cd20b28 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Thu, 2 Feb 2023 11:16:47 +0100 Subject: [PATCH] refactor: separate directory for thirdparty code --- Makefile | 14 +++++++++++--- {src/package => thirdparty/include}/sha256.h | 0 {src/package => thirdparty/src}/sha256.c | 0 3 files changed, 11 insertions(+), 3 deletions(-) rename {src/package => thirdparty/include}/sha256.h (100%) rename {src/package => thirdparty/src}/sha256.c (100%) diff --git a/Makefile b/Makefile index f3059a7..7a817a6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/src/package/sha256.h b/thirdparty/include/sha256.h similarity index 100% rename from src/package/sha256.h rename to thirdparty/include/sha256.h diff --git a/src/package/sha256.c b/thirdparty/src/sha256.c similarity index 100% rename from src/package/sha256.c rename to thirdparty/src/sha256.c