1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
15 BR=$(WS_ROOT)/build-root
16 CCACHE_DIR?=$(BR)/.ccache
20 MINIMAL_STARTUP_CONF="unix { interactive } dpdk { no-pci socket-mem 1024 }"
22 DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache
23 DEB_DEPENDS += debhelper dkms openjdk-7-jdk git libtool libganglia1-dev libapr1-dev
24 DEB_DEPENDS += libconfuse-dev git-review
27 .PHONY: help bootstrap wipe wipe-release build build-release rebuild rebuild-release
28 .PHONY: run run-release debug debug-release build-vat run-vat pkg-deb pkg-rpm
32 @echo " bootstrap - prepare tree for build"
33 @echo " wipe - wipe all products of debug build "
34 @echo " wipe-release - wipe all products of release build "
35 @echo " build - build debug binaries"
36 @echo " build-release - build release binaries"
37 @echo " rebuild - wipe and build debug binares"
38 @echo " rebuild-release - wipe and build release binares"
39 @echo " run - run debug binary"
40 @echo " run-release - run release binary"
41 @echo " debug - run debug binary with debugger"
42 @echo " debug-release - run release binary with debugger"
43 @echo " build-vat - build vpp-api-test tool"
44 @echo " run-vat - run vpp-api-test tool"
45 @echo " pkg-deb - build DEB packages"
46 @echo " pkg-rpm - build RPM packages"
48 @echo "Make Arguments:"
49 @echo " V=[0|1] - set build verbosity level"
50 @echo " STARTUP_CONF=<path> - startup configuration file"
51 @echo " (e.g. /etc/vpp/startup.conf)"
52 @echo " GDB=<path> - gdb binary to use for debugging"
54 @echo "Current Argumernt Values:"
56 @echo " STARTUP_CONF = $(STARTUP_CONF)"
60 ifeq ("$(shell lsb_release -si)", "Ubuntu")
61 @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
62 if [ -n "$$MISSING" ] ; then \
63 echo "\nPlease install missing packages: \n$$MISSING\n" ; \
68 @echo "SOURCE_PATH = $(WS_ROOT)" > $(BR)/build-config.mk
69 @echo "#!/bin/bash\n" > $(BR)/path_setup
70 @echo 'export PATH=$(BR)/tools/ccache-bin:$$PATH' >> $(BR)/path_setup
71 @echo 'export PATH=$(BR)/tools/bin:$$PATH' >> $(BR)/path_setup
72 @echo 'export CCACHE_DIR=$(CCACHE_DIR)' >> $(BR)/path_setup
74 ifeq ("$(wildcard /usr/bin/ccache )","")
75 @echo "WARNING: Please install ccache AYEC and re-run this script"
77 @rm -rf $(BR)/tools/ccache-bin
78 @mkdir -p $(BR)/tools/ccache-bin
79 @ln -s /usr/bin/ccache $(BR)/tools/ccache-bin/gcc
80 @ln -s /usr/bin/ccache $(BR)/tools/ccache-bin/g++
82 @make -C $(BR) V=$(V) is_build_tool=yes vppapigen-install
85 bootstrap: $(BR)/.bootstrap.ok
88 @make -C $(BR) V=$(V) PLATFORM=vpp TAG=$(1) $(2)
91 build: $(BR)/.bootstrap.ok
92 $(call make,vpp_debug,vpp-install)
94 wipe: $(BR)/.bootstrap.ok
95 $(call make,vpp_debug,vpp-wipe)
99 build-release: $(BR)/.bootstrap.ok
100 $(call make,vpp,vpp-install)
102 wipe-release: $(BR)/.bootstrap.ok
103 $(call make,vpp,vpp-wipe)
105 rebuild-release: wipe-release build-release
107 ifeq ("$(wildcard $(STARTUP_CONF))","")
109 @echo "WARNING: STARTUP_CONF not defined or file doesn't exist."
110 @echo " Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n"
111 @sudo $(1) $(MINIMAL_STARTUP_CONF)
115 @sudo $(1) -c $(STARTUP_CONF)
120 $(call run, $(BR)/install-vpp_debug-native/vpp/bin/vpp)
123 $(call run, $(BR)/install-vpp-native/vpp/bin/vpp)
126 $(call run, $(GDB) --args $(BR)/install-vpp_debug-native/vpp/bin/vpp)
129 $(call run, $(GDB) --args $(BR)/install-vpp-native/vpp/bin/vpp)
132 $(call make,vpp_debug,vpp-api-test-install)
135 @sudo $(BR)/install-vpp_debug-native/vpp-api-test/bin/vpp_api_test
138 $(call make,vpp,install-deb)
141 $(call make,vpp,install-rpm)