coresight: Fix crash when Perf and sysfs modes are used concurrently
[platform/kernel/linux-starfive.git] / scripts / mkcompile_h
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3
4 UTS_MACHINE=$1
5 CC_VERSION="$2"
6 LD=$3
7
8 if test -z "$KBUILD_BUILD_USER"; then
9         LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
10 else
11         LINUX_COMPILE_BY=$KBUILD_BUILD_USER
12 fi
13 if test -z "$KBUILD_BUILD_HOST"; then
14         LINUX_COMPILE_HOST=`uname -n`
15 else
16         LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
17 fi
18
19 LD_VERSION=$(LC_ALL=C $LD -v | head -n1 |
20                 sed -e 's/(compatible with [^)]*)//' -e 's/[[:space:]]*$//')
21
22 cat <<EOF
23 #define UTS_MACHINE             "${UTS_MACHINE}"
24 #define LINUX_COMPILE_BY        "${LINUX_COMPILE_BY}"
25 #define LINUX_COMPILE_HOST      "${LINUX_COMPILE_HOST}"
26 #define LINUX_COMPILER          "${CC_VERSION}, ${LD_VERSION}"
27 EOF