libversion.sh 478 B

12345678910111213
  1. toupper(){
  2. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  3. }
  4. name=lib$1
  5. ucname=$(toupper ${name})
  6. file=$2
  7. eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  8. eval ${ucname}_VERSION=\$${ucname}_VERSION_MAJOR.\$${ucname}_VERSION_MINOR.\$${ucname}_VERSION_MICRO
  9. eval echo "${name}_VERSION=\$${ucname}_VERSION"
  10. eval echo "${name}_VERSION_MAJOR=\$${ucname}_VERSION_MAJOR"
  11. eval echo "${name}_VERSION_MINOR=\$${ucname}_VERSION_MINOR"