Merge "vswitches: Affinitize vswitch threads for OVS-DPDK"
[vswitchperf.git] / src / dpdk / Makefile
1 # makefile to manage dpdk package
2 #
3
4 # Copyright 2015 OPNFV
5 #
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
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17
18 #
19 # Contributors:
20 #   Aihua Li, Huawei Technologies.
21
22 include ../mk/master.mk
23 include ../package-list.mk
24
25 .PHONY: install force_make
26
27 ifndef VHOST_USER
28     VHOST_USER = n
29 endif
30 WORK_DIR = dpdk
31 TAG_DONE_FLAG = $(WORK_DIR)/.$(DPDK_TAG).tag.done
32
33 # the name has been changed from version to version
34 ifeq ($(DPDK_TAG),v1.6.0r0)
35     DPDK_TARGET = x86_64-default-linuxapp-gcc
36     CONFIG_FILE = $(WORK_DIR)/config/defconfig_x86_64-default-linuxapp-gcc
37 else
38     DPDK_TARGET = x86_64-native-linuxapp-gcc
39     CONFIG_FILE = $(WORK_DIR)/config/common_linuxapp
40 endif
41
42 all: force_make
43         @echo "Finished making $(WORK_DIR) "
44
45 INSTALL_TARGET = force_make
46
47 # modify CONFIG_FILE to enable VHOST_USER build and restore original CONFIG_FILE after the build
48 force_make: $(TAG_DONE_FLAG)
49         $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST_USER=.\+/CONFIG_RTE_LIBRTE_VHOST_USER=$(VHOST_USER)/g' $(CONFIG_FILE)
50         $(AT)sed -i -e 's/CONFIG_RTE_BUILD_COMBINE_LIBS=./CONFIG_RTE_BUILD_COMBINE_LIBS=y/g' $(CONFIG_FILE)
51         $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_VHOST=./CONFIG_RTE_LIBRTE_VHOST=y/g' $(CONFIG_FILE)
52         $(AT)sed -i -e 's/CONFIG_RTE_LIBRTE_KNI=./CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE)
53         $(AT)cd $(WORK_DIR); make install T=$(DPDK_TARGET) -j
54         $(AT)cd `dirname $(CONFIG_FILE)` && git checkout `basename $(CONFIG_FILE)` && cd -
55 ifeq ($(VHOST_USER),n)
56         $(AT)cd $(WORK_DIR)/lib/librte_vhost/eventfd_link; make
57 endif
58         @echo "Make done"
59
60 install: $(INSTALL_TARGET)
61         $(AT)sudo cp -a $(WORK_DIR)/$(DPDK_TARGET)/kmod $(INSTALL_DIR)/lib/modules/$(KERNEL_VERSION)
62         @echo "install done"
63
64 # hard way to clean and clobber
65 clean: cleanse
66 clobber:
67         $(AT)rm -rf $(WORK_DIR)
68
69 # cleanse is for developer who would like to keep the
70 # clone git repo, saving time to fetch again from url
71 cleanse:
72         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
73
74 test:
75         @echo "Make test in $(WORK_DIR) (stub) "
76
77 sanity:
78         @echo "Make sanity in $(WORK_DIR) (stub) "
79
80 $(WORK_DIR):
81         $(AT)git clone $(DPDK_URL)
82
83 $(TAG_DONE_FLAG): $(WORK_DIR)
84         $(AT)cd $(WORK_DIR); git checkout $(DPDK_TAG)
85         $(AT)touch $@