1a9643ea8Slogwang#   BSD LICENSE
2a9643ea8Slogwang#
3a9643ea8Slogwang#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
4a9643ea8Slogwang#   All rights reserved.
5a9643ea8Slogwang#
6a9643ea8Slogwang#   Redistribution and use in source and binary forms, with or without
7a9643ea8Slogwang#   modification, are permitted provided that the following conditions
8a9643ea8Slogwang#   are met:
9a9643ea8Slogwang#
10a9643ea8Slogwang#     * Redistributions of source code must retain the above copyright
11a9643ea8Slogwang#       notice, this list of conditions and the following disclaimer.
12a9643ea8Slogwang#     * Redistributions in binary form must reproduce the above copyright
13a9643ea8Slogwang#       notice, this list of conditions and the following disclaimer in
14a9643ea8Slogwang#       the documentation and/or other materials provided with the
15a9643ea8Slogwang#       distribution.
16a9643ea8Slogwang#     * Neither the name of Intel Corporation nor the names of its
17a9643ea8Slogwang#       contributors may be used to endorse or promote products derived
18a9643ea8Slogwang#       from this software without specific prior written permission.
19a9643ea8Slogwang#
20a9643ea8Slogwang#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21a9643ea8Slogwang#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22a9643ea8Slogwang#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23a9643ea8Slogwang#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24a9643ea8Slogwang#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25a9643ea8Slogwang#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26a9643ea8Slogwang#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27a9643ea8Slogwang#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28a9643ea8Slogwang#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29a9643ea8Slogwang#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30a9643ea8Slogwang#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31a9643ea8Slogwang
32a9643ea8Slogwangifneq ($(shell pkg-config --atleast-version=0.9.3 libvirt; echo $$?), 0)
33a9643ea8Slogwang$(error vm_power_manager requires libvirt >= 0.9.3)
34a9643ea8Slogwangelse
35a9643ea8Slogwang
36a9643ea8Slogwangifeq ($(RTE_SDK),)
37a9643ea8Slogwang$(error "Please define RTE_SDK environment variable")
38a9643ea8Slogwangendif
39a9643ea8Slogwang
40a9643ea8Slogwang# Default target, can be overridden by command line or environment
41a9643ea8SlogwangRTE_TARGET ?= x86_64-native-linuxapp-gcc
42a9643ea8Slogwang
43a9643ea8Slogwanginclude $(RTE_SDK)/mk/rte.vars.mk
44a9643ea8Slogwang
45a9643ea8Slogwang# binary name
46a9643ea8SlogwangAPP = vm_power_mgr
47a9643ea8Slogwang
48a9643ea8Slogwang# all source are stored in SRCS-y
49a9643ea8SlogwangSRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c
50a9643ea8SlogwangSRCS-y += channel_monitor.c
51a9643ea8Slogwang
52a9643ea8SlogwangCFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
53a9643ea8SlogwangCFLAGS += $(WERROR_FLAGS)
54a9643ea8Slogwang
55a9643ea8SlogwangLDLIBS += -lvirt
56a9643ea8Slogwang
57*2bfe3f2eSlogwangifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
58*2bfe3f2eSlogwang
59*2bfe3f2eSlogwangifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
60*2bfe3f2eSlogwangLDLIBS += -lrte_pmd_ixgbe
61*2bfe3f2eSlogwangendif
62*2bfe3f2eSlogwang
63*2bfe3f2eSlogwangifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
64*2bfe3f2eSlogwangLDLIBS += -lrte_pmd_i40e
65*2bfe3f2eSlogwangendif
66*2bfe3f2eSlogwang
67*2bfe3f2eSlogwangifeq ($(CONFIG_RTE_LIBRTE_BNXT_PMD),y)
68*2bfe3f2eSlogwangLDLIBS += -lrte_pmd_bnxt
69*2bfe3f2eSlogwangendif
70*2bfe3f2eSlogwang
71*2bfe3f2eSlogwangendif
72*2bfe3f2eSlogwang
73a9643ea8Slogwang# workaround for a gcc bug with noreturn attribute
74a9643ea8Slogwang# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
75a9643ea8Slogwangifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
76a9643ea8SlogwangCFLAGS_main.o += -Wno-return-type
77a9643ea8Slogwangendif
78a9643ea8Slogwang
79a9643ea8Slogwanginclude $(RTE_SDK)/mk/rte.extapp.mk
80a9643ea8Slogwang
81a9643ea8Slogwangendif # libvirt check
82