nw_ver.awk 668 B

12345678910111213141516171819202122232425
  1. BEGIN {
  2. # fetch APR version numbers from input file and writes them to STDOUT
  3. while ((getline < ARGV[1]) > 0) {
  4. if (match ($0, /^#define APR_MAJOR_VERSION/)) {
  5. ver_major = $3;
  6. }
  7. else if (match ($0, /^#define APR_MINOR_VERSION/)) {
  8. ver_minor = $3;
  9. }
  10. else if (match ($0, /^#define APR_PATCH_VERSION/)) {
  11. ver_str_patch = $3;
  12. if (match (ver_str_patch, /[0-9][0-9]*/)) {
  13. ver_patch = substr(ver_str_patch, RSTART, RLENGTH);
  14. }
  15. }
  16. }
  17. ver = ver_major "," ver_minor "," ver_patch;
  18. ver_str = ver_major "." ver_minor "." ver_str_patch;
  19. print "VERSION = " ver "";
  20. print "VERSION_STR = " ver_str "";
  21. }