Front Haul Interface Library update to third seed code contribution
[o-du/phy.git] / fhi_lib / test / test_xran / Makefile
1 ###############################################################################
2 # <COPYRIGHT_TAG>
3 ###############################################################################
4
5 .SUFFIXES: .o .c .s .i .cpp
6
7 ##############################################################
8 #  Tools configuration
9 ##############################################################
10 CC  := icc
11 CXX := icpc
12 CPP := icpc
13 AS := as
14 AR := ar
15 LD := icc
16 OBJDUMP := objdump
17
18 ifeq ($(SHELL),cmd.exe)
19 MD := mkdir.exe -p
20 CP := cp.exe -f
21 RM := rm.exe -rf
22 else
23 MD := mkdir -p
24 CP := cp -f
25 RM := rm -rf
26 endif
27
28 ifeq ($(RTE_SDK),)
29     $(error "Please define RTE_SDK environment variable")
30 endif
31
32 ifeq ($(MLOG_DIR),)
33     MLOG_DIR=$(XRAN_DIR)/../mlog
34 endif
35
36 RTE_TARGET ?= x86_64-native-linuxapp-icc
37
38 RTE_INC := $(RTE_SDK)/$(RTE_TARGET)/include
39
40 # Where to find user code.
41 COMMON_TEST_DIR = $(XRAN_DIR)/test/common
42 USER_DIR = $(XRAN_DIR)/lib/src
43 USER_ETH = $(XRAN_DIR)/lib/ethernet
44 USER_API = $(XRAN_DIR)/lib/api
45
46 # Flags passed to the preprocessor.
47 # Set Google Test's header directory as a system directory, such that
48 # the compiler doesn't generate warnings in Google Test headers.
49 CPPFLAGS += -isystem $(GTEST_ROOT)/include
50
51 # Flags passed to the C++ compiler.
52 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)
53
54 # All tests produced by this Makefile.  Remember to add new tests you
55 # created to the list.
56 TESTS = unittests
57
58 # All Google Test headers.  Usually you shouldn't change this
59 # definition.
60 GTEST_HEADERS = $(GTEST_ROOT)/include/gtest/*.h \
61                 $(GTEST_ROOT)/include/gtest/internal/*.h
62
63 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
64
65 CFLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \
66         -fdata-sections \
67         -ffunction-sections \
68         -g \
69         -Wall \
70         -Wimplicit-function-declaration  \
71         -wd1786 \
72         -I$(USER_DIR) -I$(USER_API) -I$(USER_API) -I$(USER_DIR) -I$(USER_ETH) -I$(MLOG_DIR)/source -I$(RTE_INC)
73
74 C_SRC = \
75         $(USER_ETH)/ethdi.c    \
76         $(USER_ETH)/ethernet.c      \
77         $(USER_DIR)/xran_up_api.c       \
78         $(USER_DIR)/xran_sync_api.c     \
79         $(USER_DIR)/xran_timer.c                \
80         $(USER_DIR)/xran_cp_api.c       \
81         $(USER_DIR)/xran_transport.c    \
82         $(USER_DIR)/xran_common.c        \
83         $(USER_DIR)/xran_ul_tables.c     \
84         $(USER_DIR)/xran_frame_struct.c  \
85         $(USER_DIR)/xran_app_frag.c \
86         $(USER_DIR)/xran_main.c
87
88 #       $(USER_DIR)/xran_compression.c
89
90 CC_SRC = \
91         $(COMMON_TEST_DIR)/xranlib_unit_test_main.cc \
92         c_plane_tests.cc \
93         chain_tests.cc \
94         prach_functional.cc \
95         prach_performance.cc \
96         u_plane_functional.cc \
97         init_sys_functional.cc \
98         compander_functional.cc \
99         unittests.cc
100
101 #       u_plane_performance.cc \
102
103 CPP_SRC = $(COMMON_TEST_DIR)/common.cpp \
104         $(USER_DIR)/xran_compression.cpp
105
106 C_OBJS := $(patsubst %.c,%.o,$(C_SRC))
107 CC_OBJS := $(patsubst %.cc,%.o,$(CC_SRC))
108 CPP_OBJS := $(patsubst %.cpp,%.o,$(CPP_SRC))
109
110 CPPFLAGS += -I$(USER_DIR) -I$(USER_API) 
111
112 CPP_COMP = -O3 -xcore-avx512 -restrict -g -fasm-blocks
113
114 # House-keeping build targets.
115 all : echo_start_build $(TESTS)
116
117 clean :
118         @echo [CLEAN]
119         rm -f $(TESTS) *.o $(COMMON_TEST_DIR)/*.o $(USER_DIR)/*.o $(USER_ETH)/*.o
120
121 .PHONY : echo_start_build
122 echo_start_build :
123         @echo Build Tests with
124         @echo $(USER_DIR)
125         @echo $(USER_API)
126
127 $(CC_OBJS) :
128         @echo "[CC] $@"
129         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o"$@" $(patsubst %.o,%.cc,$@)
130
131 $(CPP_OBJS) :
132         @echo "[CPP] $@"
133         @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CPP_COMP) -o"$@" $(patsubst %.o,%.cpp,$@)
134
135 $(C_OBJS) :
136         @echo "[C] $@"
137         @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$@)
138
139 unittests : $(CC_OBJS) $(CPP_OBJS) $(C_OBJS) $(GTEST_ROOT)/libgtest.a
140         @echo "[LD] $@"
141         $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(MLOG_DIR)/bin -Wl, $(RTE_LIBS) -lpthread -lnuma $^ -o $@