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 ORANDIR := $(DIR_WIRELESS_ORAN)
59 WLSDIR := $(DIR_WIRELESS_WLS)
60 BUILDDIR := ../build/mac
63 wls_mac_app_dep_file = $(BUILDDIR)/dep_file
65 APP := ../bin/mac/mac_app
70 $(RTE_SDK)/$(RTE_TARGET)/include \
73 #$(FLEXRANDIR)/source/nr5g/api \
74 #$(FLEXRANDIR)/source/common \
76 INC := $(addprefix -I,$(INC))
78 DEFS := USE_WO_LOCK _GNU_SOURCE NR5G
81 DEFS := $(DEFS) PRINTF_DBG_OK
84 ifeq ($(DEBUG_MODE),true)
85 DEFS := $(DEFS) DEBUG_MODE
88 DEFS := $(addprefix -D,$(DEFS))
90 CFLAGS := -g -Wall -wd9 -Wno-deprecated-declarations -Wimplicit-function-declaration -fasm-blocks $(DEFS) $(INC)
93 CFLAGS := $(CFLAGS) -Werror
96 #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
97 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,-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,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive
98 LDFLAGS := -g -Wl,-lrt -Wl,-lpthread -Wl,-lhugetlbfs -Wl,-lm -Wl,-lnuma -L $(WLSDIR) -lwls
100 LINUX_WLS_MAC_APP_SRC := \
101 $(SRCDIR)/mac_main.c \
102 $(SRCDIR)/mac_wls.c \
104 OBJS := $(LINUX_WLS_MAC_APP_SRC:.c=.o)
106 PROJECT_OBJ_DIR = $(BUILDDIR)
108 OBJS := $(addprefix $(PROJECT_OBJ_DIR)/,$(OBJS))
110 DIRLIST := $(sort $(dir $(OBJS)))
112 CC_DEPS := $(addprefix __dep__,$(LINUX_WLS_MAC_APP_SRC))
115 ifeq ($(wildcard $(wls_mac_app_dep_file)),)
116 GEN_DEP := regenerate_dep
120 $(APP): $(DIRLIST) echo_options $(GEN_DEP) $(OBJS)
122 @$(CC) -o $(APP) $(OBJS) $(RTE_LIBS) $(LDFLAGS)
123 # $(OBJDUMP) -d $(APP) > $(APP).asm
125 .PHONY : echo_options
127 @echo [CFLAGS] $(CFLAGS)
128 @echo [LDFAGS] $(LDFLAGS)
131 ifneq ($(wildcard $(wls_mac_app_dep_file)),)
132 include $(wls_mac_app_dep_file)
138 .PHONY : regenerate_dep
139 regenerate_dep : clean_dep echo_regeenrate_dep $(CC_DEPS)
143 $(RM) $(wls_mac_app_dep_file)
145 .PHONY : echo_regeenrate_dep
147 @echo regenerating dep files
152 @$(CC) -MM $(subst __dep__,,$@) -MT $(addprefix $(PROJECT_OBJ_DIR)/,$(patsubst %.c,%.o,$(subst __dep__,,$@))) $(CFLAGS) >> $(wls_mac_app_dep_file)
154 $(OBJS) : $(PROJECT_OBJ_DIR)/%.o: %.c
155 @echo [CC] $(subst $(PROJECT_OBJ_DIR)/,,$@)
157 @echo "";echo $(subst $(PROJECT_OBJ_DIR)/,,$@)
158 @echo "";echo $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))
160 $(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))