5 # If compile.h exists already and we don't own autoconf.h
6 # (i.e. we're not the same user who did make *config), don't
8 # So "sudo make install" won't change the "compiled by <user>"
9 # do "compiled by root"
11 if [ -r $TARGET -a ! -O palacios/include/autoconf.h ]; then
12 echo " SKIPPED $TARGET"
19 if [ -r .version ]; then
20 VERSION=`cat .version`
27 UTS_VERSION="#$VERSION"
29 #if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
30 #if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
31 UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
33 # Truncate to maximum length
36 UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
38 # Generate a temporary compile.h
40 ( echo /\* This file is auto generated, version $VERSION \*/
41 if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
43 echo \#define UTS_MACHINE \"$ARCH\"
45 echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
47 echo \#define LWK_COMPILE_TIME \"`LC_ALL=C LANG=C date +%T`\"
48 echo \#define LWK_COMPILE_BY \"`whoami`\"
49 echo \#define LWK_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
51 if [ -x /bin/dnsdomainname ]; then
52 echo \#define LWK_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\"
53 elif [ -x /bin/domainname ]; then
54 echo \#define LWK_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\"
56 echo \#define LWK_COMPILE_DOMAIN
59 echo \#define LWK_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
62 # Only replace the real compile.h if the new one is different,
63 # in order to preserve the timestamp and avoid unnecessary
65 # We don't consider the file changed if only the date/time changed.
66 # A kernel config change will increase the generation number, thus
67 # causing compile.h to be updated (including date/time) due to the
68 # changed comment in the
71 if [ -r $TARGET ] && \
72 grep -v 'UTS_VERSION\|LWK_COMPILE_TIME' $TARGET > .tmpver.1 && \
73 grep -v 'UTS_VERSION\|LWK_COMPILE_TIME' .tmpcompile > .tmpver.2 && \
74 cmp -s .tmpver.1 .tmpver.2; then
78 mv -f .tmpcompile $TARGET
80 rm -f .tmpver.1 .tmpver.2