BUILD: Fix Build to allow us to verify patches
[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 WORK_DIR = dpdk
28 TAG_DONE_FLAG = $(WORK_DIR)/.$(DPDK_TAG).tag.done
29
30 # the name has been changed from version to version
31 ifeq ($(DPDK_TAG),v1.6.0r0)
32     DPDK_TARGET = x86_64-default-linuxapp-gcc
33     CONFIG_FILE = $(WORK_DIR)/config/defconfig_x86_64-default-linuxapp-gcc
34 else
35     DPDK_TARGET = x86_64-native-linuxapp-gcc
36     CONFIG_FILE = $(WORK_DIR)/config/common_linuxapp
37 endif
38
39 all: force_make
40         @echo "Finished making $(WORK_DIR) "
41
42 INSTALL_TARGET = force_make
43
44 force_make: $(TAG_DONE_FLAG)
45         $(AT)cd $(WORK_DIR); make install T=$(DPDK_TARGET) -j
46         @echo "Make done"
47
48 install: $(INSTALL_TARGET)
49         $(AT)sudo cp -a $(WORK_DIR)/$(DPDK_TARGET)/kmod $(INSTALL_DIR)/lib/modules/$(KERNEL_VERSION)
50         @echo "install done"
51
52 # hard way to clean and clobber
53 clean: cleanse
54 clobber:
55         $(AT)rm -rf $(WORK_DIR)
56
57 # cleanse is for developer who would like to keep the
58 # clone git repo, saving time to fetch again from url
59 cleanse:
60         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
61
62 test:
63         @echo "Make test in $(WORK_DIR) (stub) "
64
65 sanity:
66         @echo "Make sanity in $(WORK_DIR) (stub) "
67
68 $(WORK_DIR):
69         $(AT)git clone $(DPDK_URL)
70
71 $(TAG_DONE_FLAG): $(WORK_DIR)
72         $(AT)cd $(WORK_DIR); git checkout $(DPDK_TAG)
73         $(AT)sed -i 's/CONFIG_RTE_BUILD_COMBINE_LIBS=n/CONFIG_RTE_BUILD_COMBINE_LIBS=y/g' $(CONFIG_FILE)
74         $(AT)sed -i 's/CONFIG_RTE_LIBRTE_VHOST=n/CONFIG_RTE_LIBRTE_VHOST=y/g' $(CONFIG_FILE)
75         $(AT)sed -i 's/CONFIG_RTE_LIBRTE_KNI=y /CONFIG_RTE_LIBRTE_KNI=n/g' $(CONFIG_FILE)
76         $(AT)touch $@