-
Notifications
You must be signed in to change notification settings - Fork 51
/
config.mk
54 lines (45 loc) · 1.32 KB
/
config.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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/
ifeq (, ${STD})
STD = c++98
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
target_machine = ${shell ${CXX} -dumpmachine}
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
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 mkdir -p ${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}/$<} $< 1>/dev/null
${CXX} ${cflag} -c $< -o $@
.PHONY : clean
clean:
-rm -rf debug release