Front Haul Interface Library first seed code contribution
[o-du/phy.git] / fhi_lib / lib / 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 CC := icc
19 AR := xiar
20
21 ifeq ($(RTE_SDK),)
22     $(error "Please define RTE_SDK environment variable")
23 endif
24
25 RTE_TARGET := x86_64-native-linuxapp-icc
26 RTE_INC := $(RTE_SDK)/$(RTE_TARGET)/include
27 #include $(RTE_SDK)/mk/rte.vars.mk
28 API_DIR := $(PWD)/api
29 SRC_DIR := $(PWD)/src
30 ETH_DIR := $(PWD)/ethernet
31
32
33 ifeq ($(MLOG_DIR),)
34     MLOG_DIR=$(XRAN_DIR)/../mlog
35 endif
36
37 CFLAGS += -std=gnu11 -Wall -wd9 -Wno-deprecated-declarations -Wextra -Werror -qopt-report-phase:all -qopt-zmm-usage=high \
38         -fdata-sections \
39         -ffunction-sections \
40         -restrict \
41         -g \
42         -Wall \
43         -Wimplicit-function-declaration \
44         -Werror \
45         -Wextra \
46         -no-inline-max-total-size \
47         -no-inline-max-size \
48         -I$(API_DIR) -I$(ETH_DIR) -I$(MLOG_DIR)/source -I$(RTE_INC) -g -O3
49
50 ifeq ($(ME),1)
51     CFLAGS += -DMLOG_ENABLED
52 endif
53 SRC = $(ETH_DIR)/ethdi.c \
54         $(ETH_DIR)/ethernet.c \
55         $(SRC_DIR)/xran_up_api.c \
56         $(SRC_DIR)/xran_sync_api.c \
57         $(SRC_DIR)/xran_timer.c \
58         $(SRC_DIR)/xran_cp_api.c        \
59         $(SRC_DIR)/xran_transport.c  \
60         $(SRC_DIR)/xran_common.c        \
61         $(SRC_DIR)/xran_ul_tables.c     \
62         $(SRC_DIR)/xran_main.c 
63
64 FLEX_C_CRAN_LIB = libxran.a
65
66 OBJ = $(foreach file,$(SRC),$(file:.c=.o))
67
68
69 all: flex_lib install
70
71 $(OBJ): %.o: %.c
72         $(CC) $(CFLAGS) -I$(API_DIR) -c $< -o $@ 
73
74
75 flex_lib:$(FLEX_C_CRAN_LIB)
76
77 $(FLEX_C_CRAN_LIB): $(OBJ)
78         $(AR) rsu $@ $^
79
80 install: $(FLEX_C_CRAN_LIB)
81         mkdir -p bin
82         @mv $(FLEX_C_CRAN_LIB) ./bin
83
84 clean:
85         @rm -rf $(FLEX_C_CRAN_LIB) $(OBJ) ./bin/$(FLEX_C_CRAN_LIB)
86
87 #include $(RTE_SDK)/mk/rte.extlib.mk