Blob Blame History Raw
From: Michal Kubecek <mkubecek@suse.cz>
Date: Mon, 5 Nov 2018 13:43:02 +0100
Subject: scripts/mkmakefile: honor second argument
Patch-mainline: Never, SUSE specific
References: none

Commit 4fd61277f662 ("kbuild: do not pass $(objtree) to
scripts/mkmakefile") assumes mkmakefile is always used to generate a
makefile in current directory. This is not true when generating makefile
for our kernel-*-devel package.

And since commit 48b5ffd12687 ("kbuild: mkmakefile: generate a simple
wrapper of top Makefile"), mkmakefile uses realpath to sanitize the path to
main Makefile. We have to avoid this as the path is going to be different
when generated makefile is going to be used from what it is when we run the
script.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 scripts/mkmakefile | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -11,7 +11,14 @@ if [ "${quiet}" != "silent_" ]; then
 	echo "  GEN     Makefile"
 fi
 
+if [ -z "$2" ]; then
 cat << EOF > Makefile
 # Automatically generated by $(realpath $0): don't edit
 include $(realpath $1/Makefile)
 EOF
+else
+cat << EOF > "$2/Makefile"
+# Automatically generated by $(basename $0): don't edit
+include $1/Makefile
+EOF
+fi