3 # Script to compile a resource file for a DLL if there is a .rc file
4 # for it. The resource source file is supposed to contain a version
5 # info section, that uses the string BUILDNUMBER as the least
6 # significant part of the version numbers. This script replaces that
7 # string with a "build number" before compiling the binary resource
8 # file. The build number is kept between builds in a "stamp" file, and
9 # incremented each time. (If there is no stamp file, build number 0 is
10 # used.) The intention is that only the "official" maintainer of a DLL
11 # keeps such a stamp file, and thus the DLLs he releases have
12 # increasing version number resources, which can be used by an
13 # installer program to decide whether to replace an existing DLL with
16 # This is just my (tml@iki.fi) idea, if somebody comes up with a
17 # better way to generate version number resources, don't hesitate to
20 # The command line arguments are:
21 # $1: the name of the .rc file to check
22 # $2: the name of the resource object file to produce, if the rc file exists
24 # Check if we have a resource file for this DLL.
27 if [ -f $rcfile ]; then
28 # Check if we have a build number stamp file.
29 basename=`basename $rcfile .rc`
30 if [ -f $basename-build.stamp ]; then
31 read number <$basename-build.stamp
33 echo Build number $buildnumber
34 rm -rf $basename-build.stamp
36 echo Using zero as build number
40 m4 -DBUILDNUMBER=$buildnumber <$rcfile >$$.rc &&
41 ${WINDRES-windres} $$.rc $resfile &&