svnversion . . littler, , , , :
#!/bin/sh -e
svnversion() {
svnrevision=`LC_ALL=C svn info | awk '/^Revision:/ {print $2}'`
svndate=`LC_ALL=C svn info | awk '/^Last Changed Date:/ {print $4,$5}'`
now=`date`
cat <<EOF > svnversion.h
#include <stdlib.h>
static const char* svnrevision = "$svnrevision";
static const char* svndate = "$svndate";
static const char* compiletime = __TIME__;
static const char* compiledate = __DATE__;
EOF
}
if [ "$#" -ge 0 ]; then
if [ "$1" = "--svnversion" ]; then
svnversion
exit
fi
fi
test -f svnversion.h || svnversion
Makefile,
void showVersionAndExit() {
printf("%s ('%s') version %s\n\tsvn revision %s as of %s\n\t"
"built at %s on %s\n",
binaryName, programName, VERSION,
svnrevision, svndate, compiletime, compiledate);
/* more code below ... */
R, DESCRIPTION, .
, , , :), , svnversion ( ), , DESCRIPTION. , , , , .