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: 148998 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5629773lji; Tue, 16 Oct 2018 14:47:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV63bebxHDvhWKdfNHyawkNKJ9jJei3ysr3bUNtzlPfs67Rg5AZLJHqeGN+TKwyghI8+eDx6M X-Received: by 2002:a17:902:104:: with SMTP id 4-v6mr23446233plb.189.1539726461569; Tue, 16 Oct 2018 14:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539726461; cv=none; d=google.com; s=arc-20160816; b=ncuxGp6g22P/jhAUnjqIvjEPLMJ+0IRjp8afbhMWCWqF/kztOuIuKin9tfOQ1kG1XL 9/zGNNqOOKOBAsoXm7eHySv8VkH0BqQ6JFnXxBOXoYSNEfMjIE0YUxt4a+KKN505uJ8T ELPaultpwDoy6gW41+nTCEIbd2L0IZmTWmQbV8yB1AGs/oPqDaH9UXn0uCrkcnFvkOb+ WkHPAq7CxdriNG+sZ3Jh4DSZRN2v0HWq9qBDja676jjZAyL1BN/o7UsgZ0W16/SLkBCm k77ZdGWME4nESk2GvPC+sAEmk9uD7Vy3S1b66JntnYn3JzJ3fWsMZSBlaOm1jbXj4J+c Jgwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=BQJKia//hru3n+/JYCjGhW0IPokv27OxI/Ee3R6hFTw=; b=IPMy4ao7mfyfQWdhoxUL4+Oo84UgAtrKZBJm8gE4arJVgg0Wx0sXzsxyfCmFGBtWKJ o9ly4OgrWh9z0k8X2HH2B4ynE1Q/WvQ5o0bxopifN0mihdnlbBsOUWupdlu9P+sp5s+Q b66aZVUlG96/mvPBD8nXV6ViKKloCos7l7jkTkahqaxX+77rs5fmXGY9zrYdnbqe6G1/ aBzMKAPPv32nrB868xc0duW0ePjliZFHI/NeRKmNzTLygcUFSWYCzrHfLFn8Owo4dGIJ ltcPq+NWrWsTDvvLGNDKLmABxdNo/sZgj4A7gQCrh4XjbjGwpGONVvfyHLeQNJ9c5pAL 300Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OTlT7VJb; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11-v6si14036266pfn.212.2018.10.16.14.47.40; Tue, 16 Oct 2018 14:47:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OTlT7VJb; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727098AbeJQFkB (ORCPT + 5 others); Wed, 17 Oct 2018 01:40:01 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:46747 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbeJQFkA (ORCPT ); Wed, 17 Oct 2018 01:40:00 -0400 Received: by mail-yb1-f194.google.com with SMTP id o8-v6so9531109ybk.13 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=mq9D5YnnFS+xJ7yi9F5leHnikfcmCECGzpEIcYO2yjqp0BXOoiclgXMt7lNmwZeQrM HPs5Y+bvDV0r9XjQBy/IFUHvm61m/E8QCxdVo+euUEH+s2jVPU+dRNUnHtOYOVBF/enm ehQBdI1pIwJWaPp2MjuMKrz2J11c2Vrm/7BWm5/8ovwFff6dbVgOjusoIe4WlMObA/kH pB0eDYdvVeWrP+U8zdzPKiM2a7kiKjVs90ra95Y4vYQUiJRJR/i/IiCsH7Qd0ESOcS1+ x9a4oM7E28oKvj0SsgUH5KszoiLA4Qxd7c4zKLJ43ae9Buoo2nLBxCVhe/qjnd/KF82y XgSg== X-Gm-Message-State: ABuFfoihsG4q/pMF2uDs13m28hdhe207UWiyaJhVjVvm0FSEtZY8DZ8c 6UzVRVWfaq9qzKfAxcbd2bA6+w== 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-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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(-) -- 2.17.1 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