Skip to contentSkip to conversation

adjust outputmakefile rule

PATCH In review Jan Beulich 2 participants 3 messages Apr 26, 2006 – May 2, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adjust outputmakefile rule

Change the conditional of the outputmakefile rule to be evaluated entirely in make, and 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.

Makefile renamed from home/jbeulich/tmp/linux-2.6.17-rc2/Makefile +10 -8
diff -Npru /home/jbeulich/tmp/linux-2.6.17-rc2/Makefile 2.6.17-rc2-mkmakefile/Makefile
@@ -344,16 +344,18 @@ 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';                   \
+ifneq ($(KBUILD_SRC),)
+	$(Q)if [ ! -r $(objtree)/Makefile -o -O $(objtree)/Makefile ]; then \
+	    echo '  GEN     $(objtree)/Makefile';                           \
+	    $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile                   \
+		$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)              \
+		> $(objtree)/Makefile;                                      \
 	fi
+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
#1 lore raw
Quoted 4 lines · Jan Beulich

Change the conditional of the outputmakefile rule to be evaluated entirely in make, and 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.

Can I request you to redo this patch.
Move all logic (including print-out) to mkmakefile
And only let it print out "GEN ...." when it actttttttually generate
the Makefile.

Thanks,
Sam

Quoted 35 lines

diff -Npru /home/jbeulich/tmp/linux-2.6.17-rc2/Makefile 2.6.17-rc2-mkmakefile/Makefile

Makefile renamed from home/jbeulich/tmp/linux-2.6.17-rc2/Makefile +10 -8
@@ -344,16 +344,18 @@ 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';                   \
+ifneq ($(KBUILD_SRC),)
+	$(Q)if [ ! -r $(objtree)/Makefile -o -O $(objtree)/Makefile ]; then \
+	    echo '  GEN     $(objtree)/Makefile';                           \
+	    $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile                   \
+		$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)              \
+		> $(objtree)/Makefile;                                      \
 	fi
+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
#2 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line

Sam Ravnborg <[email protected]> 30.04.06 23:49 >>>

Quoted 4 lines · Jan Beulich

Change the conditional of the outputmakefile rule to be evaluated entirely in make, and 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.

Can I request you to redo this patch.
Move all logic (including print-out) to mkmakefile
And only let it print out "GEN ...." when it actttttttually generate
the Makefile.

Here we go:

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.

Makefile renamed from home/jbeulich/tmp/linux-2.6.17-rc3/Makefile +7 -9
@@ -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
scripts/mkmakefile renamed from home/jbeulich/tmp/linux-2.6.17-rc3/scripts/mkmakefile +4 -1
@@ -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