加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 867 Bytes
一键复制 编辑 原始数据 按行查看 历史
junping 提交于 2022-12-08 18:44 . a lightweight c++ web mvc framework
#指定编译器
CC = g++
#找出当前目录下,所有的源文件(以.cpp结尾)
SRCS := $(shell find ./* -type f | grep '\.cpp' | grep -v 'server\.cpp')
$(warning SRCS is ${SRCS})
#确定cpp源文件对应的目标文件
OBJS := $(patsubst %.cpp, %.o, $(filter %.cpp, $(SRCS)))
$(warning OBJS is ${OBJS})
#编译选项
CFLAGS = -g -O2 -Wall -Werror -Wno-unused -ldl -lpthread -fPIC -std=c++11
$(warning CFLAGS is ${CFLAGS})
#找出当前目录下所有的头文件
INCLUDE_TEMP = $(shell find ./* -type d)
INCLUDE = $(patsubst %,-I %, $(INCLUDE_TEMP))
$(warning INCLUDE is ${INCLUDE})
SRC_SERVER = server.cpp
OBJ_SERVER = ${SRC_SERVER:%.cpp=%.o}
EXE_SERVER = server
target: ${EXE_SERVER}
$(EXE_SERVER): $(OBJ_SERVER) $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) -I.
clean:
rm -f ${OBJS} ${OBJ_SERVER} ${EXE_SERVER}
%.o: %.cpp
${CC} ${CFLAGS} -I. -c $< -o $@
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化