From patchwork Sat Mar 25 06:25:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?6KKB5bu66bmP?= X-Patchwork-Id: 13187627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1090CC6FD1F for ; Sat, 25 Mar 2023 06:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbjCYG0c (ORCPT ); Sat, 25 Mar 2023 02:26:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbjCYG0a (ORCPT ); Sat, 25 Mar 2023 02:26:30 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 24 Mar 2023 23:26:23 PDT Received: from outboundhk.mxmail.xiaomi.com (outboundhk.mxmail.xiaomi.com [207.226.244.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DFC8415882 for ; Fri, 24 Mar 2023 23:26:23 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.97,212,1669046400"; d="scan'208,223";a="72235275" Received: from hk-mbx02.mioffice.cn (HELO xiaomi.com) ([10.56.8.122]) by outboundhk.mxmail.xiaomi.com with ESMTP; 25 Mar 2023 14:25:20 +0800 Received: from BJ-MBX16.mioffice.cn (10.237.8.136) by HK-MBX02.mioffice.cn (10.56.8.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 25 Mar 2023 14:25:20 +0800 Received: from BJ-MBX14.mioffice.cn (10.237.8.134) by BJ-MBX16.mioffice.cn (10.237.8.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 25 Mar 2023 14:25:19 +0800 Received: from BJ-MBX14.mioffice.cn ([fe80::6818:35a6:e09:60fa]) by BJ-MBX14.mioffice.cn ([fe80::6818:35a6:e09:60fa%9]) with mapi id 15.02.0986.041; Sat, 25 Mar 2023 14:25:19 +0800 From: =?eucgb2312_cn?b?1Ky9qMX0?= To: masahiroy , nathan , ndesaulniers , nicolas , linux-kbuild CC: linux-kernel Subject: [PATCH] kbuild: support external module out-of-tree build Thread-Topic: [PATCH] kbuild: support external module out-of-tree build Thread-Index: AQHZXuHovkJw/vrxJEqawHIlFohm/A== Date: Sat, 25 Mar 2023 06:25:19 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [10.237.8.11] MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From 205af45582ad0cb1293839a95ee01d383f1cfbf1 Mon Sep 17 00:00:00 2001 From: Yuan Jianpeng Date: Sat, 25 Mar 2023 10:24:38 +0800 Subject: [PATCH] kbuild: support external module out-of-tree build A new module build variable KBUILD_EXTMOD_SRC is added which specifying the external module source path. Build like this: make -C $KDIR M= KBUILD_EXTMOD_SRC= Signed-off-by: Yuan Jianpeng --- scripts/Makefile.build | 2 +- scripts/Makefile.clean | 2 +- scripts/Makefile.modpost | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.38.1 #/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/# diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 76323201232a..971a2161d502 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -3,7 +3,7 @@ # Building # ========================================================================== -src := $(obj) +src := $(if $(KBUILD_EXTMOD_SRC),$(KBUILD_EXTMOD_SRC)$(patsubst $(KBUILD_EXTMOD)%,%,$(obj)),$(obj)) PHONY := $(obj)/ $(obj)/: diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 3649900696dd..5232a0b6e139 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -3,7 +3,7 @@ # Cleaning up # ========================================================================== -src := $(obj) +src := $(if $(KBUILD_EXTMOD_SRC),$(KBUILD_EXTMOD_SRC)$(patsubst $(KBUILD_EXTMOD)%,%,$(obj)),$(obj)) PHONY := __clean __clean: diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 0980c58d8afc..3f0b23157c68 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -103,7 +103,7 @@ else # set src + obj - they may be used in the modules's Makefile obj := $(KBUILD_EXTMOD) -src := $(obj) +src := $(if $(KBUILD_EXTMOD_SRC),$(KBUILD_EXTMOD_SRC)$(patsubst $(KBUILD_EXTMOD)%,%,$(obj)),$(obj)) # Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS include $(kbuild-file)