From patchwork Thu Aug 8 11:21:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 170793 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp8429990ile; Thu, 8 Aug 2019 04:21:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEu/4T/FtgcUzgEPMqww2aseEyrTY5YZ7Etu3VMymuqws32QouE1WxTMLJqfIoh/elJVLd X-Received: by 2002:a17:902:8b82:: with SMTP id ay2mr12427184plb.164.1565263313204; Thu, 08 Aug 2019 04:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565263313; cv=none; d=google.com; s=arc-20160816; b=hioAwV2JVFzey5OVqP4Ou+yff4YpVxf80CXpgjyQde5msM+f0eFnL85vfPhXCt8Ni2 vy0MMq6EbiL/Tu8D/CqMjmYdzKo8EoRUaKnLsSDwRFpXgDA/GJ8y1Xwd5u25JadOlat2 I31nz7ysVDgy6Qre0H72CgeljrGTtS9Iy4rw5zXlfKwEwrK8BgSj6kRgnNL9vDIfUmk2 2mohuSF3p3nP/IJ8CaxMx9GRTkO9u8Soz6RfwiQS2kQ/IpX1L9ITtYCLEo8sImpVzzjt beBHetYDW2c2Tv5qDuB/kMmwQzhwlCp9Ql6NOfT50ADSD49dpnD5ZtQneNW9h28KZMy1 Px0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Y3joUPUMYoBzCVDWCYCkXvHGxBHe0Rsmx3YuHH4+91M=; b=aZsEMDUjcEIu6tNmeVPPayIsVNUZP0o691+cDGoGWClmyrV3lkex5PE4AKU34tG08B Cv6moj7I0S1JeaRCv8ADc/dU3poVTzWiTsrLuUOZYoTCAasmAMF8Em5EGI7+gpe6lkwO O3rJUHs6ZwEbWXkw4VpPr98UG4vOuNgzAAgbmQzpB1ZMmKZoduzx/pobrNVAw32NFEKx 3kweuh8b06BKNStjsp4gSmxonCj0gsdlOUnMOMg87DNIjP27Uks6VWp8Uwyf2Eki6wrB oh8xMouXewwSnOraQxPglBefrL8LGBiHDwcaTqaxIqeXQ6/i5N2lz9EqO3NvtlPGHzoY P0eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=iCGTFksi; 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 cl13si47423639plb.97.2019.08.08.04.21.52; Thu, 08 Aug 2019 04:21:53 -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=iCGTFksi; 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 S1732202AbfHHLVv (ORCPT + 28 others); Thu, 8 Aug 2019 07:21:51 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:37726 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730747AbfHHLVv (ORCPT ); Thu, 8 Aug 2019 07:21:51 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x78BLEkO027157; Thu, 8 Aug 2019 20:21:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x78BLEkO027157 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1565263275; bh=Y3joUPUMYoBzCVDWCYCkXvHGxBHe0Rsmx3YuHH4+91M=; h=From:To:Cc:Subject:Date:From; b=iCGTFksi3llJddT4lN0m7yPIlNGjS7AghbijE+hez0ISz3b3PLhEoWhe8ZzA0AQD1 tmuGow482ok/3d9oy/0PYpn+1SAfMT+duWTPJQBgh55L34l4wnb740DftNfP72p4bK aVKdwDsT6xKeiIXY6if/cQyMi6kDX7o+z1dasan/d74TyZq2vmZdgJeo71cIXEwTro iqtvX0k17GTKR4xWb7K4k/D8ZMkBB3hhnVx+hj9cJtujetuLZmPO8IkT27p6dP6HMb uwYk3S0pCSmHXXn7Ttt/VrmKEz0l3WNU0cenS5Khc2kLclUhn33SlMDoN2Vlg58Ik9 oGL/0vdUIw4fg== 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 v2] kbuild: show hint if subdir-y/m is used to visit module Makefile Date: Thu, 8 Aug 2019 20:21:11 +0900 Message-Id: <20190808112111.16159-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 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. I touched the %/ rule to avoid false-positive warnings for the single target. Cc: Jan Kiszka Cc: Tom Stonecypher Signed-off-by: Masahiro Yamada --- Changes in v2: - fix false-positive warnings for single targets Makefile | 2 +- scripts/Makefile.build | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.17.1 Tested-by: Jan Kiszka diff --git a/Makefile b/Makefile index 0e37ad2f77bf..fac25e279da6 100644 --- a/Makefile +++ b/Makefile @@ -1783,7 +1783,7 @@ PHONY += / /: ./ %/: prepare FORCE - $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) + $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir) need-modorder=1 # FIXME Should go into a make.lib or something # =========================================================================== diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 37a1d2cd49d4..2f66ed388d1c 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -52,6 +52,13 @@ ifndef obj $(warning kbuild: Makefile.build is included improperly) endif +ifeq ($(MAKECMDGOALS)$(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-)),)