projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86: coding style cleanup for kernel/bootflag.c
[powerpc.git]
/
scripts
/
mkmakefile
diff --git
a/scripts/mkmakefile
b/scripts/mkmakefile
index
7f9d544
..
e65d8b3
100644
(file)
--- a/
scripts/mkmakefile
+++ b/
scripts/mkmakefile
@@
-11,6
+11,12
@@
test ! -r $2/Makefile -o -O $2/Makefile || exit 0
test ! -r $2/Makefile -o -O $2/Makefile || exit 0
+# Only overwrite automatically generated Makefiles
+# (so we do not overwrite kernel Makefile)
+if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
+then
+ exit 0
+fi
echo " GEN $2/Makefile"
cat << EOF > $2/Makefile
echo " GEN $2/Makefile"
cat << EOF > $2/Makefile
@@
-19,18
+25,24
@@
cat << EOF > $2/Makefile
VERSION = $3
PATCHLEVEL = $4
VERSION = $3
PATCHLEVEL = $4
-KERNELSRC := $1
-KERNELOUTPUT := $2
+lastword = \$(word \$(words \$(1)),\$(1))
+makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
+
+MAKEARGS := -C $1
+MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
MAKEFLAGS += --no-print-directory
.PHONY: all \$(MAKECMDGOALS)
MAKEFLAGS += --no-print-directory
.PHONY: all \$(MAKECMDGOALS)
+all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
+
all:
all:
- \$(MAKE)
-C \$(KERNELSRC) O=\$(KERNELOUTPUT
)
+ \$(MAKE)
\$(MAKEARGS) \$(all
)
Makefile:;
Makefile:;
-\$(filter-out all Makefile,\$(MAKECMDGOALS)) %/:
- \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
+\$(all) %/: all
+ @:
+
EOF
EOF