1 # makefile to manage dpdk package
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
20 # Aihua Li, Huawei Technologies.
22 include ../mk/master.mk
23 include ../package-list.mk
25 .PHONY: install force_make
31 TAG_DONE_FLAG = $(WORK_DIR)/.$(DPDK_TAG).tag.done
32 DPDK_CUSE = ../../src_cuse/dpdk
34 # the name has been changed from version to version
35 ifeq ($(DPDK_TAG),v1.6.0r0)
36 DPDK_TARGET = x86_64-default-linuxapp-gcc
37 CONFIG_FILE = $(WORK_DIR)/config/defconfig_x86_64-default-linuxapp-gcc
39 DPDK_TARGET = x86_64-native-linuxapp-gcc
40 CONFIG_FILE = $(WORK_DIR)/config/common_linuxapp
44 @echo "Finished making $(WORK_DIR) "
46 INSTALL_TARGET = force_make
48 # modify CONFIG_FILE to enable VHOST_USER build and restore original CONFIG_FILE after the build
49 force_make: $(TAG_DONE_FLAG)
50 $(AT)cd $(WORK_DIR) && git pull $(DPDK_URL) $(DPDK_TAG)
51 $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST_USER=.\+/CONFIG_RTE_LIBRTE_VHOST_USER=$(VHOST_USER)/g' $(CONFIG_FILE)
52 $(AT)sed -i -e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=./CONFIG_RTE_BUILD_COMBINE_LIBS=y/g' $(CONFIG_FILE)
53 $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST=./CONFIG_RTE_LIBRTE_VHOST=y/g' $(CONFIG_FILE)
54 $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_KNI=./CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE)
55 $(AT)cd $(WORK_DIR); make install T=$(DPDK_TARGET) -j DESTDIR=$(WORK_DIR)
56 $(AT)cd `dirname $(CONFIG_FILE)` && git checkout `basename $(CONFIG_FILE)` && cd -
57 $(AT)echo "VHOST_USER = $(VHOST_USER)"
58 ifeq ($(VHOST_USER),n)
59 $(AT)cd $(WORK_DIR)/lib/librte_vhost/eventfd_link; make
63 install: $(INSTALL_TARGET)
64 $(AT)sudo cp -a $(WORK_DIR)/$(DPDK_TARGET)/kmod $(INSTALL_DIR)/lib/modules/$(KERNEL_VERSION)
67 # hard way to clean and clobber
69 $(AT)cd $(WORK_DIR) && git clean -xfd *.o
71 $(AT)rm -rf $(WORK_DIR)
72 $(AT)rm -rf $(DPDK_CUSE)
74 # distclean is for developer who would like to keep the
75 # clone git repo, saving time to fetch again from url
77 $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
80 @echo "Make test in $(WORK_DIR) (stub) "
83 @echo "Make sanity in $(WORK_DIR) (stub) "
86 $(AT)git clone $(DPDK_URL)
87 $(AT)mkdir -p $(DPDK_CUSE)
88 $(AT)cp -rf ./* $(DPDK_CUSE)
90 $(TAG_DONE_FLAG): $(WORK_DIR)
91 $(AT)cd $(WORK_DIR); git checkout $(DPDK_TAG)