From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933383AbbCRQqo (ORCPT ); Wed, 18 Mar 2015 12:46:44 -0400 Received: from lists.s-osg.org ([54.187.51.154]:33926 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932742AbbCRQql (ORCPT ); Wed, 18 Mar 2015 12:46:41 -0400 Message-ID: <5509ABEF.1030203@osg.samsung.com> Date: Wed, 18 Mar 2015 10:46:39 -0600 From: Shuah Khan Organization: Samsung Open Source Group User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Michael Ellerman CC: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan Subject: Re: [PATCH] selftests: Fix build failures when invoked from kselftest target References: <1426297504-14432-1-git-send-email-shuahkh@osg.samsung.com> <1426466329.21900.2.camel@ellerman.id.au> In-Reply-To: <1426466329.21900.2.camel@ellerman.id.au> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/15/2015 06:38 PM, Michael Ellerman wrote: > On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote: >> Several tests that rely on implicit build rules fail to build, >> when invoked from the main Makefile kselftest target. These >> failures are due to --no-builtin-rules and --no-builtin-variables >> options set in the inherited MAKEFLAGS. >> >> --no-builtin-rules eliminates the use of built-in implicit rules >> and --no-builtin-variables is for not defining built-in variables. >> These two options override the use of implicit rules resulting in >> build failures. In addition, inherited LDFLAGS result in build >> failures and there is no need to define LDFLAGS. Clear LDFLAGS >> and MAKEFLAG when make is invoked from the main Makefile kselftest >> target. Fixing this at selftests Makefile avoids changing the main >> Makefile and keeps this change self contained at selftests level. >> >> Signed-off-by: Shuah Khan >> --- >> tools/testing/selftests/Makefile | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile >> index 4e51122..8e09db7 100644 >> --- a/tools/testing/selftests/Makefile >> +++ b/tools/testing/selftests/Makefile >> @@ -22,6 +22,15 @@ TARGETS += vm >> TARGETS_HOTPLUG = cpu-hotplug >> TARGETS_HOTPLUG += memory-hotplug >> >> +# Clear LDFLAGS and MAKEFLAGS if called from main >> +# Makefile to avoid test build failures when test >> +# Makefile doesn't have explicit build rules. >> +ifeq (1,$(MAKELEVEL)) >> +undefine LDFLAGS >> +override define MAKEFLAGS = >> +endef >> +endif > > You shouldn't need to use define/endef here, that is just for multi-line > variables. > > This should be equivalent: > > ifeq (1,$(MAKELEVEL)) > undefine LDFLAGS > override MAKEFLAGS = > endif > ok. Will send a patch v2 with that change. -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh@osg.samsung.com | (970) 217-8978