[PATCH] kbuild: support external module out-of-tree build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 205af45582ad0cb1293839a95ee01d383f1cfbf1 Mon Sep 17 00:00:00 2001
From: Yuan Jianpeng <yuanjianpeng@xxxxxxxxxx>
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=<output dir> KBUILD_EXTMOD_SRC=<module source dir>

Signed-off-by: Yuan Jianpeng <yuanjianpeng@xxxxxxxxxx>
---
 scripts/Makefile.build   | 2 +-
 scripts/Makefile.clean   | 2 +-
 scripts/Makefile.modpost | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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)
--
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!******/#




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux