]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - scripts/mkmakefile
2 # SPDX-License-Identifier: GPL-2.0
3 # Generates a small Makefile used in the root of the output
4 # directory, to allow make to be started from there.
5 # The Makefile also allow for more convinient build of external modules
8 # $1 - Kernel src directory
9 # $2 - Output directory
14 test ! -r $2/Makefile
-o -O $2/Makefile ||
exit 0
15 # Only overwrite automatically generated Makefiles
16 # (so we do not overwrite kernel Makefile)
17 if test -e $2/Makefile
&& ! grep -q Automatically
$2/Makefile
21 if [ "${quiet}" != "silent_" ]; then
22 echo " GEN $2/Makefile"
25 cat << EOF > $2/Makefile
26 # Automatically generated by $0: don't edit
31 lastword = \$(word \$(words \$(1)),\$(1))
32 makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
34 ifeq ("\$(origin V)", "command line")
42 MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
44 MAKEFLAGS += --no-print-directory
46 .PHONY: __sub-make \$(MAKECMDGOALS)
49 \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
51 \$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make