加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Makefile 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
老咸鱼 提交于 2020-10-16 19:17 . 完成子节点被控任务基本框架
# src = $(wildcard src/*.cpp) $(wildcard src/*/*/*.cpp) $(wildcard src/config/*.cpp)
src = $(shell find . -name *.cpp)
bin_dir = bin
obj = $(src:cpp=o)
h_path = $(shell find . -name *.h)
# Debug模式
ifeq ($(debug), true)
CXXFLAGS = -g -std=c++11 -Wall
else
CXXFLAGS = -std=c++11 -Wall -O3
endif
ifeq ($(target), windows)
cc = i686-w64-mingw32-g++-posix $(CXXFLAGS)
else
cc = g++ $(CXXFLAGS)
endif
CXXFLAGS += $(addprefix -I,$(dir $(h_path)))
default:
@echo compile started
@make main -j8 debug=$(debug)
@echo "\033[0;35mExecutable file at $(shell pwd)/$(bin_dir)/main"
@echo "Configure file at $(shell pwd)/$(bin_dir)/config.conf"
@echo "\033[0;32mFinish!\033[0;0m"
debug:
# make clean
make default debug=true
@echo "\033[0;31m"
@echo " You are using DEBUG MODE"
@echo "Use this version in production environment is NOT RECOMMANDED"
@echo "If you want to run in production environment, please use \033[0;32m\"make clean default\"\033[0;0m"
@echo "\033[0;0m"
run: debug
./$(bin_dir)/main -c $(bin_dir)/config.conf
main: $(obj)
@echo Linking target files
$(cc) $(obj) -o $(bin_dir)/main -lpthread
windows:
make build-windows target=windows -j8
build-windows:$(obj)
$(cc) $(obj) -o $(bin_dir)/main.exe -lpthread -lws2_32 -static
%.o: %.cpp
$(cc) -c $^ -o $@ $(CXXFLAGS)
clean:
-@rm $(src:cpp=o)
-@rm $(bin_dir)/main
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化