libversion.sh 594 B

1234567891011121314151617
  1. toupper(){
  2. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  3. }
  4. name=lib$1
  5. ucname=$(toupper ${name})
  6. file=$2
  7. file2=$3
  8. eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  9. if [ -f "$file2" ]; then
  10. eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file2")
  11. fi
  12. eval ${ucname}_VERSION=\$${ucname}_VERSION_MAJOR.\$${ucname}_VERSION_MINOR.\$${ucname}_VERSION_MICRO
  13. eval echo "${name}_VERSION=\$${ucname}_VERSION"
  14. eval echo "${name}_VERSION_MAJOR=\$${ucname}_VERSION_MAJOR"
  15. eval echo "${name}_VERSION_MINOR=\$${ucname}_VERSION_MINOR"