kbuild: fix building with O=.. options
[cascardo/linux.git] / scripts / mkmakefile
index ee39fac..9ad1bd7 100644 (file)
 
 
 test ! -r $2/Makefile -o -O $2/Makefile || exit 0
+# Only overwrite automatically generated Makefiles
+# (so we do not overwrite kernel Makefile)
+if ! grep -q Automatically $2/Makefile
+then
+       exit 0
+fi
 echo "  GEN     $2/Makefile"
 
 cat << EOF > $2/Makefile