Commit fd5f0cd6 authored by Jan Beulich's avatar Jan Beulich Committed by Sam Ravnborg

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: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent cc873e1a
...@@ -344,16 +344,14 @@ scripts_basic: ...@@ -344,16 +344,14 @@ scripts_basic:
scripts/basic/%: scripts_basic ; scripts/basic/%: scripts_basic ;
PHONY += outputmakefile PHONY += outputmakefile
# outputmakefile generate a Makefile to be placed in output directory, if # outputmakefile generates a Makefile in the output directory, if using a
# using a seperate output directory. This allows convinient use # separate output directory. This allows convenient use of make in the
# of make in output directory # output directory.
outputmakefile: outputmakefile:
$(Q)if test ! $(srctree) -ef $(objtree); then \ ifneq ($(KBUILD_SRC),)
$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
> $(objtree)/Makefile; \ endif
echo ' GEN $(objtree)/Makefile'; \
fi
# To make sure we do not include .config for any of the *config targets # 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 # catch them early, and hand them over to scripts/kconfig/Makefile
......
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
# $4 - patchlevel # $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 # Automatically generated by $0: don't edit
VERSION = $3 VERSION = $3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment