2016-02-10 00:36:06 +01:00
|
|
|
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at:
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
WS_ROOT=$(CURDIR)
|
|
|
|
BR=$(WS_ROOT)/build-root
|
|
|
|
CCACHE_DIR?=$(BR)/.ccache
|
|
|
|
V?=0
|
|
|
|
GDB?=gdb
|
2016-03-16 22:49:05 +01:00
|
|
|
PLATFORM?=vpp
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
MINIMAL_STARTUP_CONF="unix { interactive } dpdk { no-pci socket-mem 1024 }"
|
|
|
|
|
2016-02-23 22:04:50 +01:00
|
|
|
GDB_ARGS= -ex "handle SIGUSR1 noprint nostop"
|
|
|
|
|
2016-02-10 00:36:06 +01:00
|
|
|
DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache
|
|
|
|
DEB_DEPENDS += debhelper dkms openjdk-7-jdk git libtool libganglia1-dev libapr1-dev
|
2016-03-16 22:49:05 +01:00
|
|
|
DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope
|
2016-02-10 00:36:06 +01:00
|
|
|
|
2016-02-23 22:04:50 +01:00
|
|
|
ifneq ("$(wildcard $(STARTUP_DIR)/startup.conf),"")
|
|
|
|
STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf
|
|
|
|
endif
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
.PHONY: help bootstrap wipe wipe-release build build-release rebuild rebuild-release
|
|
|
|
.PHONY: run run-release debug debug-release build-vat run-vat pkg-deb pkg-rpm
|
2016-03-16 22:49:05 +01:00
|
|
|
.PHONY: ctags cscope
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Make Targets:"
|
|
|
|
@echo " bootstrap - prepare tree for build"
|
2016-02-25 16:26:01 +01:00
|
|
|
@echo " install-dep - install software dependencies"
|
2016-02-10 00:36:06 +01:00
|
|
|
@echo " wipe - wipe all products of debug build "
|
|
|
|
@echo " wipe-release - wipe all products of release build "
|
|
|
|
@echo " build - build debug binaries"
|
|
|
|
@echo " build-release - build release binaries"
|
|
|
|
@echo " rebuild - wipe and build debug binares"
|
|
|
|
@echo " rebuild-release - wipe and build release binares"
|
|
|
|
@echo " run - run debug binary"
|
|
|
|
@echo " run-release - run release binary"
|
|
|
|
@echo " debug - run debug binary with debugger"
|
|
|
|
@echo " debug-release - run release binary with debugger"
|
|
|
|
@echo " build-vat - build vpp-api-test tool"
|
|
|
|
@echo " run-vat - run vpp-api-test tool"
|
|
|
|
@echo " pkg-deb - build DEB packages"
|
|
|
|
@echo " pkg-rpm - build RPM packages"
|
2016-03-16 22:49:05 +01:00
|
|
|
@echo " ctags - (re)generate ctags database"
|
|
|
|
@echo " cscope - (re)generate cscope database"
|
2016-02-10 00:36:06 +01:00
|
|
|
@echo ""
|
|
|
|
@echo "Make Arguments:"
|
|
|
|
@echo " V=[0|1] - set build verbosity level"
|
|
|
|
@echo " STARTUP_CONF=<path> - startup configuration file"
|
|
|
|
@echo " (e.g. /etc/vpp/startup.conf)"
|
2016-02-23 22:04:50 +01:00
|
|
|
@echo " STARTUP_DIR=<path> - startup drectory (e.g. /etc/vpp)"
|
|
|
|
@echo " It also sets STARTUP_CONF if"
|
|
|
|
@echo " startup.conf file is present"
|
2016-02-10 00:36:06 +01:00
|
|
|
@echo " GDB=<path> - gdb binary to use for debugging"
|
2016-03-16 22:49:05 +01:00
|
|
|
@echo " PLATFORM=<name> - target platform. default is vpp"
|
2016-02-10 00:36:06 +01:00
|
|
|
@echo ""
|
|
|
|
@echo "Current Argumernt Values:"
|
|
|
|
@echo " V = $(V)"
|
|
|
|
@echo " STARTUP_CONF = $(STARTUP_CONF)"
|
2016-02-23 22:04:50 +01:00
|
|
|
@echo " STARTUP_DIR = $(STARTUP_DIR)"
|
2016-02-10 00:36:06 +01:00
|
|
|
@echo " GDB = $(GDB)"
|
2016-03-16 22:49:05 +01:00
|
|
|
@echo " PLATFORM = $(PLATFORM)"
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
$(BR)/.bootstrap.ok:
|
|
|
|
ifeq ("$(shell lsb_release -si)", "Ubuntu")
|
|
|
|
@MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
|
|
|
|
if [ -n "$$MISSING" ] ; then \
|
|
|
|
echo "\nPlease install missing packages: \n$$MISSING\n" ; \
|
2016-02-25 16:26:01 +01:00
|
|
|
echo "by executing \"make install-dep\"\n" ; \
|
2016-02-10 00:36:06 +01:00
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
|
|
|
exit 0
|
|
|
|
endif
|
|
|
|
@echo "SOURCE_PATH = $(WS_ROOT)" > $(BR)/build-config.mk
|
|
|
|
@echo "#!/bin/bash\n" > $(BR)/path_setup
|
|
|
|
@echo 'export PATH=$(BR)/tools/ccache-bin:$$PATH' >> $(BR)/path_setup
|
|
|
|
@echo 'export PATH=$(BR)/tools/bin:$$PATH' >> $(BR)/path_setup
|
|
|
|
@echo 'export CCACHE_DIR=$(CCACHE_DIR)' >> $(BR)/path_setup
|
|
|
|
|
|
|
|
ifeq ("$(wildcard /usr/bin/ccache )","")
|
|
|
|
@echo "WARNING: Please install ccache AYEC and re-run this script"
|
|
|
|
else
|
|
|
|
@rm -rf $(BR)/tools/ccache-bin
|
|
|
|
@mkdir -p $(BR)/tools/ccache-bin
|
|
|
|
@ln -s /usr/bin/ccache $(BR)/tools/ccache-bin/gcc
|
|
|
|
@ln -s /usr/bin/ccache $(BR)/tools/ccache-bin/g++
|
|
|
|
endif
|
|
|
|
@make -C $(BR) V=$(V) is_build_tool=yes vppapigen-install
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
bootstrap: $(BR)/.bootstrap.ok
|
|
|
|
|
2016-02-25 16:26:01 +01:00
|
|
|
install-dep:
|
|
|
|
ifeq ("$(shell lsb_release -si)", "Ubuntu")
|
2016-03-17 20:37:27 -07:00
|
|
|
@sudo apt-get -y install $(DEB_DEPENDS)
|
2016-02-25 16:26:01 +01:00
|
|
|
else
|
|
|
|
$(error "This option currently works only on Ubuntu systems")
|
|
|
|
endif
|
|
|
|
|
2016-02-10 00:36:06 +01:00
|
|
|
define make
|
2016-03-16 22:49:05 +01:00
|
|
|
@make -C $(BR) V=$(V) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
|
2016-02-10 00:36:06 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
build: $(BR)/.bootstrap.ok
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM)_debug,vpp-install)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
wipe: $(BR)/.bootstrap.ok
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM)_debug,vpp-wipe)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
rebuild: wipe build
|
|
|
|
|
|
|
|
build-release: $(BR)/.bootstrap.ok
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM),vpp-install)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
wipe-release: $(BR)/.bootstrap.ok
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM),vpp-wipe)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
rebuild-release: wipe-release build-release
|
|
|
|
|
2016-02-23 22:04:50 +01:00
|
|
|
STARTUP_DIR ?= $(PWD)
|
2016-02-10 00:36:06 +01:00
|
|
|
ifeq ("$(wildcard $(STARTUP_CONF))","")
|
|
|
|
define run
|
|
|
|
@echo "WARNING: STARTUP_CONF not defined or file doesn't exist."
|
|
|
|
@echo " Running with minimal startup config: $(MINIMAL_STARTUP_CONF)\n"
|
2016-02-23 22:04:50 +01:00
|
|
|
@cd $(STARTUP_DIR) && sudo $(1) $(MINIMAL_STARTUP_CONF)
|
2016-02-10 00:36:06 +01:00
|
|
|
endef
|
|
|
|
else
|
|
|
|
define run
|
2016-02-23 22:04:50 +01:00
|
|
|
@cd $(STARTUP_DIR) && sudo $(1) -c $(STARTUP_CONF)
|
2016-02-10 00:36:06 +01:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2016-03-16 22:49:05 +01:00
|
|
|
%.files: .FORCE
|
|
|
|
@find . \( -name '*\.[chyS]' -o -name '*\.java' -o -name '*\.lex' \) -and \
|
|
|
|
\( -not -path './build-root*' -o -path \
|
|
|
|
'./build-root/build-vpp_debug-native/dpdk*' \) > $@
|
|
|
|
|
|
|
|
.FORCE:
|
|
|
|
|
2016-02-10 00:36:06 +01:00
|
|
|
run:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call run, $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
run-release:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call run, $(BR)/install-$(PLATFORM)-native/vpp/bin/vpp)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
debug:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call run, $(GDB) $(GDB_ARGS) --args $(BR)/install-$(PLATFORM)_debug-native/vpp/bin/vpp)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
debug-release:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call run, $(GDB) $(GDB_ARGS) --args $(BR)/install-$(PLATFORM)-native/vpp/bin/vpp)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
build-vat:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM)_debug,vpp-api-test-install)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
run-vat:
|
2016-03-16 22:49:05 +01:00
|
|
|
@sudo $(BR)/install-$(PLATFORM)_debug-native/vpp-api-test/bin/vpp_api_test
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
pkg-deb:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM),install-deb)
|
2016-02-10 00:36:06 +01:00
|
|
|
|
|
|
|
pkg-rpm:
|
2016-03-16 22:49:05 +01:00
|
|
|
$(call make,$(PLATFORM),install-rpm)
|
|
|
|
|
|
|
|
ctags: ctags.files
|
|
|
|
@ctags --totals --tag-relative -L $<
|
|
|
|
@rm $<
|
|
|
|
|
|
|
|
cscope: cscope.files
|
|
|
|
@cscope -b -q -v
|