7 vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; }
9 # If compile.h exists already and we don't own autoconf.h
10 # (i.e. we're not the same user who did make *config), don't
12 # So "sudo make install" won't change the "compiled by <user>"
13 # do "compiled by root"
15 if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then
16 vecho " SKIPPED $TARGET"
23 # Fix the language to get consistent output
27 if [ -z "$KBUILD_BUILD_VERSION" ]; then
28 if [ -r .version ]; then
29 VERSION=`cat .version`
35 VERSION=$KBUILD_BUILD_VERSION
38 if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
41 TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
44 UTS_VERSION="#$VERSION"
46 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
47 if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
48 UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP"
50 # Truncate to maximum length
53 UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
55 # Generate a temporary compile.h
57 ( echo /\* This file is auto generated, version $VERSION \*/
58 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
60 echo \#define UTS_MACHINE \"$ARCH\"
62 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
64 echo \#define LINUX_COMPILE_TIME \"`date +%T`\"
65 echo \#define LINUX_COMPILE_BY \"`whoami`\"
66 echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
68 if [ -x /bin/dnsdomainname ]; then
69 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\"
70 elif [ -x /bin/domainname ]; then
71 echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\"
73 echo \#define LINUX_COMPILE_DOMAIN
76 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
79 # Only replace the real compile.h if the new one is different,
80 # in order to preserve the timestamp and avoid unnecessary
82 # We don't consider the file changed if only the date/time changed.
83 # A kernel config change will increase the generation number, thus
84 # causing compile.h to be updated (including date/time) due to the
85 # changed comment in the
88 if [ -r $TARGET ] && \
89 grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \
90 grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \
91 cmp -s .tmpver.1 .tmpver.2; then
95 mv -f .tmpcompile $TARGET
97 rm -f .tmpver.1 .tmpver.2