linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: daniel.diaz@linaro.org, Anders Roxell <anders.roxell@linaro.org>,
	shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org,
	Bamvor Jian Zhang <bamv2005@gmail.com>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests: gpio: Find libmount with pkg-config if available
Date: Wed, 5 Dec 2018 22:49:58 +0100	[thread overview]
Message-ID: <CACRpkda1i_NDnBGgrEoY2ewdSvSnJFVLWWvmSGCu0sNS0hLyiQ@mail.gmail.com> (raw)
In-Reply-To: <20181016214659.22362-1-daniel.diaz@linaro.org>

Sorry for top-posting,

I don't understand the selftest environment very well so I do not know
if this is the right thing to do.

I can merge the patch through the GPIO tree but I need a nod from
someone wise, like Shuah Khan or Anders Roxell (Anders has been
using the GPIO selftests) that this is the direction we want to go.

Yours,
Linus Walleij

On Tue, Oct 16, 2018 at 11:47 PM Daniel Díaz <daniel.diaz@linaro.org> wrote:

> If pkg-config is available, use it to define the CFLAGS and
> LDLIBS needed for libmount; else, use the current hard-coded
> paths and options.
>
> Using pkg-config is very helpful for cross-compilation
> environments, and is sometimes readily available on developer
> boxes to ensure we get the right compiler/linker options for
> the given package.
>
> Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
> ---
>  tools/testing/selftests/gpio/Makefile | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
> index 46648427d537..f22b22aef7bf 100644
> --- a/tools/testing/selftests/gpio/Makefile
> +++ b/tools/testing/selftests/gpio/Makefile
> @@ -1,7 +1,13 @@
>  # SPDX-License-Identifier: GPL-2.0
>
> -CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
> -LDLIBS += -lmount -I/usr/include/libmount
> +MOUNT_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
> +MOUNT_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
> +ifeq ($(MOUNT_LDLIBS),)
> +MOUNT_LDLIBS := -lmount -I/usr/include/libmount
> +endif
> +
> +CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(MOUNT_CFLAGS)
> +LDLIBS += $(MOUNT_LDLIBS)
>
>  TEST_PROGS := gpio-mockup.sh
>  TEST_FILES := gpio-mockup-sysfs.sh
> --
> 2.17.1
>

  reply	other threads:[~2018-12-05 21:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 21:46 [PATCH] selftests: gpio: Find libmount with pkg-config if available Daniel Díaz
2018-12-05 21:49 ` Linus Walleij [this message]
2018-12-05 23:15   ` Anders Roxell
2018-12-05 23:21     ` shuah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACRpkda1i_NDnBGgrEoY2ewdSvSnJFVLWWvmSGCu0sNS0hLyiQ@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=anders.roxell@linaro.org \
    --cc=bamv2005@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=daniel.diaz@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).