From patchwork Tue Aug 6 10:03:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170653 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5474224ile; Tue, 6 Aug 2019 03:03:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnqIyGETWPbbxeKLaw23jc8gSh5G0asXz3aCptHOlOTc7NTlQ+Jp2hDp3qEvbK7TzOYeR0 X-Received: by 2002:a17:902:c509:: with SMTP id o9mr2434680plx.222.1565085830110; Tue, 06 Aug 2019 03:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085830; cv=none; d=google.com; s=arc-20160816; b=aaenGMRSSxwPiuH+H/2L+UWD4p/yrWjPDRIFTef0UqGdvV3PylCK4zZlHn2fU3AEQO A7I2fQhVtPLBEbrBnvRwfPpMQT3rz3tG/AMuwR9bWMuOgdi3dEYx7Sq4Ixo37NwgNU2B K3wZ+YaB9HdhwOzO1wOXpDbeaOsn0NdxPDVy6dnJm27Xvhots4ZUu74TmchjXrMdMbzn SGih6pvVT9v0ooi18MjzxdVpPTc6otbhgT05HT3XoY/dxd1gpjUzZr1flmi5n4GU8DHx 1V17qR/rSS2fUBay3CVPthjQhn6evDcRBCefX5nZ3a3uCs/vSZ/p7MH7K9cJh8f7kKhS F+Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=c5fIC9D2pNQf5m9q0GW5G7kSjp5FlUSpKAcjOG6gNXc=; b=tqeHv6JM0khoRJxg+nnineqKx6YPNSSk9veFFbYm5kl8yf0ozdMxR/1aRAbmb9cFiN kZHfDFAau8XzWIcpMq08XXQ/ZeMqYHvuUaRvdpEM8rkdl41O+np6v6UX7TwWIK+Dpb3V cvin+PNadWCMAuKSZgWL1hOW1eXIrnMJMojNMb29faCqSGrGqv9ZEErymz9/tvU8pX8s jCuVsU9fU2ul0J3N8eaNmOofarytn8e+DWvuBLHL3lnmfKMgBGDHGmI8ur0pC0fn4BA2 9srSd9CnHDNZx6FeTzvVbjEE9Lv3eYtJi9NiDQ9L5MA1HV7gLEuHVP17QM3n6cndpBoN RlBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=SdX9hynW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si48818651pfi.253.2019.08.06.03.03.49; Tue, 06 Aug 2019 03:03:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@nifty.com header.s=dec2015msa header.b=SdX9hynW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732641AbfHFKDs (ORCPT + 29 others); Tue, 6 Aug 2019 06:03:48 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:35238 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732584AbfHFKDr (ORCPT ); Tue, 6 Aug 2019 06:03:47 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x76A3QP7032264; Tue, 6 Aug 2019 19:03:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x76A3QP7032264 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565085808; bh=c5fIC9D2pNQf5m9q0GW5G7kSjp5FlUSpKAcjOG6gNXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SdX9hynWeliTkext6GKcbrRieTQFfibJfmOEdViGw11tEj+aU1Up6XQ5qGBAF8DJ6 HlRbt+0fzYZJ5O6oK0FHAc3i6QsUKxkPfsIy/c74aW4HmfGcsb+2j3tIJ3nFb9fcF1 /CEQnOruSqdONzS8CoaZ6whCteVkSdLz0jMHawlPIB9Owu9zdfc/zDbMSRQ1+jTwId Lwpp1JQ8EbjkxwM7peDdRuB8UTplVVblIjrRNejV/53F4Qxw/Ri5lSWq1PKcnk1gDn ps/caWOsejL1DQ1WyY5a7wGc2QapkO2+sHjhNZQ+MaeN0oR18/PpVPEYW2HNxWJa+q Wf0TNLJgf8Jdg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Jan Kiszka , Tom Stonecypher , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH 3/3] kbuild: show hint if subdir-y/m is used to visit module Makefile Date: Tue, 6 Aug 2019 19:03:23 +0900 Message-Id: <20190806100323.22919-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806100323.22919-1-yamada.masahiro@socionext.com> References: <20190806100323.22919-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit ff9b45c55b26 ("kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod"), a module is no longer built in the following pattern: [Makefile] subdir-y := some-module [some-module/Makefile] obj-m := some-module.o You cannot write Makefile this way in upstream because modules.order is not correctly generated. subdir-y is used to descend to a sub-directory that builds tools, device trees, etc. For external modules, the modules order does not matter. So, the Makefile above was known to work. I believe the Makefile should be re-written as follows: [Makefile] obj-m := some-module/ [some-module/Makefile] obj-m := some-module.o However, people will have no idea if their Makefile suddenly stops working. In fact, I received questions from multiple people. Show a warning if obj-m is specified in a Makefile visited by subdir-y or subdir-m. Cc: Jan Kiszka Cc: Tom Stonecypher Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 37a1d2cd49d4..4a26c7ed9198 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -52,6 +52,13 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif +ifeq ($(need-modorder),) +ifneq ($(obj-m),) +$(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.) +$(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.) +endif +endif + # =========================================================================== ifneq ($(strip $(lib-y) $(lib-m) $(lib-)),)