aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 03:54:53 +0200
committerSam Ravnborg <sam@mars.ravnborg.org>2004-07-28 03:54:53 +0200
commite321b2ec2eb2993b3d0116e5163c78ad923e3c54 (patch)
tree9c3073b0fdc5766bec7a8e24f6ac5f27bc6e0f36 /scripts
parent56978bc28161020c87403d6ab3c28798c658daa4 (diff)
downloadhistory-e321b2ec2eb2993b3d0116e5163c78ad923e3c54.tar.gz
kbuild: Create Makefile in output directory if != kernel tree
When building a kernel using the O= syntax to save output files in a separate output directory now create a small Makefile in that same dir. This Makefile allow one to use make in the output directory without the hassle of going back to the kernel source tree. The O= option is added by this Makefile stub. Please note that the Makefile silently overwrite an old one, so changes will be lost if modified. If there is a need to tweak a Makefile in the output directory it is recommended to use the filename 'makefile', which GNU Make will try first. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mkmakefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
new file mode 100644
index 00000000000000..c4d621b30d0db1
--- /dev/null
+++ b/scripts/mkmakefile
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Generates a small Makefile used in the root of the output
+# directory, to allow make to be started from there.
+# The Makefile also allow for more convinient build of external modules
+
+# Usage
+# $1 - Kernel src directory
+# $2 - Output directory
+# $3 - version
+# $4 - patchlevel
+
+
+cat << EOF
+# Automatically generated by $0: don't edit
+
+VERSION = $3
+PATCHLEVEL = $4
+
+KERNELSRC := $1
+KERNELOUTPUT := $2
+
+MAKEFLAGS += --no-print-directory
+
+all:
+ \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
+
+%::
+ \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
+
+EOF
+