blob: 1b9e8a71e532b40362d32973aabff1032d2fc5f9 [file] [log] [blame]
Dave Barach8d0f2f02018-03-12 09:31:36 -04001# 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
Damjan Marion7cd468a2016-12-19 23:05:39 +010014vpp_source = src
Ed Warnickecb9cada2015-12-08 15:45:58 -070015
Damjan Marionad1e1c52018-09-01 20:06:10 +020016ifneq ($(shell which cmake3),)
17CMAKE?=cmake3
18else
19CMAKE?=cmake
20endif
21
Damjan Marion4a6cb832018-09-18 18:41:38 +020022vpp_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
Damjan Marionad1e1c52018-09-01 20:06:10 +020026vpp_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)"
BenoƮt Ganne534de8b2019-06-11 16:56:41 +020030vpp_cmake_args += -DCMAKE_EXE_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)"
31vpp_cmake_args += -DCMAKE_SHARED_LINKER_FLAGS="$($(TAG)_TAG_LDFLAGS)"
Damjan Marion4a6cb832018-09-18 18:41:38 +020032vpp_cmake_args += -DCMAKE_PREFIX_PATH:PATH="$(vpp_cmake_prefix_path)"
Lijian Zhang2e08b1a2018-09-20 18:40:56 +080033ifeq ("$(V)","1")
34vpp_cmake_args += -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
35endif
Lijian.Zhang49c1bc82019-02-27 18:17:34 +080036ifeq (,$(TARGET_PLATFORM))
37ifeq ($(MACHINE),aarch64)
38vpp_cmake_args += -DVPP_LOG2_CACHE_LINE_SIZE=7
39endif
40endif
Damjan Marionad1e1c52018-09-01 20:06:10 +020041
42# Use devtoolset on centos 7
43ifneq ($(wildcard /opt/rh/devtoolset-7/enable),)
44vpp_cmake_args += -DCMAKE_PROGRAM_PATH:PATH="/opt/rh/devtoolset-7/root/bin"
45endif
46
Nathan Skrzypczak29736542019-09-16 16:26:58 +020047ifneq ($(VPP_EXTRA_CMAKE_ARGS),)
48vpp_cmake_args += $(VPP_EXTRA_CMAKE_ARGS)
49endif
50
Damjan Marion4a6cb832018-09-18 18:41:38 +020051vpp_configure_depend += external-install
Damjan Marion612dd6a2018-07-30 12:45:07 +020052vpp_configure = \
53 cd $(PACKAGE_BUILD_DIR) && \
Damjan Marionad1e1c52018-09-01 20:06:10 +020054 $(CMAKE) -G Ninja $(vpp_cmake_args) $(call find_source_fn,$(PACKAGE_SOURCE))
Damjan Marion612dd6a2018-07-30 12:45:07 +020055#vpp_make_args = --no-print-directory
juraj.linkes1c887d92019-08-08 15:59:10 +020056vpp_build = $(CMAKE) --build $(PACKAGE_BUILD_DIR) -- $(MAKE_PARALLEL_FLAGS)
Damjan Marionad1e1c52018-09-01 20:06:10 +020057vpp_install = $(CMAKE) --build $(PACKAGE_BUILD_DIR) -- install | grep -v 'Set runtime path'
Damjan Marion4d2f86a2019-01-18 13:28:22 +010058
59vpp-package-deb: vpp-install
60 @$(CMAKE) --build $(PACKAGE_BUILD_DIR)/vpp -- package-deb
61 @find $(PACKAGE_BUILD_DIR) \
62 -maxdepth 1 \
63 \( -name '*.changes' -o -name '*.deb' -o -name '*.buildinfo' \) \
64 -exec mv {} $(CURDIR) \;