X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=scripts%2Fmkcompile_h;h=6a12dd9f1181c396f30c1e4c7377e8e0d63402cd;hb=b8fd47aefa5f13df1edacbc7e68d9874635109e5;hp=8d118d1819508cf9a14d252086a89108cb8f4e0d;hpb=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2;p=safe%2Fjmp%2Flinux-2.6 diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 8d118d1..6a12dd9 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -1,7 +1,10 @@ TARGET=$1 ARCH=$2 SMP=$3 -CC=$4 +PREEMPT=$4 +CC=$5 + +vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } # If compile.h exists already and we don't own autoconf.h # (i.e. we're not the same user who did make *config), don't @@ -10,24 +13,39 @@ CC=$4 # do "compiled by root" if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then - echo " SKIPPED $TARGET" + vecho " SKIPPED $TARGET" exit 0 fi # Do not expand names set -f -if [ -r .version ]; then - VERSION=`cat .version` +# Fix the language to get consistent output +LC_ALL=C +export LC_ALL + +if [ -z "$KBUILD_BUILD_VERSION" ]; then + if [ -r .version ]; then + VERSION=`cat .version` + else + VERSION=0 + echo 0 > .version + fi else - VERSION=0 - echo 0 > .version + VERSION=$KBUILD_BUILD_VERSION fi +if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then + TIMESTAMP=`date` +else + TIMESTAMP=$KBUILD_BUILD_TIMESTAMP +fi UTS_VERSION="#$VERSION" -if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi -UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`" +CONFIG_FLAGS="" +if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi +if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi +UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" # Truncate to maximum length @@ -37,12 +55,13 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" # Generate a temporary compile.h ( echo /\* This file is auto generated, version $VERSION \*/ - + if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi + echo \#define UTS_MACHINE \"$ARCH\" echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILE_TIME \"`LC_ALL=C LANG=C date +%T`\" + echo \#define LINUX_COMPILE_TIME \"`date +%T`\" echo \#define LINUX_COMPILE_BY \"`whoami`\" echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" @@ -72,7 +91,7 @@ if [ -r $TARGET ] && \ cmp -s .tmpver.1 .tmpver.2; then rm -f .tmpcompile else - echo " UPD $TARGET" + vecho " UPD $TARGET" mv -f .tmpcompile $TARGET fi rm -f .tmpver.1 .tmpver.2