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 ###############################################################################
19 .SUFFIXES: .o .c .s .i .cpp
21 # Makefile to build TestMac application
23 ##############################################################
25 ##############################################################
33 ifeq ($(SHELL),cmd.exe)
41 ##############################################################
43 ##############################################################
45 RTE_TARGET :=x86_64-native-linuxapp-icc
47 ##############################################################
49 ##############################################################
51 $(info Please make sure RTE_SDK points to DPDK folder (current version of DPDK is 18.08))
52 RTE_SDK := /opt/dpdk-18.08
55 ##############################################################
57 ##############################################################
58 FLEXRANDIR := $(DIR_WIRELESS)
59 WLSDIR := $(DIR_WIRELESS_WLS)
60 BUILDDIR := ../build/make
63 oran_5g_fapi_dep_file = $(BUILDDIR)/oran_5g_fapi_dep
65 APP := ../bin/oran_5g_fapi
69 $(SRCDIR)/../include \
72 $(SRCDIR)/framework/workers \
73 $(SRCDIR)/framework/wls/fapi2mac \
74 $(SRCDIR)/framework/wls/fapi2phy \
75 $(SRCDIR)/framework/wls/lib \
76 $(SRCDIR)/api/fapi2mac \
77 $(SRCDIR)/api/fapi2phy \
78 $(FLEXRANDIR)/source/nr5g/api \
79 $(FLEXRANDIR)/source/common \
80 $(RTE_SDK)/$(RTE_TARGET)/include \
81 $(SRCDIR)/api/fapi2phy/p5 \
82 $(SRCDIR)/api/fapi2phy/p7 \
83 $(SRCDIR)/api/fapi2mac/p5 \
84 $(SRCDIR)/api/fapi2mac/p7 \
87 INC := $(addprefix -I,$(INC))
89 DEFS := USE_WO_LOCK _GNU_SOURCE
92 DEFS := $(DEFS) PRINTF_DBG_OK
95 ifeq ($(DEBUG_MODE),true)
96 DEFS := $(DEFS) DEBUG_MODE
99 ifeq ($(STATISTIC_MODE),true)
100 DEFS := $(DEFS) STATISTIC_MODE
103 DEFS := $(addprefix -D,$(DEFS))
105 CFLAGS := -g -Wall -Wextra -Wunused -wd9 -Wno-deprecated-declarations -Wimplicit-function-declaration -fasm-blocks -fstack-protector-strong -z,now, -z,relro -z noexecstack -Wformat -Wformat-security -Werror=format-security -fno-strict-overflow -fwrapv $(DEFS) $(INC)
108 CFLAGS := $(CFLAGS) -Werror
111 #RTE_LIBS := -L$(RTE_SDK)/$(RTE_TARGET)/lib -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_port -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm -Wl,-lrt -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lrte_ethdev -Wl,-lrte_mempool -Wl,-lrte_mempool_ring -Wl,-lrte_ring -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_pci -Wl,-lrte_net -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ring -Wl,-lrt -Wl,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
112 RTE_LIBS := -L$(RTE_SDK)/$(RTE_TARGET)/lib -Wl,--whole-archive -Wl,-lrte_distributor -Wl,-lrte_kni -Wl,-lrte_pipeline -Wl,-lrte_table -Wl,-lrte_timer -Wl,-lrte_hash -Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_acl -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lmvec -Wl,-lm -Wl,-lrt -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lrte_ip_frag -Wl,-lrte_ethdev -Wl,-lrte_mempool -Wl,-lrte_mempool_ring -Wl,-lrte_ring -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_pci -Wl,-lrte_net -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_cfgfile -Wl,-lrte_pmd_bond -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_pmd_i40e -Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ring -Wl, -lrte_cryptodev -Wl,-lrt -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
113 LDFLAGS := -g -Wl,-lrt -Wl,-lpthread -Wl,-lhugetlbfs -Wl,-lmvec -Wl,-lm -Wl,-lnuma -L $(WLSDIR) -lwls
115 LINUX_ORAN_5G_FAPI_SRC := \
116 $(SRCDIR)/nr5g_fapi.c \
117 $(SRCDIR)/utils/nr5g_fapi_args.c \
118 $(SRCDIR)/utils/nr5g_fapi_config_loader.c \
119 $(SRCDIR)/utils/nr5g_fapi_log.c \
120 $(SRCDIR)/utils/nr5g_fapi_stats.c \
121 $(SRCDIR)/utils/nr5g_fapi_memory.c \
122 $(SRCDIR)/utils/nr5g_fapi_cmd.c \
123 $(SRCDIR)/framework/workers/nr5g_fapi_mac2phy_thread.c \
124 $(SRCDIR)/framework/workers/nr5g_fapi_phy2mac_thread.c \
125 $(SRCDIR)/framework/nr5g_fapi_framework.c \
126 $(SRCDIR)/framework/wls/fapi2mac/nr5g_fapi_fapi2mac_wls.c \
127 $(SRCDIR)/framework/wls/fapi2phy/nr5g_fapi_fapi2phy_wls.c \
128 $(SRCDIR)/framework/wls/lib/nr5g_fapi_wls.c \
129 $(SRCDIR)/api/fapi2mac/nr5g_fapi_fapi2mac_api.c \
130 $(SRCDIR)/api/fapi2mac/nr5g_fapi_proc_error_ind.c \
131 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_config_resp.c \
132 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_start_resp.c \
133 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_stop_ind.c \
134 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_ul_iq_samples_resp.c \
135 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_dl_iq_samples_resp.c \
136 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_shutdown_resp.c \
137 $(SRCDIR)/api/fapi2mac/p5/nr5g_fapi_proc_fapi_msg_header.c \
138 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_slot_ind.c \
139 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_crc_ind.c \
140 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_rach_ind.c \
141 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_rx_data_ind.c \
142 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_srs_ind.c \
143 $(SRCDIR)/api/fapi2mac/p7/nr5g_fapi_proc_uci_ind.c \
144 $(SRCDIR)/api/fapi2phy/nr5g_fapi_fapi2phy_api.c \
145 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_config_req.c \
146 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_start_req.c \
147 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_stop_req.c \
148 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_shutdown_req.c \
149 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_dl_iq_samples_req.c \
150 $(SRCDIR)/api/fapi2phy/p5/nr5g_fapi_proc_ul_iq_samples_req.c \
151 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_dl_tti_req.c \
152 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_ul_tti_req.c \
153 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_tx_data_req.c \
154 $(SRCDIR)/api/fapi2phy/p7/nr5g_fapi_proc_ul_dci_req.c
156 OBJS := $(LINUX_ORAN_5G_FAPI_SRC:.c=.o)
158 PROJECT_OBJ_DIR = $(BUILDDIR)
160 OBJS := $(addprefix $(PROJECT_OBJ_DIR)/,$(OBJS))
162 DIRLIST := $(sort $(dir $(OBJS)))
164 CC_DEPS := $(addprefix __dep__,$(LINUX_ORAN_5G_FAPI_SRC))
167 ifeq ($(wildcard $(oran_5g_fapi_dep_file)),)
168 GEN_DEP := regenerate_dep
172 $(APP): $(DIRLIST) echo_options $(GEN_DEP) $(OBJS)
174 @$(CC) -o $(APP) $(OBJS) $(RTE_LIBS) $(LDFLAGS)
175 # $(OBJDUMP) -d $(APP) > $(APP).asm
177 .PHONY : echo_options
179 @echo [CFLAGS] $(CFLAGS)
180 @echo [LDFAGS] $(LDFLAGS)
183 ifneq ($(wildcard $(oran_5g_fapi_dep_file)),)
184 include $(oran_5g_fapi_dep_file)
190 .PHONY : regenerate_dep
191 regenerate_dep : clean_dep echo_regeenrate_dep $(CC_DEPS)
195 $(RM) $(oran_5g_fapi_dep_file)
197 .PHONY : echo_regeenrate_dep
199 @echo regenerating dep files
204 @$(CC) -MM $(subst __dep__,,$@) -MT $(addprefix $(PROJECT_OBJ_DIR)/,$(patsubst %.c,%.o,$(subst __dep__,,$@))) $(CFLAGS) >> $(oran_5g_fapi_dep_file)
206 $(OBJS) : $(PROJECT_OBJ_DIR)/%.o: %.c
207 @echo [CC] $(subst $(PROJECT_OBJ_DIR)/,,$@)
208 @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))