From patchwork Thu May 26 17:17:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Horman X-Patchwork-Id: 13039 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 40F5337B6; Thu, 26 May 2016 19:18:32 +0200 (CEST) Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 60402A10 for ; Thu, 26 May 2016 19:18:31 +0200 (CEST) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1b5yvS-0006nm-Ly; Thu, 26 May 2016 13:18:29 -0400 From: Neil Horman To: dev@dpdk.org Cc: Neil Horman , Bruce Richardson , Thomas Monjalon , Stephen Hemminger , Panu Matilainen Date: Thu, 26 May 2016 13:17:15 -0400 Message-Id: <1464283037-21478-5-git-send-email-nhorman@tuxdriver.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464283037-21478-1-git-send-email-nhorman@tuxdriver.com> References: <1463431287-4551-1-git-send-email-nhorman@tuxdriver.com> <1464283037-21478-1-git-send-email-nhorman@tuxdriver.com> X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: [dpdk-dev] [PATCHv5 4/6] Makefile: Do post processing on objects that register a driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Modify the compilation makefile to identify C files that export PMD information, and use that to trigger execution of the pmdinfo binary. If the execution of pmdinfo is successful, compile the output C file to an object, and use the linker to do relocatable linking on the resultant object file into the parent object that it came from. This effectively just adds the json string into the string table of the object that defines the PMD to the outside world. Signed-off-by: Neil Horman CC: Bruce Richardson CC: Thomas Monjalon CC: Stephen Hemminger CC: Panu Matilainen --- mk/internal/rte.compile-pre.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk index b9bff4a..92517ad 100644 --- a/mk/internal/rte.compile-pre.mk +++ b/mk/internal/rte.compile-pre.mk @@ -88,10 +88,24 @@ C_TO_O_CMD = 'cmd_$@ = $(C_TO_O_STR)' C_TO_O_DO = @set -e; \ echo $(C_TO_O_DISP); \ $(C_TO_O) && \ + sh -c "grep -q \"PMD_REGISTER_DRIVER(.*)\" $<; \ + if [ \$$? -eq 0 ]; then \ + echo \" PMDINFOGEN\" $@; \ + OBJF=`readlink -f $@`; \ + ${RTE_OUTPUT}/buildtools/pmdinfogen \$$OBJF \$$OBJF.pmd.c; \ + if [ \$$? -eq 0 ]; \ + then \ + echo \" PMDINFOBUILD\" $@; \ + $(CC) $(CFLAGS) -c -o \$$OBJF.pmd.o \$$OBJF.pmd.c; \ + $(CROSS)ld $(LDFLAGS) -r -o \$$OBJF.o \$$OBJF.pmd.o \$$OBJF; \ + mv -f \$$OBJF.o \$$OBJF; \ + fi; \ + fi;" && \ echo $(C_TO_O_CMD) > $(call obj2cmd,$(@)) && \ sed 's,'$@':,dep_'$@' =,' $(call obj2dep,$(@)).tmp > $(call obj2dep,$(@)) && \ rm -f $(call obj2dep,$(@)).tmp + # return an empty string if string are equal compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1)))