home *** CD-ROM | disk | FTP | other *** search
- # Augment the installation number in the version string.
- # Copyright (C) 1990 Free Software Foundation, Inc.
- # Francois Pinard <pinard@iro.umontreal.ca>, March 1990.
-
-
- # PURPOSE OF THIS SCRIPT.
- #
- # The script reads its input and copies it verbatim, except for one line
- # line which, usually, looks like:
- #
- # #define VERSION "I.J.K"
- #
- # where I, J and K are decimal numbers. The third number will have
- # its value bumped up by one before the copy. This special line can
- # also look like:
- #
- # #define VERSION "I.J"
- # #define VERSION "I"
- # #define VERSION ""
- #
- # Missing numbers, if any, are assumed to have the value zero, before
- # the bumping. After the bumping, all three numbers will show.
- #
- #
- # MORE ABOUT THE VERSION STRING.
- #
- # The version is a string containing three numbers separated by two
- # periods. The first number indicates the major revision, the second
- # number indicates the minor revision, and the third number indicates
- # the installation number. The first two numbers pertain to the
- # distributor, while the third pertains to the local installator.
- # This third number usually counts the number of times the package has
- # been locally re-installed to be made accessible to the users.
- #
- # Interim modifications to a package which does not lead to a user
- # installation are considered experimental and, then, not worth a
- # change in the installation number. It is mostly when a package is
- # made available to users that some feedback is expected, so the
- # installation number changes should be delayed until then.
- #
- #
- # INTERACTION WITH THE MAKEFILE.
- #
- # A nice way to use this is to keep some `version.c' file in the
- # project containing such a #define, and to modify the install goal in
- # the Makefile. Suppose the install goal was:
- #
- # install: $(PROGRAMS)
- # $(INSTALL) $(PROGRAMS) $(BINDIR)
- #
- # Then, modify it so it looks like this:
- #
- # install: $(PROGRAMS)
- # $(INSTALL) $(PROGRAMS) $(BINDIR)
- # gawk -f version.awk version.c >newversion.c
- # @mv version.c version.c~
- # @mv newversion.c version.c
- #
- # Given this provision, at each `make install' or `make -k install',
- # the local installation number will be bumped after the install,
- # but only if it was successful. So, all local experimentation will
- # use this new version number, until another install is done. Right
- # *after* the next install, the installation number will be bumped
- # again, and so on.
-
-
- # Look for the #define VERSION line.
-
- /^[ \t]*#[ \t]*define[ \t][ \t]*VERSION[ \t][ \t]*"[^"]*"/ {
-
- # Split the version into numbers.
-
- match ($0, /"[^"]*"/)
- version = substr ($0, RSTART + 1, RLENGTH - 2)
- number = split (version, numbers, ".")
-
- # Insure three numbers, defaulting to 0.0.0; then bump the third up.
-
- if (number < 1) {
- numbers[1] = "0"
- }
- if (number < 2) {
- numbers[2] = "0"
- }
- if (number < 3) {
- numbers[3] = "0"
- }
- numbers[3]++
-
- # Replace the new version numbers in the #define and write it out.
-
- sub (/"[^"]*"/, "\"" numbers[1] "." numbers[2] "." numbers[3] "\"", $0)
- print
- next
- }
-
-
- # Copy all other lines without change.
-
- //
-