]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - scripts/mkmakefile
x86/msr-index: Cleanup bit defines
[mirror_ubuntu-bionic-kernel.git] / scripts / mkmakefile
CommitLineData
1da177e4 1#!/bin/sh
b2441318 2# SPDX-License-Identifier: GPL-2.0
1da177e4
LT
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
6
7# Usage
8# $1 - Kernel src directory
9# $2 - Output directory
10# $3 - version
11# $4 - patchlevel
12
13
fd5f0cd6 14test ! -r $2/Makefile -o -O $2/Makefile || exit 0
18c32dac
SR
15# Only overwrite automatically generated Makefiles
16# (so we do not overwrite kernel Makefile)
971edcfc 17if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
18c32dac
SR
18then
19 exit 0
20fi
d2301249
SR
21if [ "${quiet}" != "silent_" ]; then
22 echo " GEN $2/Makefile"
23fi
fd5f0cd6
JB
24
25cat << EOF > $2/Makefile
1da177e4
LT
26# Automatically generated by $0: don't edit
27
28VERSION = $3
29PATCHLEVEL = $4
30
1d3b3bfa
JB
31lastword = \$(word \$(words \$(1)),\$(1))
32makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
33
0ff35771
PF
34ifeq ("\$(origin V)", "command line")
35VERBOSE := \$(V)
36endif
37ifneq (\$(VERBOSE),1)
38Q := @
39endif
40
1d3b3bfa
JB
41MAKEARGS := -C $1
42MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
1da177e4
LT
43
44MAKEFLAGS += --no-print-directory
45
9319f453 46.PHONY: __sub-make \$(MAKECMDGOALS)
96678281 47
9319f453
MY
48__sub-make:
49 \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
0b35786d 50
9319f453 51\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
3c955b40 52 @:
1da177e4 53EOF