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 26DEBUG= -g 27BINARY = libmt.a 28FF_LIB=$(FF_PATH)/libfstack.a 29DPDK_LIBS+= -L${FF_PATH}/lib -L${FF_DPDK}/lib -Wl,--whole-archive,-lfstack,--no-whole-archive 30DPDK_LIBS+= -Wl,--whole-archive -lrte_pmd_vmxnet3_uio -lrte_pmd_i40e -lrte_pmd_ixgbe -lrte_pmd_e1000 -lrte_pmd_ring 31DPDK_LIBS+= -Wl,--whole-archive -lrte_hash -lrte_kvargs -Wl,-lrte_mbuf -lethdev -lrte_eal -Wl,-lrte_mempool 32DPDK_LIBS+= -lrte_ring -lrte_cmdline -lrte_cfgfile -lrte_kni -lrte_timer -Wl,-lrte_pmd_virtio 33DPDK_LIBS+= -Wl,--no-whole-archive -lrt -lm -ldl -lcrypto -pthread 34 35# Comment the following line if you are not using the gnu c compiler 36#C_ARGS = -Wall -g -fPIC -D_DEBUG 37C_ARGS = -Wall -g -fPIC -O0 -DMT_REAL_TIME 38#.SUFFIXES: .o .cpp 39 40ifeq ($(ARCH),32) 41 C_ARGS += -march=pentium4 -m32 -DSUS_LINUX -pthread 42else 43 C_ARGS += -m64 -DSUS_LINUX -pthread 44endif 45# You might have to change this if your c compiler is not cc 46CC = g++ 47 48# You shouldn't need to make any more changes below this line. 49INCCOMM=-I./valgrind -I$(FF_PATH)/lib 50 51#.c.o: 52# $(CC) -c $*.c 53 54all: $(BINARY) 55 56### shell color config 57RED = \\e[1m\\e[31m 58DARKRED = \\e[31m 59GREEN = \\e[1m\\e[32m 60DARKGREEN = \\e[32m 61BLUE = \\e[1m\\e[34m 62DARKBLUE = \\e[34m 63YELLOW = \\e[1m\\e[33m 64DARKYELLOW = \\e[33m 65MAGENTA = \\e[1m\\e[35m 66DARKMAGENTA = \\e[35m 67CYAN = \\e[1m\\e[36m 68DARKCYAN = \\e[36m 69RESET = \\e[m 70CRESET = ;echo -ne \\e[m; test -s $@ 71 72%.o: %.cpp 73 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 74 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 75 76%.o: %.c 77 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 78 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 79 80%.o: %.S 81 @echo -e Compiling $(GREEN)$<$(RESET) ...$(RED) 82 @$(CC) $(C_ARGS) -c -o $@ $< $(INCCOMM) $(CRESET) 83 84clean: 85 @rm -f $(BINARY) *.a *.o echo 86 87 88LIB_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\ 89 mt_connection.o mt_concurrent.o mt_sys_hook.o ff_hook.o heap_timer.o mt_cache.o mt_net.o 90 91libmt.a: $(LIB_OBJ) 92 @echo -e Linking $(CYAN)$@$(RESET) ...$(RED) 93 @-rm -f $@ 94 @ar crs $@ $^ $(FST_LIB) $(CRESET) 95 @chmod +x $@ 96 97echo: echo.o libmt.a 98 @echo -e Compile $(CYAN)$@$(RESET) ...$(RED) 99 @$(CC) -O -gdwarf-2 -o $@ $^ -lstdc++ -ldl -lm $(DPDK_LIBS) $(CRESET) 100