1 2# 3# Tencent is pleased to support the open source community by making MSEC available. 4# 5# Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved. 6# 7# Licensed under the GNU General Public License, Version 2.0 (the "License"); 8# you may not use this file except in compliance with the License. You may 9# obtain a copy of the License at 10# 11# https://opensource.org/licenses/GPL-2.0 12# 13# Unless required by applicable law or agreed to in writing, software distributed under the 14# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 15# either express or implied. See the License for the specific language governing permissions 16# and limitations under the License. 17# 18 19 20########MAKEFILE########## 21 22ifeq ($(FF_PATH),) 23 $(error variable FF_PATH is not set) 24endif 25 26ifeq ($(FF_DPDK),) 27 FF_DPDK= $(FF_PATH)/dpdk/x86_64-native-linuxapp-gcc 28endif 29 30DEBUG= -g 31BINARY = libmt.a 32FF_LIBS+= -L${FF_PATH}/lib -L${FF_DPDK}/lib -Wl,--whole-archive,-lfstack,--no-whole-archive 33FF_LIBS+= -Wl,--whole-archive -lrte_pmd_vmxnet3_uio -lrte_pmd_i40e -lrte_pmd_ixgbe -lrte_pmd_e1000 -lrte_pmd_ring 34FF_LIBS+= -Wl,--whole-archive -lrte_hash -lrte_kvargs -Wl,-lrte_mbuf -lethdev -lrte_eal -Wl,-lrte_mempool 35FF_LIBS+= -lrte_ring -lrte_cmdline -lrte_cfgfile -lrte_kni -lrte_timer -Wl,-lrte_pmd_virtio 36FF_LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -pthread 37 38# Comment the following line if you are not using the gnu c compiler 39#C_ARGS = -Wall -g -fPIC -D_DEBUG 40C_ARGS = -Wall -g -fPIC -O0 -DMT_REAL_TIME 41#.SUFFIXES: .o .cpp 42 43ifeq ($(ARCH),32) 44 C_ARGS += -march=pentium4 -m32 -DSUS_LINUX -pthread 45else 46 C_ARGS += -m64 -DSUS_LINUX -pthread 47endif 48# You might have to change this if your c compiler is not cc 49CC = g++ 50 51# You shouldn't need to make any more changes below this line. 52INCCOMM=-I./valgrind -I$(FF_PATH)/lib 53 54#.c.o: 55# $(CC) -c $*.c 56 57all: $(BINARY) 58 59### shell color config 60RED = \\e[1m\\e[31m 61DARKRED = \\e[31m 62GREEN = \\e[1m\\e[32m 63DARKGREEN = \\e[32m 64BLUE = \\e[1m\\e[34m 65DARKBLUE = \\e[34m 66YELLOW = \\e[1m\\e[33m 67DARKYELLOW = \\e[33m 68MAGENTA = \\e[1m\\e[35m 69DARKMAGENTA = \\e[35m 70CYAN = \\e[1m\\e[36m 71DARKCYAN = \\e[36m 72RESET = \\e[m 73CRESET = ;echo -ne \\e[m; test -s $@ 74 75%.o: %.cpp 76 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 77 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 78 79%.o: %.c 80 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 81 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 82 83%.o: %.S 84 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 85 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 86 87clean: 88 @rm -f $(BINARY) *.a *.o echo 89 90 91LIB_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\ 92 mt_connection.o mt_concurrent.o mt_sys_hook.o ff_hook.o heap_timer.o mt_cache.o mt_net.o 93 94libmt.a: $(LIB_OBJ) 95 @echo -e Linking $(CYAN)$@$(RESET) ...$(RED) 96 @-rm -f $@ 97 @ar crs $@ $^ $(CRESET) 98 @chmod +x $@ 99 100echo: echo.o libmt.a 101 @echo -e Compile $(CYAN)$@$(RESET) ...$(RED) 102 @$(CC) -O -gdwarf-2 -o $@ $^ -lstdc++ -ldl -lm $(FF_LIBS) $(CRESET) 103