1*a9643ea8Slogwang 2*a9643ea8Slogwang# 3*a9643ea8Slogwang# Tencent is pleased to support the open source community by making MSEC available. 4*a9643ea8Slogwang# 5*a9643ea8Slogwang# Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. 6*a9643ea8Slogwang# 7*a9643ea8Slogwang# Licensed under the GNU General Public License, Version 2.0 (the "License"); 8*a9643ea8Slogwang# you may not use this file except in compliance with the License. You may 9*a9643ea8Slogwang# obtain a copy of the License at 10*a9643ea8Slogwang# 11*a9643ea8Slogwang# https://opensource.org/licenses/GPL-2.0 12*a9643ea8Slogwang# 13*a9643ea8Slogwang# Unless required by applicable law or agreed to in writing, software distributed under the 14*a9643ea8Slogwang# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 15*a9643ea8Slogwang# either express or implied. See the License for the specific language governing permissions 16*a9643ea8Slogwang# and limitations under the License. 17*a9643ea8Slogwang# 18*a9643ea8Slogwang 19*a9643ea8Slogwang 20*a9643ea8Slogwang########MAKEFILE########## 21*a9643ea8Slogwang 22*a9643ea8Slogwangifeq ($(FF_PATH),) 23*a9643ea8Slogwang $(error variable FF_PATH is not set) 24*a9643ea8Slogwangendif 25*a9643ea8Slogwang 26*a9643ea8SlogwangDEBUG= -g 27*a9643ea8SlogwangBINARY = libmt.a 28*a9643ea8SlogwangFF_LIB=$(FF_PATH)/libfstack.a 29*a9643ea8SlogwangDPDK_LIBS = $(shell pkg-config --define-variable=TOPDIR=${FF_PATH} --libs f-stack.pc) 30*a9643ea8Slogwang 31*a9643ea8Slogwang# Comment the following line if you are not using the gnu c compiler 32*a9643ea8Slogwang#C_ARGS = -Wall -g -fPIC -D_DEBUG 33*a9643ea8SlogwangC_ARGS = -Wall -g -fPIC -O0 -DMT_REAL_TIME 34*a9643ea8Slogwang#.SUFFIXES: .o .cpp 35*a9643ea8Slogwang 36*a9643ea8Slogwangifeq ($(ARCH),32) 37*a9643ea8Slogwang C_ARGS += -march=pentium4 -m32 -DSUS_LINUX -pthread 38*a9643ea8Slogwangelse 39*a9643ea8Slogwang C_ARGS += -m64 -DSUS_LINUX -pthread 40*a9643ea8Slogwangendif 41*a9643ea8Slogwang# You might have to change this if your c compiler is not cc 42*a9643ea8SlogwangCC = g++ 43*a9643ea8Slogwang 44*a9643ea8Slogwang# You shouldn't need to make any more changes below this line. 45*a9643ea8SlogwangINCCOMM=-I./valgrind -I$(FF_PATH)/lib 46*a9643ea8Slogwang 47*a9643ea8Slogwang#.c.o: 48*a9643ea8Slogwang# $(CC) -c $*.c 49*a9643ea8Slogwang 50*a9643ea8Slogwangall: $(BINARY) 51*a9643ea8Slogwang 52*a9643ea8Slogwang### shell color config 53*a9643ea8SlogwangRED = \\e[1m\\e[31m 54*a9643ea8SlogwangDARKRED = \\e[31m 55*a9643ea8SlogwangGREEN = \\e[1m\\e[32m 56*a9643ea8SlogwangDARKGREEN = \\e[32m 57*a9643ea8SlogwangBLUE = \\e[1m\\e[34m 58*a9643ea8SlogwangDARKBLUE = \\e[34m 59*a9643ea8SlogwangYELLOW = \\e[1m\\e[33m 60*a9643ea8SlogwangDARKYELLOW = \\e[33m 61*a9643ea8SlogwangMAGENTA = \\e[1m\\e[35m 62*a9643ea8SlogwangDARKMAGENTA = \\e[35m 63*a9643ea8SlogwangCYAN = \\e[1m\\e[36m 64*a9643ea8SlogwangDARKCYAN = \\e[36m 65*a9643ea8SlogwangRESET = \\e[m 66*a9643ea8SlogwangCRESET = ;echo -ne \\e[m; test -s $@ 67*a9643ea8Slogwang 68*a9643ea8Slogwang%.o: %.cpp 69*a9643ea8Slogwang @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 70*a9643ea8Slogwang @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 71*a9643ea8Slogwang 72*a9643ea8Slogwang%.o: %.c 73*a9643ea8Slogwang @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 74*a9643ea8Slogwang @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 75*a9643ea8Slogwang 76*a9643ea8Slogwang%.o: %.S 77*a9643ea8Slogwang @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 78*a9643ea8Slogwang @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 79*a9643ea8Slogwang 80*a9643ea8Slogwangclean: 81*a9643ea8Slogwang @rm -f $(BINARY) *.a *.o echo 82*a9643ea8Slogwang 83*a9643ea8Slogwang 84*a9643ea8SlogwangLIB_OBJ = micro_thread.o kqueue_proxy.o arch_ctx.o mt_session.o mt_notify.o mt_action.o mt_mbuf_pool.o mt_api.o\ 85*a9643ea8Slogwang mt_connection.o mt_concurrent.o mt_sys_hook.o ff_hook.o heap_timer.o mt_cache.o mt_net.o 86*a9643ea8Slogwang 87*a9643ea8Slogwanglibmt.a: $(LIB_OBJ) 88*a9643ea8Slogwang @echo -e Linking $(CYAN)$@$(RESET) ...$(RED) 89*a9643ea8Slogwang @-rm -f $@ 90*a9643ea8Slogwang @ar crs $@ $^ $(FST_LIB) $(CRESET) 91*a9643ea8Slogwang @chmod +x $@ 92*a9643ea8Slogwang 93*a9643ea8Slogwangecho: echo.o libmt.a 94*a9643ea8Slogwang @echo -e Compile $(CYAN)$@$(RESET) ...$(RED) 95*a9643ea8Slogwang @$(CC) -O -gdwarf-2 -o $@ $^ -lstdc++ -ldl -lm $(DPDK_LIBS) $(CRESET) 96