From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 9748D5F14 for ; Fri, 3 May 2019 16:09:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 07:09:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,426,1549958400"; d="scan'208";a="147884579" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 03 May 2019 07:09:14 -0700 From: Bruce Richardson To: david.hunt@intel.com Cc: dev@dpdk.org, Bruce Richardson Date: Fri, 3 May 2019 15:09:00 +0100 Message-Id: <20190503140901.59064-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190503140901.59064-1-bruce.richardson@intel.com> References: <20190503140901.59064-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC PATCH 3/4] examples/vm_power_manager: always compile all C files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 May 2019 14:09:16 -0000 Rather than having an "if" statement in the makefile to select one of two files to build, we can put #ifdefs into the C files themselves so that all files are always built. This is a better approach as the makefile-based approach relies on having the DPDK build system with all it's config settings available. When building using info from a pkg-config file, this build configuration information is not going to be available to the makefile - though it will be available to the preprocessor through rte_config.h header. Signed-off-by: Bruce Richardson --- examples/vm_power_manager/Makefile | 3 --- examples/vm_power_manager/meson.build | 16 ++++++++-------- examples/vm_power_manager/oob_monitor_nop.c | 4 ++++ examples/vm_power_manager/oob_monitor_x86.c | 4 ++++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile index d93f900f7..6e573916a 100644 --- a/examples/vm_power_manager/Makefile +++ b/examples/vm_power_manager/Makefile @@ -20,11 +20,8 @@ APP = vm_power_mgr # all source are stored in SRCS-y SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c SRCS-y += channel_monitor.c parse.c -ifeq ($(CONFIG_RTE_ARCH_X86_64),y) SRCS-y += oob_monitor_x86.c -else SRCS-y += oob_monitor_nop.c -endif CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build index f98445bc6..384c778ef 100644 --- a/examples/vm_power_manager/meson.build +++ b/examples/vm_power_manager/meson.build @@ -22,16 +22,16 @@ deps += ['power'] sources = files( - 'channel_manager.c', 'channel_monitor.c', 'main.c', 'parse.c', 'power_manager.c', 'vm_power_cli.c' + 'channel_manager.c', + 'channel_monitor.c', + 'main.c', + 'oob_monitor_nop.c', + 'oob_monitor_x86.c', + 'parse.c', + 'power_manager.c', + 'vm_power_cli.c' ) -# If we're on X86, pull in the x86 code for the branch monitor algo. -if dpdk_conf.has('RTE_ARCH_X86_64') - sources += files('oob_monitor_x86.c') -else - sources += files('oob_monitor_nop.c') -endif - opt_dep = cc.find_library('virt', required : false) build = opt_dep.found() ext_deps += opt_dep diff --git a/examples/vm_power_manager/oob_monitor_nop.c b/examples/vm_power_manager/oob_monitor_nop.c index 7e7b8bc14..90daa7e9b 100644 --- a/examples/vm_power_manager/oob_monitor_nop.c +++ b/examples/vm_power_manager/oob_monitor_nop.c @@ -2,6 +2,8 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#ifndef RTE_ARCH_X86_64 /* X86_64 has separate implementation in another file */ + #include "oob_monitor.h" void branch_monitor_exit(void) @@ -36,3 +38,5 @@ void run_branch_monitor(void) { } + +#endif diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c index ebd96b205..f41bba6ab 100644 --- a/examples/vm_power_manager/oob_monitor_x86.c +++ b/examples/vm_power_manager/oob_monitor_x86.c @@ -2,6 +2,8 @@ * Copyright(c) 2018 Intel Corporation */ +#ifdef RTE_ARCH_X86_64 /* this file is only for X86_64 */ + #include #include #include @@ -269,3 +271,5 @@ run_branch_monitor(void) } } } + +#endif /* RTE_ARCH_X86_64 */ -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6D2EAA0AC5 for ; Fri, 3 May 2019 16:09:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 820125F20; Fri, 3 May 2019 16:09:17 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 9748D5F14 for ; Fri, 3 May 2019 16:09:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 07:09:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,426,1549958400"; d="scan'208";a="147884579" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 03 May 2019 07:09:14 -0700 From: Bruce Richardson To: david.hunt@intel.com Cc: dev@dpdk.org, Bruce Richardson Date: Fri, 3 May 2019 15:09:00 +0100 Message-Id: <20190503140901.59064-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190503140901.59064-1-bruce.richardson@intel.com> References: <20190503140901.59064-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC PATCH 3/4] examples/vm_power_manager: always compile all C files X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190503140900.jfn7MWMcDwIAiatZq4wuGkVnvQqm80n9VJErRSKygeg@z> Rather than having an "if" statement in the makefile to select one of two files to build, we can put #ifdefs into the C files themselves so that all files are always built. This is a better approach as the makefile-based approach relies on having the DPDK build system with all it's config settings available. When building using info from a pkg-config file, this build configuration information is not going to be available to the makefile - though it will be available to the preprocessor through rte_config.h header. Signed-off-by: Bruce Richardson --- examples/vm_power_manager/Makefile | 3 --- examples/vm_power_manager/meson.build | 16 ++++++++-------- examples/vm_power_manager/oob_monitor_nop.c | 4 ++++ examples/vm_power_manager/oob_monitor_x86.c | 4 ++++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/examples/vm_power_manager/Makefile b/examples/vm_power_manager/Makefile index d93f900f7..6e573916a 100644 --- a/examples/vm_power_manager/Makefile +++ b/examples/vm_power_manager/Makefile @@ -20,11 +20,8 @@ APP = vm_power_mgr # all source are stored in SRCS-y SRCS-y := main.c vm_power_cli.c power_manager.c channel_manager.c SRCS-y += channel_monitor.c parse.c -ifeq ($(CONFIG_RTE_ARCH_X86_64),y) SRCS-y += oob_monitor_x86.c -else SRCS-y += oob_monitor_nop.c -endif CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) diff --git a/examples/vm_power_manager/meson.build b/examples/vm_power_manager/meson.build index f98445bc6..384c778ef 100644 --- a/examples/vm_power_manager/meson.build +++ b/examples/vm_power_manager/meson.build @@ -22,16 +22,16 @@ deps += ['power'] sources = files( - 'channel_manager.c', 'channel_monitor.c', 'main.c', 'parse.c', 'power_manager.c', 'vm_power_cli.c' + 'channel_manager.c', + 'channel_monitor.c', + 'main.c', + 'oob_monitor_nop.c', + 'oob_monitor_x86.c', + 'parse.c', + 'power_manager.c', + 'vm_power_cli.c' ) -# If we're on X86, pull in the x86 code for the branch monitor algo. -if dpdk_conf.has('RTE_ARCH_X86_64') - sources += files('oob_monitor_x86.c') -else - sources += files('oob_monitor_nop.c') -endif - opt_dep = cc.find_library('virt', required : false) build = opt_dep.found() ext_deps += opt_dep diff --git a/examples/vm_power_manager/oob_monitor_nop.c b/examples/vm_power_manager/oob_monitor_nop.c index 7e7b8bc14..90daa7e9b 100644 --- a/examples/vm_power_manager/oob_monitor_nop.c +++ b/examples/vm_power_manager/oob_monitor_nop.c @@ -2,6 +2,8 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#ifndef RTE_ARCH_X86_64 /* X86_64 has separate implementation in another file */ + #include "oob_monitor.h" void branch_monitor_exit(void) @@ -36,3 +38,5 @@ void run_branch_monitor(void) { } + +#endif diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c index ebd96b205..f41bba6ab 100644 --- a/examples/vm_power_manager/oob_monitor_x86.c +++ b/examples/vm_power_manager/oob_monitor_x86.c @@ -2,6 +2,8 @@ * Copyright(c) 2018 Intel Corporation */ +#ifdef RTE_ARCH_X86_64 /* this file is only for X86_64 */ + #include #include #include @@ -269,3 +271,5 @@ run_branch_monitor(void) } } } + +#endif /* RTE_ARCH_X86_64 */ -- 2.20.1