summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2006-05-02 12:33:20 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2006-05-08 06:55:32 +0200
commitfd5f0cd6b0cef59ba18e5ac13be5b2775fa6ec28 (patch)
tree3ae3209f1846261c9a455339ddcd40d16cd2bf99
parentcc873e1aa1fa916a485294117a9846e668505671 (diff)
kbuild: Do not overwrite makefile as anohter user
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>
-rw-r--r--Makefile16
-rw-r--r--scripts/mkmakefile5
2 files changed, 11 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 8517f7ba247..9e4c5692a32 100644
--- 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
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index a22cbedd3b3..7f9d544f9b6 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -10,7 +10,10 @@
# $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