Update to odulow per maintenance bronze
[o-du/phy.git] / fhi_lib / test / test_xran / Makefile
1 #/******************************************************************************
2 #*
3 #*   Copyright (c) 2019 Intel.
4 #*
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
8 #*
9 #*       http://www.apache.org/licenses/LICENSE-2.0
10 #*
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.
16 #*
17 #*******************************************************************************/
18
19
20 .SUFFIXES: .o .c .s .i .cpp
21
22 ##############################################################
23 #  Tools configuration
24 ##############################################################
25 CC  := icc
26 CXX := icpc
27 CPP := icpc
28 AS := as
29 AR := ar
30 LD := icc
31 OBJDUMP := objdump
32
33 ifeq ($(SHELL),cmd.exe)
34 MD := mkdir.exe -p
35 CP := cp.exe -f
36 RM := rm.exe -rf
37 else
38 MD := mkdir -p
39 CP := cp -f
40 RM := rm -rf
41 endif
42
43 ifeq ($(RTE_SDK),)
44     $(error "Please define RTE_SDK environment variable")
45 endif
46
47 ifeq ($(MLOG_DIR),)
48     MLOG_DIR=$(XRAN_DIR)/../mlog
49 endif
50
51 RTE_TARGET ?= x86_64-native-linuxapp-icc
52
53 RTE_INC := $(RTE_SDK)/$(RTE_TARGET)/include
54
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
60
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
65
66 # Flags passed to the C++ compiler.
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)
68
69 # All tests produced by this Makefile.  Remember to add new tests you
70 # created to the list.
71 TESTS = unittests
72
73 # All Google Test headers.  Usually you shouldn't change this
74 # definition.
75 GTEST_HEADERS = $(GTEST_ROOT)/include/gtest/*.h \
76                 $(GTEST_ROOT)/include/gtest/internal/*.h
77
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
79 RTE_LIBS = -L$(RTE_SDK)/$(RTE_TARGET)/lib -Wl,-lrte_flow_classify -Wl,--whole-archive -Wl,-lrte_pipeline -Wl,--no-whole-archive -Wl,--whole-archive -Wl,-lrte_table -Wl,--no-whole-archive -Wl,--whole-archive -Wl,-lrte_port -Wl,--no-whole-archive -Wl,-lrte_pdump -Wl,-lrte_distributor -Wl,-lrte_ip_frag -Wl,-lrte_meter -Wl,-lrte_lpm -Wl,--whole-archive -Wl,-lrte_acl -Wl,--no-whole-archive -Wl,-lrte_jobstats -Wl,-lrte_metrics -Wl,-lrte_bitratestats -Wl,-lrte_latencystats -Wl,-lrte_power -Wl,-lrte_efd -Wl,-lrte_bpf -Wl,--whole-archive -Wl,-lrte_cfgfile -Wl,-lrte_gro -Wl,-lrte_gso -Wl,-lrte_hash -Wl,-lrte_member -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_net -Wl,-lrte_ethdev -Wl,-lrte_bbdev -Wl,-lrte_cryptodev -Wl,-lrte_security -Wl,-lrte_compressdev -Wl,-lrte_eventdev -Wl,-lrte_rawdev -Wl,-lrte_timer -Wl,-lrte_mempool -Wl,-lrte_mempool_ring -Wl,-lrte_ring -Wl,-lrte_pci -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_reorder -Wl,-lrte_sched -Wl,-lrte_kni -Wl,-lrte_common_octeontx -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_bus_dpaa -Wl,-lrte_common_dpaax -Wl,-lrte_stack -Wl,-lrte_bus_fslmc -Wl,-lrte_mempool_bucket -Wl,-lrte_mempool_stack -Wl,-lrte_mempool_dpaa -Wl,-lrte_mempool_dpaa2 -Wl,-lrte_pmd_af_packet -Wl,-lrte_pmd_ark -Wl,-lrte_pmd_iavf -Wl,-lrte_pmd_avp -Wl,-lrte_pmd_axgbe -Wl,-lrte_pmd_bnxt -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_cxgbe -Wl,-lrte_pmd_dpaa -Wl,-lrte_pmd_dpaa2 -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ena -Wl,-lrte_pmd_enic -Wl,-lrte_pmd_fm10k -Wl,-lrte_pmd_failsafe -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_kni -Wl,-lrte_pmd_lio -Wl,-lrte_pmd_nfp -Wl,-lrte_pmd_null -Wl,-lrte_pmd_qede -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_softnic -Wl,-lrte_pmd_tap -Wl,-lrte_pmd_thunderx_nicvf -Wl,-lrte_pmd_vdev_netvsc -Wl,-lrte_pmd_virtio -Wl,-lrte_pmd_vhost -Wl,-lrte_pmd_ifc -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_bus_vmbus -Wl,-lrte_pmd_netvsc -Wl,-lrte_pmd_bbdev_null -Wl,-lrte_pmd_null_crypto -Wl,-lrte_pmd_crypto_scheduler -Wl,-lrte_pmd_dpaa2_sec -Wl,-lrte_pmd_dpaa_sec -Wl,-lrte_pmd_virtio_crypto -Wl,-lrte_pmd_octeontx_zip -Wl,-lrte_pmd_qat -Wl,-lrte_pmd_skeleton_event -Wl,-lrte_pmd_sw_event -Wl,-lrte_pmd_octeontx_ssovf -Wl,-lrte_pmd_dpaa_event -Wl,-lrte_pmd_dpaa2_event -Wl,-lrte_mempool_octeontx -Wl,-lrte_pmd_octeontx -Wl,-lrte_pmd_opdl_event -Wl,-lrte_rawdev_skeleton -Wl,-lrte_rawdev_dpaa2_cmdif -Wl,-lrte_rawdev_dpaa2_qdma -Wl,-lrte_bus_ifpga -Wl,--no-whole-archive -Wl,-lrt -Wl,-lm -Wl,-lnuma -Wl,-ldl -Wl,
80
81 CFLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
82         -fdata-sections \
83         -ffunction-sections \
84         -g \
85         -Wall \
86         -Wimplicit-function-declaration  \
87         -wd1786 \
88         -I$(USER_DIR) -I$(USER_API) -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I$(RTE_INC)
89
90 C_SRC = \
91         $(USER_ETH)/ethdi.c    \
92         $(USER_ETH)/ethernet.c      \
93         $(USER_DIR)/xran_up_api.c       \
94         $(USER_DIR)/xran_sync_api.c     \
95         $(USER_DIR)/xran_timer.c                \
96         $(USER_DIR)/xran_cp_api.c       \
97         $(USER_DIR)/xran_transport.c    \
98         $(USER_DIR)/xran_common.c        \
99         $(USER_DIR)/xran_ul_tables.c     \
100         $(USER_DIR)/xran_frame_struct.c  \
101         $(USER_DIR)/xran_app_frag.c \
102         $(USER_DIR)/xran_main.c
103
104 #       $(USER_DIR)/xran_compression.c
105
106 CC_SRC = \
107         $(COMMON_TEST_DIR)/xranlib_unit_test_main.cc \
108         c_plane_tests.cc \
109         chain_tests.cc \
110         prach_functional.cc \
111         prach_performance.cc \
112         u_plane_functional.cc \
113         init_sys_functional.cc \
114         compander_functional.cc \
115         unittests.cc
116
117 #       u_plane_performance.cc \
118
119 CPP_SRC = $(COMMON_TEST_DIR)/common.cpp \
120         $(USER_DIR)/xran_compression.cpp \
121         $(USER_DIR)/xran_bfp_ref.cpp \
122         $(USER_DIR)/xran_bfp_cplane8.cpp \
123         $(USER_DIR)/xran_bfp_cplane16.cpp \
124         $(USER_DIR)/xran_bfp_cplane32.cpp \
125         $(USER_DIR)/xran_bfp_cplane64.cpp
126
127 C_OBJS := $(patsubst %.c,%.o,$(C_SRC))
128 CC_OBJS := $(patsubst %.cc,%.o,$(CC_SRC))
129 CPP_OBJS := $(patsubst %.cpp,%.o,$(CPP_SRC))
130
131 CPPFLAGS += -I$(USER_DIR) -I$(USER_API) 
132
133 CPP_COMP = -O3 -xcore-avx512 -restrict -g -fasm-blocks
134
135 # House-keeping build targets.
136 all : echo_start_build $(TESTS)
137
138 clean :
139         @echo [CLEAN]
140         rm -f $(TESTS) *.o $(COMMON_TEST_DIR)/*.o $(USER_DIR)/*.o $(USER_ETH)/*.o
141
142 .PHONY: xclean 
143 xclean: clean
144
145 .PHONY : echo_start_build
146 echo_start_build :
147         @echo Build Tests with
148         @echo $(USER_DIR)
149         @echo $(USER_API)
150
151 $(CC_OBJS) :
152         @echo "[CC] $@"
153         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o"$@" $(patsubst %.o,%.cc,$@)
154
155 $(CPP_OBJS) :
156         @echo "[CPP] $@"
157         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CPP_COMP) -o"$@" $(patsubst %.o,%.cpp,$@)
158
159 $(C_OBJS) :
160         @echo "[C] $@"
161         @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$@)
162
163 unittests : $(CC_OBJS) $(CPP_OBJS) $(C_OBJS) $(GTEST_ROOT)/libgtest.a
164         @echo "[LD] $@"
165         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(MLOG_DIR)/bin -Wl, $(RTE_LIBS) -lpthread -lnuma $^ -o $@