Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2577448ybe; Thu, 12 Sep 2019 11:32:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2C4BibzfON4IYNjzq+ezDZR7y2D89unq2z+CwKJ4vgstHVmWKyBa2t2CKvaUZ0qpjdGQY X-Received: by 2002:a50:f152:: with SMTP id z18mr42756272edl.141.1568313166971; Thu, 12 Sep 2019 11:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568313166; cv=none; d=google.com; s=arc-20160816; b=f6Z1RRWbWhv+wFCVs0bqopxwb97JrsZVjrOcqheO/90KUl2UF6zaq+VhUGwfaoQACe gS6Z16bWRXzTWZcisEiXJTUJmfMz3IMyaSE0MLVyXf27zw9kMhalc9TVb91JC8pUPAm2 EFc8gFXgJernTQIWpdAWI9z9xdvUUrYtbObwwwefE3/xsREtJXF2FLjLOLEUy1V14QEX 8vebh5TzgaavdKYR+AVFAVBD8Bc9uH1RDVlBNmjJiqYpaDVSfuvAAEpJnmDzja4Ah00n yMdMy679n3aksRjluVsqR79Oix5DEuyFZ8QChI94mFniqc3QWINd1t0c34roYBo7dGXQ aXLQ== 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=425q+EI5prUG/76w/vzMZUodVpls78ES9Ka+fZC1U8Y=; b=ypPrdPvWtjlEDfHU35F/k84YbkuQ2r52q+yfJS0OV2FECv8J+Fci+WDSF3JvD97N4j zP0sN6bcbzupc7Ja+4YHbKVNuFWK1jCAlZ5Hy+wdei/q0YLPbIuJntyHhTfqoazCbM2s MP6hzPSIKOe608V5/OjlYTNHN9++jOm5z2xbbQzR8ELh8Jmcbs38yGpIb/EueymvSw61 GRMrFC/qNdm2ccblxWXSqKpIfF3QLZ8+o03CeelXFLzThHg9bgfXVzOIGXyY9mAnhqGb yXCIn+MO701YT9iTvc2wFQ6NYJwEhrC+RErOqH8GMWE35SzshDq/gJNogIxvoIdBOhB9 ojqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=fDc8man5; 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 h4si15489774edd.189.2019.09.12.11.32.23; Thu, 12 Sep 2019 11:32:46 -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=fDc8man5; 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 S1733191AbfILQXQ (ORCPT + 99 others); Thu, 12 Sep 2019 12:23:16 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42374 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730084AbfILQXK (ORCPT ); Thu, 12 Sep 2019 12:23:10 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1d021030; Fri, 13 Sep 2019 01:22:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1d021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305378; bh=425q+EI5prUG/76w/vzMZUodVpls78ES9Ka+fZC1U8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDc8man5VLLG93SfmFUxF2BcK8iikJO5UAmxbutIQC5+XCBt65sE38cTuXnLzBfLe gHt/HeBfMUTxTjiDlZ+hHHDiZLUbY01HZbl18o66yaFGD+z7MzK/R0iazfaIrjvwcF 2N2VsAnIMo18pTdxPWNNTc9xNeB7gfTo/oLnUwY2If4shzFug59r8IvTnwrsBsqe49 hCmxDc3ikTQtMbDSFYPWcpm0cUw0PY/vnTMcA2/g5VeuapOffOBr3GTQYods3JT0J9 w1y44FppyDt0hYuAqG5Qkljnbhx8Nar2p2Xtsr/lPeEA+STcmzmSU0Dk5U/EMgYKM6 vbwQ8lA8NGf7g== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] kbuild: change need-modorder implementation slightly Date: Fri, 13 Sep 2019 01:22:54 +0900 Message-Id: <20190912162254.9603-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190912162254.9603-1-yamada.masahiro@socionext.com> References: <20190912162254.9603-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Align with the need-builtin implementation. I also added need-modorder=1 to scripts/link-vmlinux.sh to make it more future-proof; currently, we have no module in the init/ directory, but if we had a one, scripts/Makefile.build would show a false positive warning. Signed-off-by: Masahiro Yamada --- Changes in v2: - do not show orphan obj-m warning unless you are building modules scripts/Makefile.build | 16 ++++++++-------- scripts/Makefile.lib | 2 ++ scripts/link-vmlinux.sh | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index aab9a14fa78d..3b04ff23deb1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -56,12 +56,10 @@ PHONY += __warn-orphan-obj-y __warn-orphan-obj-y: @echo "warning: $(patsubst %,'%',$(real-obj-y)) will not be linked to vmlinux even though obj-y is specified." >&2 -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 +PHONY += __warn-orphan-obj-m +__warn-orphan-obj-m: + @echo "warning: $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified." >&2 + @echo "warning: You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead." >&2 # =========================================================================== @@ -78,6 +76,8 @@ endif ifdef need-modorder modorder-target := $(obj)/modules.order +else ifneq ($(obj-m),) +modorder-target := __warn-orphan-obj-m endif mod-targets := $(patsubst %.o, %.mod, $(obj-m)) @@ -406,7 +406,7 @@ targets += $(obj)/built-in.a # # Create commands to either record .ko file or cat modules.order from # a subdirectory -$(modorder-target): $(subdir-ym) FORCE +$(obj)/modules.order: $(subdir-ym) FORCE $(Q){ $(foreach m, $(modorder), \ $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ | $(AWK) '!x[$$0]++' - > $@ @@ -513,7 +513,7 @@ $(subdir-ym): $(Q)$(MAKE) $(build)=$@ \ $(if $(filter $@/, $(KBUILD_SINGLE_TARGETS)),single-build=) \ need-builtin=$(if $(filter $@/built-in.a, $(subdir-obj-y)),1) \ - need-modorder=$(if $(need-modorder),$(if $(filter $@/modules.order, $(modorder)),1)) + need-modorder=$(if $(filter $@/modules.order, $(modorder)),1) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 26ac638525cb..23e524027740 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -23,7 +23,9 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # Determine modorder. # Unfortunately, we don't have information about ordering between -y # and -m subdirs. Just put -y's first. +ifdef need-modorder modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +endif # Handle objects in subdirs # --------------------------------------------------------------------------- diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 8961d999b86b..d9edfba54d84 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -216,7 +216,7 @@ else fi; # final build of init/ -${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1 +${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init need-builtin=1 need-modorder=1 #link vmlinux.o info LD vmlinux.o -- 2.17.1