From patchwork Tue Oct 16 21:46:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_D=C3=ADaz?= X-Patchwork-Id: 10644231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DED017D2 for ; Tue, 16 Oct 2018 21:47:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 576A328694 for ; Tue, 16 Oct 2018 21:47:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4871E2936C; Tue, 16 Oct 2018 21:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA7F628694 for ; Tue, 16 Oct 2018 21:47:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbeJQFkA (ORCPT ); Wed, 17 Oct 2018 01:40:00 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:37658 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbeJQFkA (ORCPT ); Wed, 17 Oct 2018 01:40:00 -0400 Received: by mail-yb1-f194.google.com with SMTP id h1-v6so9540020ybm.4 for ; Tue, 16 Oct 2018 14:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BQJKia//hru3n+/JYCjGhW0IPokv27OxI/Ee3R6hFTw=; b=OTlT7VJbxMeTjmWhKlkq2MKKLNmSNHaYu33vG1vykjBOYX9kgJy2C8nuBsuU5Bl2Xi N/YgGgCjsVDCohVUSvu27M56IWPHQgodRxsTB7bq8wPUpGXzlo86dp4L3o33MuX/Ueg6 ulxEQz1w7pY+Flx/IfOEzSDjxmq+HaObvkqFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BQJKia//hru3n+/JYCjGhW0IPokv27OxI/Ee3R6hFTw=; b=Jl2ycDzFYkwKYlIQz0vd0PUcu9ns0eJneOuUbLULZBCMuwFzBvUPqnKnCqdW7PZpf+ wp1CbAKCaRCIAGXQG3uRlalQqviDPw4lKT/49jUPkyb1yfOrAN1T+Ac0VCE9Q/iMYjR9 XWyc/qE81dRJDro0iYCFRgJGu1hudmoKt4HcHt2qTiicYdGQJMOFYOVHLo+xB20H6W5p 6VjwYUi5NH04ebMsl/xL1jsU3HA3hI6dPShJziRQndQmCzMHpVxIFkeSuzgR1V+Vc4kV WrK01Z8QiC61quZ8KcD/+yxth6dlt6KAf1s4+zl0CICNi8KnroOeYTZ22ibZ/W61fOm9 1XsQ== X-Gm-Message-State: ABuFfojUADh/k0nX33PXxG2xx7OApd7p6JaMyrPVqSodd6m9WGI824tC 1m/yr/1aWaIUyrenTPKcLfB2uA== X-Google-Smtp-Source: ACcGV63K0uXfKI1/RhsLF0L7r+UaNWZdOu8jtVF5sG+kwa+kceSV44F4R30Nxqu6HJ0ocIBWLrvbMA== X-Received: by 2002:a25:b007:: with SMTP id q7-v6mr12286215ybf.344.1539726458583; Tue, 16 Oct 2018 14:47:38 -0700 (PDT) Received: from alago.cortijodelrio.net (CableLink-187-161-144-121.PCs.InterCable.net. [187.161.144.121]) by smtp.googlemail.com with ESMTPSA id b71-v6sm4040122ywa.48.2018.10.16.14.47.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 14:47:37 -0700 (PDT) From: =?utf-8?q?Daniel_D=C3=ADaz?= To: shuah@kernel.org, linux-kselftest@vger.kernel.org Cc: =?utf-8?q?Daniel_D=C3=ADaz?= , Bamvor Jian Zhang , Bartosz Golaszewski , linux-gpio@vger.kernel.org (open list:GPIO MOCKUP DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] selftests: gpio: Find libmount with pkg-config if available Date: Tue, 16 Oct 2018 16:46:59 -0500 Message-Id: <20181016214659.22362-1-daniel.diaz@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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