1 ###############################################################################
3 # Copyright (c) 2021 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 ###############################################################################
19 .SUFFIXES: .o .c .s .i .cpp
21 # Makefile to build TestMac application
23 ##############################################################
25 ##############################################################
26 ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc)
32 else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx)
39 $(error "Please define WIRELESS_SDK_TOOLCHAIN environment variable")
42 ifeq ($(WIRELESS_SDK_TARGET_ISA),sse)
43 TARGET_PROCESSOR := -xSSE4.2
44 else ifeq ($(WIRELESS_SDK_TARGET_ISA),avx2)
45 TARGET_PROCESSOR := -xCORE-AVX2
46 else ifeq ($(WIRELESS_SDK_TARGET_ISA),avx512)
47 TARGET_PROCESSOR := -xCORE-AVX512
48 else ifeq ($(WIRELESS_SDK_TARGET_ISA),snc)
49 TARGET_PROCESSOR := -xicelake-server
50 else ifeq ($(WIRELESS_SDK_TARGET_ISA),spr)
51 TARGET_PROCESSOR := -march=sapphirerapids
54 ifeq ($(TARGET_PROCESSOR),)
55 $(error "Please define valid WIRELESS_SDK_TARGET_ISA environment variable $(WIRELESS_SDK_TARGET_ISA)")
62 ##############################################################
64 ##############################################################
66 $(error "Please define RTE_SDK environment variable")
69 RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk)
71 ##############################################################
73 ##############################################################
74 FLEXRANDIR := $(DIR_WIRELESS)
75 WLSDIR := $(DIR_WIRELESS_WLS)
76 BUILDDIR := ../build/make
79 oran_5g_fapi_dep_file = $(BUILDDIR)/oran_5g_fapi_dep
81 APP := ../bin/oran_5g_fapi
85 -I$(SRCDIR)/../include \
88 -I$(SRCDIR)/framework/workers \
89 -I$(SRCDIR)/framework/wls/fapi2mac \
90 -I$(SRCDIR)/framework/wls/fapi2phy \
91 -I$(SRCDIR)/framework/wls/lib \
92 -I$(SRCDIR)/api/fapi2mac \
93 -I$(SRCDIR)/api/fapi2phy \
94 -I$(FLEXRANDIR)/l1/source/nr5g/api \
95 -I$(FLEXRANDIR)/l1/source/common \
96 -I$(SRCDIR)/api/fapi2phy/p5 \
97 -I$(SRCDIR)/api/fapi2phy/p7 \
98 -I$(SRCDIR)/api/fapi2mac/p5 \
99 -I$(SRCDIR)/api/fapi2mac/p7 \
103 DEFS := USE_WO_LOCK _GNU_SOURCE
106 DEFS := $(DEFS) PRINTF_DBG_OK
109 ifeq ($(DEBUG_MODE),true)
110 DEFS := $(DEFS) DEBUG_MODE
113 ifeq ($(STATISTIC_MODE),true)
114 DEFS := $(DEFS) STATISTIC_MODE
117 DEFS := $(addprefix -D,$(DEFS))
119 CFLAGS := -g -Wall -Wextra -Wunused -diag-disable9 -Wno-deprecated-declarations -Wimplicit-function-declaration -fasm-blocks -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -fwrapv -mssse3 $(DEFS) $(INC)
122 CFLAGS := $(CFLAGS) -Werror
125 RTE_LIBS := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --static --libs libdpdk)
126 LDFLAGS := -z now -z relro -z noexecstack -g -Wl,-lrt -Wl,-lpthread -Wl,-lhugetlbfs -Wl,-lm -Wl,-lnuma -L $(WLSDIR) -lwls
128 LINUX_ORAN_5G_FAPI_SRC := \
129 $(SRCDIR)/nr5g_fapi.c \
130 $(SRCDIR)/utils/nr5g_fapi_args.c \
131 $(SRCDIR)/utils/nr5g_fapi_config_loader.c \
132 $(SRCDIR)/utils/nr5g_fapi_log.c \
133 $(SRCDIR)/utils/nr5g_fapi_stats.c \
134 $(SRCDIR)/utils/nr5g_fapi_memory.c \
135 $(SRCDIR)/utils/nr5g_fapi_cmd.c \
136 $(SRCDIR)/utils/nr5g_fapi_snr_conversion.c \
137 $(SRCDIR)/framework/workers/nr5g_fapi_mac2phy_thread.c \
138 $(SRCDIR)/framework/workers/nr5g_fapi_phy2mac_thread.c \
139 $(SRCDIR)//framework/workers/nr5g_fapi_urllc_phy2mac_thread.c \
140 $(SRCDIR)//framework/workers/nr5g_fapi_urllc_mac2phy_thread.c \
141 $(SRCDIR)/framework/nr5g_fapi_framework.c \
142 $(SRCDIR)/framework/wls/fapi2mac/nr5g_fapi_fapi2mac_wls.c \
143 $(SRCDIR)/framework/wls/fapi2phy/nr5g_fapi_fapi2phy_wls.c \
144 $(SRCDIR)/framework/wls/lib/nr5g_fapi_wls.c \
145 $(SRCDIR)/api/fapi2mac/nr5g_fapi_fapi2mac_api.c \
146 $(SRCDIR)/api/fapi2mac/nr5g_fapi_proc_error_ind.c \
147 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_config_resp.c \
148 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_start_resp.c \
149 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_stop_ind.c \
150 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_ul_iq_samples_resp.c \
151 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_dl_iq_samples_resp.c \
152 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_shutdown_resp.c \
153 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_fapi_msg_header.c \
154 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_slot_ind.c \
155 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_crc_ind.c \
156 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_rach_ind.c \
157 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_rx_data_ind.c \
158 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_rx_data_uci_ind.c \
159 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_srs_ind.c \
160 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_uci_ind.c \
161 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_vendor_p7_msgs.c \
162 $(SRCDIR)/api/fapi2phy/nr5g_fapi_fapi2phy_api.c \
163 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_add_remove_core_msg.c \
164 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_config_req.c \
165 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_param_resp.c \
166 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_start_req.c \
167 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_stop_req.c \
168 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_shutdown_req.c \
169 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_dl_iq_samples_req.c \
170 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_ul_iq_samples_req.c \
171 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_dl_tti_req.c \
172 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_ul_tti_req.c \
173 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_tti_req_common.c \
174 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c \
175 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_ul_dci_req.c
177 OBJS := $(LINUX_ORAN_5G_FAPI_SRC:.c=.o)
179 PROJECT_OBJ_DIR = $(BUILDDIR)
181 OBJS := $(addprefix $(PROJECT_OBJ_DIR)/,$(OBJS))
183 DIRLIST := $(sort $(dir $(OBJS)))
185 CC_DEPS := $(addprefix __dep__,$(LINUX_ORAN_5G_FAPI_SRC))
188 ifeq ($(wildcard $(oran_5g_fapi_dep_file)),)
189 GEN_DEP := regenerate_dep
193 $(APP): $(DIRLIST) echo_options $(GEN_DEP) $(OBJS)
195 @$(CC) -o $(APP) $(OBJS) $(LDFLAGS) $(RTE_LIBS) -lstdc++ # stdc++ flag needed for RTE LIBS
196 # $(OBJDUMP) -d $(APP) > $(APP).asm
198 .PHONY : echo_options
200 @echo [CFLAGS] $(CFLAGS)
201 @echo [LDFAGS] $(LDFLAGS)
204 ifneq ($(wildcard $(oran_5g_fapi_dep_file)),)
205 include $(oran_5g_fapi_dep_file)
211 .PHONY : regenerate_dep
212 regenerate_dep : clean_dep echo_regeenrate_dep $(CC_DEPS)
216 $(RM) $(oran_5g_fapi_dep_file)
218 .PHONY : echo_regeenrate_dep
220 @echo regenerating dep files
225 @$(CC) -MM $(subst __dep__,,$@) -MT $(addprefix $(PROJECT_OBJ_DIR)/,$(patsubst %.c,%.o,$(subst __dep__,,$@))) $(CFLAGS) >> $(oran_5g_fapi_dep_file)
227 $(OBJS) : $(PROJECT_OBJ_DIR)/%.o: %.c
228 @echo [CC] $(subst $(PROJECT_OBJ_DIR)/,,$@)
229 @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))