* configure.in, configure: re-introduced .version
[fw/sdcc] / configure_vc.awk
1 #!/usr/bin/awk
2
3 # configure_vc.awk - Genarate sdcc_vc.h using sdcc_vc_in.h as template
4 #                    and insert the version number definitions from .version
5 #
6 # Written By - Borut Razem borut.razem@siol.net
7 #
8 # This file is part of sdcc.
9 #
10 # This program is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by the
12 # Free Software Foundation; either version 2, or (at your option) any
13 # later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 BEGIN {
25   # get the values from .version
26   FS=".";
27   getline <".version";
28   version_high = $1;
29   version_lo = $2;
30   version_patch = $3;
31
32   print "/*"
33   print " * sdcc_vc.h"
34   print " * Generated automatically by configure_vc.awk, DO NOT edit!"
35   print " * To make changes to sdcc_vc.h edit sdcc_vc_in.h instead."
36   print " */" 
37   print "" 
38 }
39
40 /^#undef SDCC_VERSION_HI$/ {
41   print("#define SDCC_VERSION_HI " version_high);
42   next
43 }
44
45 /^#undef SDCC_VERSION_LO$/ {
46   print("#define SDCC_VERSION_LO " version_lo);
47   next
48 }
49
50 /^#undef SDCC_VERSION_P$/ {
51   print("#define SDCC_VERSION_P " version_patch);
52   next
53 }
54
55 /^#undef SDCC_VERSION_STR$/ {
56   print("#define SDCC_VERSION_STR " "\"" version_high "." version_lo "." version_patch "\"");
57   next
58 }
59
60 {
61   print
62 }