mkmakefile 648 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Generates a small Makefile used in the root of the output
  3. # directory, to allow make to be started from there.
  4. # The Makefile also allow for more convinient build of external modules
  5. # Usage
  6. # $1 - Kernel src directory
  7. # $2 - Output directory
  8. # $3 - version
  9. # $4 - patchlevel
  10. cat << EOF
  11. # Automatically generated by $0: don't edit
  12. VERSION = $3
  13. PATCHLEVEL = $4
  14. KERNELSRC := $1
  15. KERNELOUTPUT := $2
  16. MAKEFLAGS += --no-print-directory
  17. .PHONY: all \$(MAKECMDGOALS)
  18. all:
  19. \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
  20. Makefile:;
  21. \$(filter-out all Makefile,\$(MAKECMDGOALS)) %/:
  22. \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
  23. EOF