Update to odulow per maintenance bronze
[o-du/phy.git] / wls_lib / test / fapi / makefile
1 ###############################################################################
2 #
3 #   Copyright (c) 2019 Intel.
4 #
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
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16 #
17 ###############################################################################
18
19 .SUFFIXES: .o .c .s .i .cpp
20
21 # Makefile to build Testfapi application
22
23 ##############################################################
24 #  Tools configuration
25 ##############################################################
26 CC := icc
27 CPP := icpc
28 AS := as
29 AR := ar
30 LD := icc
31 OBJDUMP := objdump
32
33 ifeq ($(SHELL),cmd.exe)
34 MD := mkdir.exe -p
35 RM := rm.exe -rf
36 else
37 MD := mkdir -p
38 RM := rm -rf
39 endif
40
41 ##############################################################
42 # TARGET
43 ##############################################################
44 ifeq ($(RTE_TARGET),)
45     RTE_TARGET :=x86_64-native-linuxapp-icc
46 endif
47 ##############################################################
48 # DPDK
49 ##############################################################
50 ifeq ($(RTE_SDK),)
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
53 endif
54
55 ##############################################################
56 # Projects folders
57 ##############################################################
58 WLSDIR            := $(DIR_WIRELESS_WLS)
59 BUILDDIR          := ../build/fapi
60 SRCDIR            := $(CURDIR)
61
62 wls_fapi_app_dep_file = $(BUILDDIR)/dep_file
63
64 APP := ../bin/fapi/fapi_app
65
66 INC := \
67  $(WLSDIR) \
68  $(SRCDIR) \
69  $(RTE_SDK)/$(RTE_TARGET)/include \
70
71 INC := $(addprefix -I,$(INC))
72  
73 DEFS := USE_WO_LOCK _GNU_SOURCE NR5G
74
75 ifneq ($(PRINTDBG),)
76 DEFS := $(DEFS) PRINTF_DBG_OK
77 endif
78
79 ifeq ($(DEBUG_MODE),true)
80 DEFS := $(DEFS) DEBUG_MODE
81 endif
82
83 DEFS := $(addprefix -D,$(DEFS))
84
85 CFLAGS := -g -Wall -wd9 -Wno-deprecated-declarations -Wimplicit-function-declaration -fasm-blocks $(DEFS) $(INC)
86
87 ifeq ($(PRINTDBG),)
88 CFLAGS := $(CFLAGS) -Werror
89 endif
90
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 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
93 LDFLAGS := -g -Wl,-lrt -Wl,-lpthread -Wl,-lhugetlbfs -Wl,-lm -Wl,-lnuma -L $(WLSDIR) -lwls
94
95 LINUX_WLS_FAPI_APP_SRC := \
96         $(SRCDIR)/fapi_main.c \
97
98 OBJS := $(LINUX_WLS_FAPI_APP_SRC:.c=.o)
99
100 PROJECT_OBJ_DIR = $(BUILDDIR)
101
102 OBJS := $(addprefix $(PROJECT_OBJ_DIR)/,$(OBJS))
103
104 DIRLIST := $(sort $(dir $(OBJS)))
105
106 CC_DEPS := $(addprefix __dep__,$(LINUX_WLS_FAPI_APP_SRC))
107
108 GEN_DEP :=
109 ifeq ($(wildcard $(wls_fapi_app_dep_file)),)
110 GEN_DEP := regenerate_dep
111 endif
112
113 .PHONY: $(APP)
114 $(APP): $(DIRLIST) echo_options $(GEN_DEP) $(OBJS)
115         @echo [LD] $(APP)
116         @$(CC) -o $(APP) $(OBJS) $(RTE_LIBS) $(LDFLAGS)
117 #       $(OBJDUMP) -d $(APP) > $(APP).asm
118
119 .PHONY : echo_options
120 echo_options:
121         @echo [CFLAGS]  $(CFLAGS)
122         @echo [LDFAGS]  $(LDFLAGS)
123
124
125 ifneq ($(wildcard $(wls_fapi_app_dep_file)),)
126 include $(wls_fapi_app_dep_file)
127 endif
128
129 $(DIRLIST) :
130         -@$(MD) $@
131
132 .PHONY : regenerate_dep
133 regenerate_dep : clean_dep echo_regeenrate_dep  $(CC_DEPS)
134
135 .PHONY: clean_dep
136 clean_dep:
137         $(RM) $(wls_fapi_app_dep_file)
138
139 .PHONY : echo_regeenrate_dep
140 echo_regeenrate_dep:
141         @echo regenerating dep files
142
143
144 .PHONY : CC_DEPS
145 $(CC_DEPS):
146         @$(CC) -MM $(subst __dep__,,$@) -MT $(addprefix $(PROJECT_OBJ_DIR)/,$(patsubst %.c,%.o,$(subst __dep__,,$@))) $(CFLAGS) >> $(wls_fapi_app_dep_file)
147
148 $(OBJS) : $(PROJECT_OBJ_DIR)/%.o: %.c
149         @echo [CC]    $(subst $(PROJECT_OBJ_DIR)/,,$@)
150         @$(CC) -c $(CFLAGS) -o"$@" $(patsubst %.o,%.c,$(subst $(PROJECT_OBJ_DIR)/,,$@))
151
152
153 .PHONY: xclean
154 xclean : clean_dep
155         @$(RM) $(OBJS)
156         @$(RM) $(APP)
157         @$(RM) $(BUILDDIR)
158
159 .PHONY: clean
160 clean :
161         @$(RM) $(OBJS)
162         @$(RM) $(APP)
163