JIRA: VSPERF-29 - Add build elements for Jenkins
[vswitchperf.git] / src / ovs / Makefile
1 # makefile to manage ovs package
2 #
3 # Copyright (C) 2015 OPNFV
4 #
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved.  This file is offered as-is,
8 # without warranty of any kind.
9 #
10 # Contributors:
11 #   Aihua Li, Huawei Technologies.
12
13 include ../mk/master.mk
14 include ../package-list.mk
15
16 # DPDK_DIR is the top directory for dpdk source tree
17 # it can be passed in from Makefile command
18 # if it is not set, try to read it in from environment
19 # if it is still not set, then set it using relative path
20
21 DPDK_DIR ?= $(shell echo $$DPDK_DIR)
22 ifeq ($(DPDK_DIR),)
23 DPDK_DIR = ../../dpdk/dpdk
24 endif
25
26 .PHONY: install force_install config force_make
27
28 # install depends on make
29 force_install: force_make
30
31 WORK_DIR = ovs
32 TAG_DONE_FLAG = $(WORK_DIR)/.$(OVS_TAG).done
33 CONFIG_CMD =
34 CONFIG_CMD += ./configure
35 CONFIG_CMD += --with-linux=$(LINUX_BUILD)
36 CONFIG_CMD += --prefix=$(INSTALL_DIR)/usr
37 CONFIG_CMD += --localstatedir=$(INSTALL_DIR)/usr/local
38 CONFIG_CMD += --with-dpdk=$(DPDK_DIR)/build
39
40 all: force_make
41         @echo "Finished making $(WORK_DIR) "
42
43 config $(WORK_DIR)/Makefile: $(WORK_DIR)/configure
44         $(AT)cd $(WORK_DIR); $(CONFIG_CMD)
45         @echo "Configure done"
46
47 INSTALL_TARGET = force_install force_make
48
49 force_make: $(WORK_DIR)/Makefile
50         $(AT)$(MAKE) -C $(WORK_DIR) $(MORE_MAKE_FLAGS)
51         @echo "Make done"
52
53 force_install:
54         $(AT)sudo make -C $(WORK_DIR) modules_install
55         $(AT)sudo $(MAKE) -C $(WORK_DIR) install
56
57 install: $(INSTALL_TARGET)
58
59 # hard way to clean and clobber
60 clean:
61 clobber:
62         $(AT)rm -rf $(WORK_DIR)
63
64 # cleanse is for developer who would like to keep the
65 # clone git repo, saving time to fetch again from url
66 cleanse:
67         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
68
69 test:
70         @echo "Make test in $(WORK_DIR) (stub) "
71
72 sanity:
73         @echo "Make sanity in $(WORK_DIR) (stub) "
74
75 .PHONY: boot
76 # boot ovs is the process to produce the script 'configure'
77 boot $(WORK_DIR)/configure:
78         @echo "booting up ovs"
79         $(AT)cd $(WORK_DIR); ./boot.sh
80         @echo "done booting ovs"
81
82 boot $(WORK_DIR)/configure: $(TAG_DONE_FLAG)
83
84 $(WORK_DIR):
85         $(AT)git clone $(OVS_URL)
86
87 $(TAG_DONE_FLAG): $(WORK_DIR)
88         $(AT)cd ovs; git checkout $(OVS_TAG)
89 ifneq ($(PATCH_FILE),)
90         $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
91 endif
92         $(AT)touch $@