Blame view

scripts/mkmakefile 896 Bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
  #!/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
fd5f0cd6b   Jan Beulich   kbuild: Do not ov...
11
  test ! -r $2/Makefile -o -O $2/Makefile || exit 0
18c32dac7   Sam Ravnborg   kbuild: fix build...
12
13
  # Only overwrite automatically generated Makefiles
  # (so we do not overwrite kernel Makefile)
971edcfc8   Guillaume Chazarain   kbuild: re-enable...
14
  if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
18c32dac7   Sam Ravnborg   kbuild: fix build...
15
16
17
  then
  	exit 0
  fi
fd5f0cd6b   Jan Beulich   kbuild: Do not ov...
18
19
20
  echo "  GEN     $2/Makefile"
  
  cat << EOF > $2/Makefile
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
24
25
26
27
28
29
  # Automatically generated by $0: don't edit
  
  VERSION = $3
  PATCHLEVEL = $4
  
  KERNELSRC    := $1
  KERNELOUTPUT := $2
  
  MAKEFLAGS += --no-print-directory
96678281b   Jan Beulich   kbuild: fix mkmak...
30
  .PHONY: all \$(MAKECMDGOALS)
0b35786d7   Milton Miller   kbuild: call make...
31
  all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
  all:
0b35786d7   Milton Miller   kbuild: call make...
33
  	\$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$(all)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34

96678281b   Jan Beulich   kbuild: fix mkmak...
35
  Makefile:;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36

0b35786d7   Milton Miller   kbuild: call make...
37
38
  \$(all) %/: all
  	@:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
  EOF