]> err.no Git - linux-2.6/commitdiff
kbuild: Do not overwrite makefile as anohter user
authorJan Beulich <jbeulich@novell.com>
Tue, 2 May 2006 10:33:20 +0000 (12:33 +0200)
committerSam Ravnborg <sam@mars.ravnborg.org>
Mon, 8 May 2006 04:55:32 +0000 (06:55 +0200)
Change the conditional of the outputmakefile rule to be evaluated entirely
in make, and add a conditional to not touch the generated makefile when e.g.
running 'make install' as root while the build was done as non-root. Also
adjust the comment describing this, and move the message printing and
redirection to mkmakefile.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Makefile
scripts/mkmakefile

index 8517f7ba247318d7d722438be0cb6b80b92106c7..9e4c5692a32f2e89cdd0533b1abff532938dcb52 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -344,16 +344,14 @@ scripts_basic:
 scripts/basic/%: scripts_basic ;
 
 PHONY += outputmakefile
-# outputmakefile generate a Makefile to be placed in output directory, if
-# using a seperate output directory. This allows convinient use
-# of make in output directory
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
 outputmakefile:
-       $(Q)if test ! $(srctree) -ef $(objtree); then \
-       $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile              \
-           $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)         \
-           > $(objtree)/Makefile;                                 \
-           echo '  GEN    $(objtree)/Makefile';                   \
-       fi
+ifneq ($(KBUILD_SRC),)
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
+           $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+endif
 
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to scripts/kconfig/Makefile
index a22cbedd3b3ec0738379c283d4fb2df5b33209ec..7f9d544f9b6c07339021bdb80762feeb7b95f9bf 100644 (file)
 # $4 - patchlevel
 
 
-cat << EOF
+test ! -r $2/Makefile -o -O $2/Makefile || exit 0
+echo "  GEN     $2/Makefile"
+
+cat << EOF > $2/Makefile
 # Automatically generated by $0: don't edit
 
 VERSION = $3