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