Upstream tarball 9962
[amule.git] / src / libs / ec / cpp / gen_ECVersion
blobb54ddfe8ab094312e82eb15bc5bd610de01b8c6f
1 #!/bin/sh
3 # This file is part of the aMule project.
5 # Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 # This program generates a unique identifier for EC version checking
25 # Invocation: gen_ECVersion <top_srcdir>
27 # Used by the makefile to generate src/ECVersion.h
29 top_srcdir=$1
31 echo -n "Generating ECVersion.h... "
33 final_hash="`cat $top_srcdir/src/libs/ec/cpp/ECCodes.h | ./mkFileSum`"
35 cat > ECVersion.h.new <<EOT
36 /* Automatically generated file. Do not edit! */
38 #ifndef ECVERSION_H
39 #define ECVERSION_H
41 #ifdef HAVE_CONFIG_H
42 #include "config.h"
43 #endif
45 #ifdef SVNDATE
46 #define EC_VERSION_ID "$final_hash"
47 #endif
49 #endif /* ECVERSION_H */
50 EOT
52 if test -f ECVersion.h; then
53 if diff ECVersion.h ECVersion.h.new >/dev/null 2>&1; then
54 rm -f ECVersion.h.new
55 echo "unchanged."
56 else
57 mv ECVersion.h.new ECVersion.h
58 echo "updated."
60 else
61 mv ECVersion.h.new ECVersion.h
62 echo "created."