25 Star 53 Fork 16

youngwolf/st_asio_wrapper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.mk 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
youngwolf 提交于 2025-11-20 15:55 +08:00 . Support MSYS2 CLANG64.
# If your compiler cannot find boost, please specify it explicitly like this:
#boost_include_dir = -I/usr/local/include/
#boost_lib_dir = -L/usr/local/lib/
ifndef STD
STD = c++98 #if your boost version is too hight, you may need to specify c++11
endif
ifndef WIN_VER
WIN_VER = -D_WIN32_WINNT=0x0501 #we may need to increase this version for example, to 0x0A00 (win 10)
endif
cflag = -Wall -fexceptions -std=${STD}
ifeq (${MAKECMDGOALS}, debug)
cflag += -g -DDEBUG
dir = debug
else
cflag += -O2 -DNDEBUG
lflag = -s
dir = release
endif
cflag += -DBOOST_ASIO_NO_DEPRECATED -DBOOST_CHRONO_HEADER_ONLY
common_libs = -lboost_system -lboost_thread #in some ENV, the file name of boost libraries may end with -mt
#if your boost version is too high, boost_system may not exists.
target_machine = ${shell ${CXX} -dumpmachine}
link_to_win = 0
ifneq (, ${findstring solaris, ${target_machine}})
cflag += -pthreads
lflag += -pthreads -lsocket -lnsl
else
cflag += -pthread
lflag += -pthread
ifneq (, ${findstring freebsd, ${target_machine}})
common_libs += -lboost_atomic
#here maybe still have other machines need to be separated out
endif
ifneq (, ${findstring cygwin, ${target_machine}})
cflag += -D__USE_W32_SOCKETS ${WIN_VER}
link_to_win = 1
endif
endif
ifneq (, ${findstring mingw, ${target_machine}})
SHELL = cmd
cflag += -D__USE_MINGW_ANSI_STDIO=1 ${WIN_VER}
link_to_win = 1
ignore = 1>nul
make_dir = md ${dir} 2>nul
del_dirs = -rd /S /Q debug release 2>nul
else
ifneq (, ${findstring windows, ${target_machine}})
link_to_win = 1
endif
ignore = 1>/dev/null
make_dir = mkdir -p ${dir}
del_dirs = -rm -rf debug release
endif
ifeq (1, ${link_to_win})
lflag += -lws2_32 -lwsock32
endif
cflag += ${ext_cflag} ${boost_include_dir}
lflag += ${boost_lib_dir} ${common_libs} ${ext_libs}
target = ${dir}/${module}
objects = ${patsubst %.cpp,${dir}/%.o,${wildcard *.cpp}}
deps = ${patsubst %.o,%.d,${objects}}
${shell ${make_dir}}
release debug : ${target}
-include ${deps}
${target} : ${objects}
${CXX} -o $@ $^ ${lflag}
${objects} : ${dir}/%.o : %.cpp
${CXX} ${cflag} -E -MMD -w -MT '$@' -MF ${patsubst %.cpp,%.d,${dir}/$<} $< ${ignore}
${CXX} ${cflag} -c $< -o $@
.PHONY : clean
clean:
${del_dirs}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/youngwolf/st_asio_wrapper.git
git@gitee.com:youngwolf/st_asio_wrapper.git
youngwolf
st_asio_wrapper
st_asio_wrapper
master

搜索帮助