标签:makefile clean size source font main get mic wal
SRC_DIR = src
INC_DIR = -I./include
OBJ_DIR = obj
DEBUG_DIR = debug
target = $(DEBUG_DIR)/main
sources = $(foreach dir, $(SRC_DIR), $(wildcard $(dir)/*.c))
objects = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(notdir $(sources))))
$(target):$(objects)
gcc -o $@ $^
$(OBJ_DIR)/%.o:$(SRC_DIR)/%.c
gcc -c -g -Wall $(INC_DIR) $< -o $@
clean:
@rm -rvf $(OBJ_DIR)/* $(target)
src :存放.c文件
include :存放.h文件
obj :存放生成的.o文件
debug :存放生成的可执行文件
Makefile :此文件
标签:makefile clean size source font main get mic wal
原文地址:https://www.cnblogs.com/tongyishu/p/11682095.html