X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=scripts%2Fmkmakefile;h=e65d8b33faa4cae649044fb48d8fc87fa012d574;hb=9de3a0b6979a4839d67ca840e386ea06acaabe39;hp=ee39facee15238f8f4148fc2b7e914f07a31b613;hpb=fe537c0ee86b27fbe0690a7869815da80f492dbd;p=mv-sheeva.git diff --git a/scripts/mkmakefile b/scripts/mkmakefile index ee39facee15..e65d8b33faa 100644 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile @@ -11,6 +11,12 @@ 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 @@ -19,8 +25,11 @@ cat << EOF > $2/Makefile 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 @@ -29,10 +38,11 @@ MAKEFLAGS += --no-print-directory all := \$(filter-out all Makefile,\$(MAKECMDGOALS)) all: - \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all) + \$(MAKE) \$(MAKEARGS) \$(all) Makefile:; \$(all) %/: all @: + EOF