1 #/******************************************************************************
3 #* Copyright (c) 2019 Intel.
5 #* Licensed under the Apache License, Version 2.0 (the "License");
6 #* you may not use this file except in compliance with the License.
7 #* You may obtain a copy of the License at
9 #* http://www.apache.org/licenses/LICENSE-2.0
11 #* Unless required by applicable law or agreed to in writing, software
12 #* distributed under the License is distributed on an "AS IS" BASIS,
13 #* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #* See the License for the specific language governing permissions and
15 #* limitations under the License.
17 #*******************************************************************************/
20 .SUFFIXES: .o .c .s .i .cpp
22 ##############################################################
24 ##############################################################
33 ifeq ($(SHELL),cmd.exe)
44 $(error "Please define RTE_SDK environment variable")
48 MLOG_DIR=$(XRAN_DIR)/../mlog
51 RTE_TARGET ?= x86_64-native-linuxapp-icc
53 RTE_INC := $(RTE_SDK)/$(RTE_TARGET)/include
55 # Where to find user code.
56 COMMON_TEST_DIR = $(XRAN_DIR)/test/common
57 USER_DIR = $(XRAN_DIR)/lib/src
58 USER_ETH = $(XRAN_DIR)/lib/ethernet
59 USER_API = $(XRAN_DIR)/lib/api
61 # Flags passed to the preprocessor.
62 # Set Google Test's header directory as a system directory, such that
63 # the compiler doesn't generate warnings in Google Test headers.
64 CPPFLAGS += -isystem $(GTEST_ROOT)/include
66 # Flags passed to the C++ compiler.
67 CXXFLAGS += -g -std=gnu++11 -Wall -Wextra -fstack-protector-strong -z noexecstack -Wformat -Wformat-security -Werror=format-security -fno-strict-overflow -fwrapv -pthread -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I $(COMMON_TEST_DIR) -I$(RTE_INC)
69 # All tests produced by this Makefile. Remember to add new tests you
70 # created to the list.
73 # All Google Test headers. Usually you shouldn't change this
75 GTEST_HEADERS = $(GTEST_ROOT)/include/gtest/*.h \
76 $(GTEST_ROOT)/include/gtest/internal/*.h
78 RTE_LIBS = -L$(RTE_SDK)/$(RTE_TARGET)/lib -Wl,--whole-archive -Wl,-lrte_mempool_ring -Wl,-lrte_pci -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_net -Wl,-lrte_distributor -Wl,-lrte_reorder -Wl,-lrte_kni -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_jobstats -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,-lrte_vhost -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lrte_ethdev -Wl,-lrte_cryptodev -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_pmd_virtio -Wl,-lrte_pmd_cxgbe -Wl,-lrte_pmd_enic -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_fm10k -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_af_packet -Wl,-lrte_pmd_null -Wl,-lrte_pdump -Wl,-lrt -Wl,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
80 CFLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
85 -Wimplicit-function-declaration \
87 -I$(USER_DIR) -I$(USER_API) -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I$(RTE_INC)
91 $(USER_ETH)/ethernet.c \
92 $(USER_DIR)/xran_up_api.c \
93 $(USER_DIR)/xran_sync_api.c \
94 $(USER_DIR)/xran_timer.c \
95 $(USER_DIR)/xran_cp_api.c \
96 $(USER_DIR)/xran_transport.c \
97 $(USER_DIR)/xran_common.c \
98 $(USER_DIR)/xran_ul_tables.c \
99 $(USER_DIR)/xran_frame_struct.c \
100 $(USER_DIR)/xran_app_frag.c \
101 $(USER_DIR)/xran_main.c
103 # $(USER_DIR)/xran_compression.c
106 $(COMMON_TEST_DIR)/xranlib_unit_test_main.cc \
109 prach_functional.cc \
110 prach_performance.cc \
111 u_plane_functional.cc \
112 init_sys_functional.cc \
113 compander_functional.cc \
116 # u_plane_performance.cc \
118 CPP_SRC = $(COMMON_TEST_DIR)/common.cpp \
119 $(USER_DIR)/xran_compression.cpp
121 C_OBJS := $(patsubst %.c,%.o,$(C_SRC))
122 CC_OBJS := $(patsubst %.cc,%.o,$(CC_SRC))
123 CPP_OBJS := $(patsubst %.cpp,%.o,$(CPP_SRC))
125 CPPFLAGS += -I$(USER_DIR) -I$(USER_API)
127 CPP_COMP = -O3 -xcore-avx512 -restrict -g -fasm-blocks
129 # House-keeping build targets.
130 all : echo_start_build $(TESTS)
134 rm -f $(TESTS) *.o $(COMMON_TEST_DIR)/*.o $(USER_DIR)/*.o $(USER_ETH)/*.o
136 .PHONY : echo_start_build
138 @echo Build Tests with
144 @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o"$@" $(patsubst %.o,%.cc,$@)
148 @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CPP_COMP) -o"$@" $(patsubst %.o,%.cpp,$@)
152 @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$@)
154 unittests : $(CC_OBJS) $(CPP_OBJS) $(C_OBJS) $(GTEST_ROOT)/libgtest.a
156 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(MLOG_DIR)/bin -Wl, $(RTE_LIBS) -lpthread -lnuma $^ -o $@