History

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.

Jan Beulich committed 20 years ago

Commit fd5f0cd1 parent cc873e12 files · +11 −10Browse files

Unified · Split

2 files
  1. Makefile +7 −9
  2. scripts/mkmakefile +4 −1
Makefile+7−9
@@ -344,16 +344,14 @@ scripts_basic: · 343 unmodified lines
344scripts/basic/%: scripts_basic ;344scripts/basic/%: scripts_basic ;
345 345
346PHONY += outputmakefile346PHONY += outputmakefile
347# outputmakefile generate a Makefile to be placed in output directory, if347# outputmakefile generates a Makefile in the output directory, if using a
348# using a seperate output directory. This allows convinient use348# separate output directory. This allows convenient use of make in the
349# of make in output directory349# output directory.
350outputmakefile:350outputmakefile:
351 $(Q)if test ! $(srctree) -ef $(objtree); then \351ifneq ($(KBUILD_SRC),)
352 $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \352 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
353 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \353 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
354 > $(objtree)/Makefile; \354endif
355 echo ' GEN $(objtree)/Makefile'; \
356 fi
357 355
358# To make sure we do not include .config for any of the *config targets356# To make sure we do not include .config for any of the *config targets
359# catch them early, and hand them over to scripts/kconfig/Makefile357# catch them early, and hand them over to scripts/kconfig/Makefile
scripts/mkmakefile+4−1
@@ -10,7 +10,10 @@ · 9 unmodified lines
10# $4 - patchlevel10# $4 - patchlevel
11 11
12 12
13cat << EOF13test ! -r $2/Makefile -o -O $2/Makefile || exit 0
14echo " GEN $2/Makefile"
15
16cat << EOF > $2/Makefile
14# Automatically generated by $0: don't edit17# Automatically generated by $0: don't edit
15 18
16VERSION = $319VERSION = $3

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t