From patchwork Wed Feb 22 15:08:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 9586965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 35440600CA for ; Wed, 22 Feb 2017 15:08:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 227262856B for ; Wed, 22 Feb 2017 15:08:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 171422863F; Wed, 22 Feb 2017 15:08:58 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 C22B52856B for ; Wed, 22 Feb 2017 15:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932857AbdBVPI5 (ORCPT ); Wed, 22 Feb 2017 10:08:57 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33118 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932684AbdBVPI4 (ORCPT ); Wed, 22 Feb 2017 10:08:56 -0500 Received: by mail-pg0-f68.google.com with SMTP id 5so790787pgj.0; Wed, 22 Feb 2017 07:08:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=D/oksn+I8UY4yq1Z9IUB5XXzwRf0OJFOAblAN2oX27A=; b=fBcVdoJWTQoIzu7Yqsmgjn5Jd6cvfPYpCuLQE8F8uXT7rX8kQNR6uHfyeedWhNoi+P CYLqZDB1nJO2a+StV5PpR5xWBArp+pgG2mBLyLY6BFaroAHXa5LQ3wmTCf6C78fnWmfy J2fW5UwTABlDkevj5CGM32z3DAT1/ZIWeoORlcQ3Hi3QAnyyU79aIuL3VY4okCza0/Lp G5EQ4ORnMPF8QtkehYJm3IRZ9R8srdB5YHq6QZ0LLZ36bpiz03ZWDsJSYl2HjxCoYVdW eezflBVs/XKjEHdwUvAk6P2Z7EL3wxBgrrgFK2w7PEFonuLx9+tnoWQsW9rSjmNFfsgE AAYA== 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; bh=D/oksn+I8UY4yq1Z9IUB5XXzwRf0OJFOAblAN2oX27A=; b=KMNYi5Qd7XP0Wt5VyICj8g9yxMU05/y0Uvhzp7aVDLc1HnWPBfNPzin0eNQTCxQk00 kuADXfm9hAwwzCGakIa5rEOvLHhjjV8RaDCIpgCzbfQ/kfUsmuamNzEirfAAHBmr7V7n 6qP9A9j8z1qQSLznGbaBeGezl3J7jdYsRFO72cca0cu4oMybFj+mIb03LQvM4u7CAKzi uJrcj+dBVwy+Nzb2FSpEOhxQRXGcd/JCOedhFlFGfrJWNwIfVP7a7YFy4R6/BRT9OzrC 22IwUu8BToNnWgGSXs31twZyPbaAStR/xs+RwhVMQKZnkYdV6jA3LJrNkjPXa4A1kiym TIyA== X-Gm-Message-State: AMke39nRAI/7tab9JJbcTRLRlInJ1IPPrzmHUydSTjadoAGHIg+2uDjnlNIc4Hc+zMD92g== X-Received: by 10.84.179.165 with SMTP id b34mr48876183plc.147.1487776135807; Wed, 22 Feb 2017 07:08:55 -0800 (PST) Received: from localhost (li680-30.members.linode.com. [23.239.0.30]) by smtp.gmail.com with ESMTPSA id c64sm4371259pfa.45.2017.02.22.07.08.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 07:08:55 -0800 (PST) From: Wei Yang To: mmarek@suse.com Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH] kbuild: strip the last slash in KBUILD_EXTMOD Date: Wed, 22 Feb 2017 23:08:33 +0800 Message-Id: <20170222150833.83149-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current kbuild will build the target again if we run "make M=dir" and "make M=dir/" by turns, since if_changed will see the prerequisite is changed. The behavior may confuse the user a little, since actually we are building the same target and no difference. According to current implementation in scripts/Makefile.build, the obj passed to next level is a directory name with last slash stripped. This patch strips the last slash in KBUILD_EXTMOD which is assigned from "M=". Signed-off-by: Wei Yang --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b1037774e8e8..db6ed60928ab 100644 --- a/Makefile +++ b/Makefile @@ -184,13 +184,15 @@ endif # Old syntax make ... SUBDIRS=$PWD is still supported # Setting the environment variable KBUILD_EXTMOD take precedence ifdef SUBDIRS - KBUILD_EXTMOD ?= $(SUBDIRS) + __KBUILD_EXTMOD ?= $(SUBDIRS) endif ifeq ("$(origin M)", "command line") - KBUILD_EXTMOD := $(M) + __KBUILD_EXTMOD := $(M) endif +KBUILD_EXTMOD = $(patsubst %/,%,$(__KBUILD_EXTMOD)) + # If building an external module we do not care about the all: rule # but instead _all depend on modules PHONY += all