]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kbuild: do not overwrite .gitignore in output directory
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 26 Mar 2019 04:26:58 +0000 (13:26 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 28 Mar 2019 14:46:55 +0000 (23:46 +0900)
Commit 3a51ff344204 ("kbuild: gitignore output directory") seemed to
bother people who version-control output directories.

Andre Przywara says:
"Unfortunately this breaks my setup, because I keep a totally separate
git repository in my build directories to track (various versions of)
.config. So .gitignore there is carefully crafted to ignore most build
artefacts, but not .config, for instance."

Link: https://lkml.org/lkml/2019/3/22/1819
Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Makefile

index 3c788a65d65294c0156494155842b7f8bf6ce05a..2810425541f4d6d45ed11e1d18babb026a75fa1c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -499,7 +499,8 @@ outputmakefile:
 ifneq ($(KBUILD_SRC),)
        $(Q)ln -fsn $(srctree) source
        $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
-       $(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
+       $(Q)test -e .gitignore || \
+       { echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
 endif
 
 ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)