From 353270263ad81a5b2f43e191dadd46003a431c2c Mon Sep 17 00:00:00 2001
From: Dan McArdle <d@nmcardle.com>
Date: Mon, 23 Sep 2024 17:39:24 -0400
Subject: [PATCH] Makefile: Prevent `doc` recipe from creating dir named
 '$HOME'

Prior to this commit, running `make doc` had the unwanted side effect of
creating a directory literally named `$HOME` in the source tree.

Fixed #8092
---
 Makefile                 | 2 +-
 bin/make_backend_docs.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 4a9d2240f..9635cdf13 100644
--- a/Makefile
+++ b/Makefile
@@ -144,7 +144,7 @@ MANUAL.txt:	MANUAL.md
 	pandoc -s --from markdown-smart --to plain MANUAL.md -o MANUAL.txt
 
 commanddocs: rclone
-	XDG_CACHE_HOME="" XDG_CONFIG_HOME="" HOME="\$$HOME" USER="\$$USER" rclone gendocs docs/content/
+	XDG_CACHE_HOME="" XDG_CONFIG_HOME="" HOME="\$$HOME" USER="\$$USER" rclone gendocs --config=/notfound docs/content/
 
 backenddocs: rclone bin/make_backend_docs.py
 	XDG_CACHE_HOME="" XDG_CONFIG_HOME="" HOME="\$$HOME" USER="\$$USER" ./bin/make_backend_docs.py
diff --git a/bin/make_backend_docs.py b/bin/make_backend_docs.py
index 07da64463..c600469c0 100755
--- a/bin/make_backend_docs.py
+++ b/bin/make_backend_docs.py
@@ -21,12 +21,12 @@ def find_backends():
 def output_docs(backend, out, cwd):
     """Output documentation for backend options to out"""
     out.flush()
-    subprocess.check_call(["./rclone", "help", "backend", backend], stdout=out)
+    subprocess.check_call(["./rclone", "--config=/notfound", "help", "backend", backend], stdout=out)
 
 def output_backend_tool_docs(backend, out, cwd):
     """Output documentation for backend tool to out"""
     out.flush()
-    subprocess.call(["./rclone", "backend", "help", backend], stdout=out, stderr=subprocess.DEVNULL)
+    subprocess.call(["./rclone", "--config=/notfound", "backend", "help", backend], stdout=out, stderr=subprocess.DEVNULL)
     
 def alter_doc(backend):
     """Alter the documentation for backend"""