2014-02-04 08:24:27 +00:00
|
|
|
#!/bin/sh
|
2021-06-17 22:07:25 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2014-02-04 08:24:27 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
# Only overwrite automatically generated Makefiles
|
|
|
|
# (so we do not overwrite kernel Makefile)
|
2021-06-17 22:07:25 +00:00
|
|
|
if test -e Makefile && ! grep -q Automatically Makefile
|
2014-02-04 08:24:27 +00:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
if [ "${quiet}" != "silent_" ]; then
|
2021-06-17 22:07:25 +00:00
|
|
|
echo " GEN Makefile"
|
2014-02-04 08:24:27 +00:00
|
|
|
fi
|
|
|
|
|
2021-06-17 22:07:25 +00:00
|
|
|
cat << EOF > Makefile
|
2014-02-04 08:24:27 +00:00
|
|
|
# Automatically generated by $0: don't edit
|
|
|
|
|
|
|
|
ifeq ("\$(origin V)", "command line")
|
|
|
|
VERBOSE := \$(V)
|
|
|
|
endif
|
|
|
|
ifneq (\$(VERBOSE),1)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
|
2014-08-05 06:56:44 +00:00
|
|
|
.PHONY: __sub-make \$(MAKECMDGOALS)
|
2014-02-04 08:24:27 +00:00
|
|
|
|
2014-08-05 06:56:44 +00:00
|
|
|
__sub-make:
|
2021-06-17 22:07:25 +00:00
|
|
|
\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
|
2014-02-04 08:24:27 +00:00
|
|
|
|
2014-08-05 06:56:44 +00:00
|
|
|
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
|
2014-02-04 08:24:27 +00:00
|
|
|
@:
|
|
|
|
EOF
|