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 Testphy 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 WLSDIR := $(DIR_WIRELESS_WLS)
59 BUILDDIR := ../build/phy
62 wls_phy_app_dep_file = $(BUILDDIR)/dep_file
64 APP := ../bin/phy/phy_app
69 $(RTE_SDK)/$(RTE_TARGET)/include \
71 INC := $(addprefix -I,$(INC))
73 DEFS := USE_WO_LOCK _GNU_SOURCE NR5G
76 DEFS := $(DEFS) PRINTF_DBG_OK
79 ifeq ($(DEBUG_MODE),true)
80 DEFS := $(DEFS) DEBUG_MODE
83 DEFS := $(addprefix -D,$(DEFS))
85 CFLAGS := -g -Wall -wd9 -Wno-deprecated-declarations -Wimplicit-function-declaration -fasm-blocks $(DEFS) $(INC)
88 CFLAGS := $(CFLAGS) -Werror
91 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
92 LDFLAGS := -g -Wl,-lrt -Wl,-lpthread -Wl,-lhugetlbfs -Wl,-lm -Wl,-lnuma -L $(WLSDIR) -lwls
94 LINUX_WLS_PHY_APP_SRC := \
95 $(SRCDIR)/phy_main.c \
97 OBJS := $(LINUX_WLS_PHY_APP_SRC:.c=.o)
99 PROJECT_OBJ_DIR = $(BUILDDIR)
101 OBJS := $(addprefix $(PROJECT_OBJ_DIR)/,$(OBJS))
103 DIRLIST := $(sort $(dir $(OBJS)))
105 CC_DEPS := $(addprefix __dep__,$(LINUX_WLS_PHY_APP_SRC))
108 ifeq ($(wildcard $(wls_phy_app_dep_file)),)
109 GEN_DEP := regenerate_dep
113 $(APP): $(DIRLIST) echo_options $(GEN_DEP) $(OBJS)
115 @$(CC) -o $(APP) $(OBJS) $(RTE_LIBS) $(LDFLAGS)
116 # $(OBJDUMP) -d $(APP) > $(APP).asm
118 .PHONY : echo_options
120 @echo [CFLAGS] $(CFLAGS)
121 @echo [LDFAGS] $(LDFLAGS)
124 ifneq ($(wildcard $(wls_phy_app_dep_file)),)
125 include $(wls_phy_app_dep_file)
131 .PHONY : regenerate_dep
132 regenerate_dep : clean_dep echo_regeenrate_dep $(CC_DEPS)
136 $(RM) $(wls_phy_app_dep_file)
138 .PHONY : echo_regeenrate_dep
140 @echo regenerating dep files
145 @$(CC) -MM $(subst __dep__,,$@) -MT $(addprefix $(PROJECT_OBJ_DIR)/,$(patsubst %.c,%.o,$(subst __dep__,,$@))) $(CFLAGS) >> $(wls_phy_app_dep_file)
147 $(OBJS) : $(PROJECT_OBJ_DIR)/%.o: %.c
148 @echo [CC] $(subst $(PROJECT_OBJ_DIR)/,,$@)
149 @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))