Blame view
scripts/mkmakefile
1.19 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
#!/bin/sh |
b24413180 License cleanup: ... |
2 |
# SPDX-License-Identifier: GPL-2.0 |
1da177e4c Linux-2.6.12-rc2 |
3 4 5 6 7 8 9 10 11 |
# 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 kbuild: Do not ov... |
12 |
test ! -r $2/Makefile -o -O $2/Makefile || exit 0 |
18c32dac7 kbuild: fix build... |
13 14 |
# Only overwrite automatically generated Makefiles # (so we do not overwrite kernel Makefile) |
971edcfc8 kbuild: re-enable... |
15 |
if test -e $2/Makefile && ! grep -q Automatically $2/Makefile |
18c32dac7 kbuild: fix build... |
16 17 18 |
then exit 0 fi |
d2301249e kbuild: teach mkm... |
19 20 21 |
if [ "${quiet}" != "silent_" ]; then echo " GEN $2/Makefile" fi |
fd5f0cd6b kbuild: Do not ov... |
22 23 |
cat << EOF > $2/Makefile |
1da177e4c Linux-2.6.12-rc2 |
24 25 26 27 |
# Automatically generated by $0: don't edit VERSION = $3 PATCHLEVEL = $4 |
1d3b3bfab kbuild: scripts/m... |
28 29 |
lastword = \$(word \$(words \$(1)),\$(1)) makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) |
0ff35771f kbuild: silence g... |
30 31 32 33 34 35 |
ifeq ("\$(origin V)", "command line") VERBOSE := \$(V) endif ifneq (\$(VERBOSE),1) Q := @ endif |
1d3b3bfab kbuild: scripts/m... |
36 37 |
MAKEARGS := -C $1 MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) |
1da177e4c Linux-2.6.12-rc2 |
38 39 |
MAKEFLAGS += --no-print-directory |
9319f4539 kbuild: support s... |
40 |
.PHONY: __sub-make \$(MAKECMDGOALS) |
96678281b kbuild: fix mkmak... |
41 |
|
9319f4539 kbuild: support s... |
42 43 |
__sub-make: \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS) |
0b35786d7 kbuild: call make... |
44 |
|
9319f4539 kbuild: support s... |
45 |
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make |
3c955b407 fixes for using m... |
46 |
@: |
1da177e4c Linux-2.6.12-rc2 |
47 |
EOF |