list_easy_timer/makefile

23 lines
379 B
Makefile
Raw Normal View History

2025-01-15 05:11:14 +00:00
# 源代码路径
SRC_DIRS = ./ ./list
BUILD_DIR = ./build
# 查找所有 SRC_DIRS 中的 .c 文件
SRC = $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
# 将 .c 文件替换为 .o 文件
OBJ = $(patsubst %.c,$(BUILD_DIR)/%.o,$(SRC))
all: $(OBJ)
gcc $(OBJ) -o list_easy_timer
$(BUILD_DIR)/%.o: %.c
mkdir -p $(BUILD_DIR)
gcc -c -o $@ $<
clean:
rm -rf $(BUILD_DIR)