0a4aabc6f3739c55b9e46defcaf9bf56437b6b5e
[o-du/phy.git] / fhi_lib / test / test_xran / Makefile
1 #/******************************************************************************\r
2 #*\r
3 #*   Copyright (c) 2019 Intel.\r
4 #*\r
5 #*   Licensed under the Apache License, Version 2.0 (the "License");\r
6 #*   you may not use this file except in compliance with the License.\r
7 #*   You may obtain a copy of the License at\r
8 #*\r
9 #*       http://www.apache.org/licenses/LICENSE-2.0\r
10 #*\r
11 #*   Unless required by applicable law or agreed to in writing, software\r
12 #*   distributed under the License is distributed on an "AS IS" BASIS,\r
13 #*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 #*   See the License for the specific language governing permissions and\r
15 #*   limitations under the License.\r
16 #*\r
17 #*******************************************************************************/\r
18 \r
19 \r
20 .SUFFIXES: .o .c .s .i .cpp\r
21 \r
22 ##############################################################\r
23 #  Tools configuration\r
24 ##############################################################\r
25 CC  := icc\r
26 CXX := icpc\r
27 CPP := icpc\r
28 AS := as\r
29 AR := ar\r
30 LD := icc\r
31 OBJDUMP := objdump\r
32 \r
33 ifeq ($(SHELL),cmd.exe)\r
34 MD := mkdir.exe -p\r
35 CP := cp.exe -f\r
36 RM := rm.exe -rf\r
37 else\r
38 MD := mkdir -p\r
39 CP := cp -f\r
40 RM := rm -rf\r
41 endif\r
42 \r
43 ifeq ($(RTE_SDK),)\r
44     $(error "Please define RTE_SDK environment variable")\r
45 endif\r
46 \r
47 ifeq ($(MLOG_DIR),)\r
48     MLOG_DIR=$(XRAN_DIR)/../mlog\r
49 endif\r
50 \r
51 RTE_TARGET ?= x86_64-native-linuxapp-icc\r
52 \r
53 RTE_INC := $(RTE_SDK)/$(RTE_TARGET)/include\r
54 \r
55 # Where to find user code.\r
56 COMMON_TEST_DIR = $(XRAN_DIR)/test/common\r
57 USER_DIR = $(XRAN_DIR)/lib/src\r
58 USER_ETH = $(XRAN_DIR)/lib/ethernet\r
59 USER_API = $(XRAN_DIR)/lib/api\r
60 \r
61 # Flags passed to the preprocessor.\r
62 # Set Google Test's header directory as a system directory, such that\r
63 # the compiler doesn't generate warnings in Google Test headers.\r
64 CPPFLAGS += -isystem $(GTEST_ROOT)/include\r
65 \r
66 # Flags passed to the C++ compiler.\r
67 CXXFLAGS += -g -std=gnu++11 -Wall -Wextra -pthread -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I $(COMMON_TEST_DIR) -I$(RTE_INC)\r
68 \r
69 # All tests produced by this Makefile.  Remember to add new tests you\r
70 # created to the list.\r
71 TESTS = unittests\r
72 \r
73 # All Google Test headers.  Usually you shouldn't change this\r
74 # definition.\r
75 GTEST_HEADERS = $(GTEST_ROOT)/include/gtest/*.h \\r
76                 $(GTEST_ROOT)/include/gtest/internal/*.h\r
77 \r
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\r
79 \r
80 CFLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \\r
81         -fdata-sections \\r
82         -ffunction-sections \\r
83         -g \\r
84         -Wall \\r
85         -Wimplicit-function-declaration  \\r
86         -wd1786 \\r
87         -I$(USER_DIR) -I$(USER_API) -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I$(RTE_INC)\r
88 \r
89 C_SRC = \\r
90         $(USER_ETH)/ethdi.c    \\r
91         $(USER_ETH)/ethernet.c      \\r
92         $(USER_DIR)/xran_up_api.c       \\r
93         $(USER_DIR)/xran_sync_api.c     \\r
94         $(USER_DIR)/xran_timer.c                \\r
95         $(USER_DIR)/xran_cp_api.c       \\r
96         $(USER_DIR)/xran_transport.c    \\r
97         $(USER_DIR)/xran_common.c        \\r
98         $(USER_DIR)/xran_ul_tables.c     \\r
99         $(USER_DIR)/xran_frame_struct.c  \\r
100         $(USER_DIR)/xran_app_frag.c \\r
101         $(USER_DIR)/xran_main.c\r
102 \r
103 #       $(USER_DIR)/xran_compression.c\r
104 \r
105 CC_SRC = \\r
106         $(COMMON_TEST_DIR)/xranlib_unit_test_main.cc \\r
107         c_plane_tests.cc \\r
108         chain_tests.cc \\r
109         prach_functional.cc \\r
110         prach_performance.cc \\r
111         u_plane_functional.cc \\r
112         init_sys_functional.cc \\r
113         compander_functional.cc \\r
114         unittests.cc\r
115 \r
116 #       u_plane_performance.cc \\r
117 \r
118 CPP_SRC = $(COMMON_TEST_DIR)/common.cpp \\r
119         $(USER_DIR)/xran_compression.cpp\r
120 \r
121 C_OBJS := $(patsubst %.c,%.o,$(C_SRC))\r
122 CC_OBJS := $(patsubst %.cc,%.o,$(CC_SRC))\r
123 CPP_OBJS := $(patsubst %.cpp,%.o,$(CPP_SRC))\r
124 \r
125 CPPFLAGS += -I$(USER_DIR) -I$(USER_API) \r
126 \r
127 CPP_COMP = -O3 -xcore-avx512 -restrict -g -fasm-blocks\r
128 \r
129 # House-keeping build targets.\r
130 all : echo_start_build $(TESTS)\r
131 \r
132 clean :\r
133         @echo [CLEAN]\r
134         rm -f $(TESTS) *.o $(COMMON_TEST_DIR)/*.o $(USER_DIR)/*.o $(USER_ETH)/*.o\r
135 \r
136 .PHONY : echo_start_build\r
137 echo_start_build :\r
138         @echo Build Tests with\r
139         @echo $(USER_DIR)\r
140         @echo $(USER_API)\r
141 \r
142 $(CC_OBJS) :\r
143         @echo "[CC] $@"\r
144         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o"$@" $(patsubst %.o,%.cc,$@)\r
145 \r
146 $(CPP_OBJS) :\r
147         @echo "[CPP] $@"\r
148         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CPP_COMP) -o"$@" $(patsubst %.o,%.cpp,$@)\r
149 \r
150 $(C_OBJS) :\r
151         @echo "[C] $@"\r
152         @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$@)\r
153 \r
154 unittests : $(CC_OBJS) $(CPP_OBJS) $(C_OBJS) $(GTEST_ROOT)/libgtest.a\r
155         @echo "[LD] $@"\r
156         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(MLOG_DIR)/bin -Wl, $(RTE_LIBS) -lpthread -lnuma $^ -o $@\r