vpp.mk revision 1c887d93
1# Copyright (c) 2015 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:
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
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.
13
14vpp_source = src
15
16ifneq ($(shell which cmake3),)
17CMAKE?=cmake3
18else
19CMAKE?=cmake
20endif
21
22vpp_cmake_prefix_path  = /opt/vpp/external/$(shell uname -m)
23vpp_cmake_prefix_path += $(PACKAGE_INSTALL_DIR)external
24vpp_cmake_prefix_path := $(subst $() $(),;,$(vpp_cmake_prefix_path))
25
26vpp_cmake_args ?=
27vpp_cmake_args += -DCMAKE_INSTALL_PREFIX:PATH=$(PACKAGE_INSTALL_DIR)
28vpp_cmake_args += -DCMAKE_C_FLAGS="$($(TAG)_TAG_CFLAGS)"
29vpp_cmake_args += -DCMAKE_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)"
30vpp_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(vpp_cmake_prefix_path)"
31ifeq ("$(V)","1")
32vpp_cmake_args += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
33endif
34ifeq (,$(TARGET_PLATFORM))
35ifeq ($(MACHINE),aarch64)
36vpp_cmake_args += -DVPP_LOG2_CACHE_LINE_SIZE=7
37endif
38endif
39
40# Use devtoolset on centos 7
41ifneq ($(wildcard /opt/rh/devtoolset-7/enable),)
42vpp_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin"
43endif
44
45vpp_configure_depend += external-install
46vpp_configure = \
47  cd $(PACKAGE_BUILD_DIR) && \
48  $(CMAKE) -G Ninja $(vpp_cmake_args) $(call find_source_fn,$(PACKAGE_SOURCE))
49#vpp_make_args = --no-print-directory
50vpp_build = $(CMAKE) --build $(PACKAGE_BUILD_DIR) -- $(MAKE_PARALLEL_FLAGS)
51vpp_install = $(CMAKE) --build $(PACKAGE_BUILD_DIR) -- install | grep -v 'Set runtime path'
52
53vpp-package-deb: vpp-install
54	@$(CMAKE) --build $(PACKAGE_BUILD_DIR)/vpp -- package-deb
55	@find $(PACKAGE_BUILD_DIR) \
56          -maxdepth 1 \
57          \( -name '*.changes' -o -name '*.deb' -o -name '*.buildinfo' \) \
58          -exec mv {} $(CURDIR) \;
59