2006-08-26 11:35:28 +00:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
######################################################################
|
|
|
|
#
|
2011-01-01 23:21:19 +00:00
|
|
|
# Copyright 2005-2011 by Wilson Snyder. Verilator is free software; you
|
2009-05-04 21:07:57 +00:00
|
|
|
# can redistribute it and/or modify it under the terms of either the GNU
|
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
# Version 2.0.
|
2008-06-10 01:25:10 +00:00
|
|
|
#
|
2006-08-26 11:35:28 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2008-06-10 01:25:10 +00:00
|
|
|
#
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
|
|
|
|
# DESCRIPTION: Query's subversion to get version number
|
|
|
|
|
|
|
|
my $dir = $ARGV[0]; defined $dir or die "%Error: No directory argument,";
|
|
|
|
chdir $dir;
|
|
|
|
|
2009-04-23 13:11:40 +00:00
|
|
|
my $rev = 'UNKNOWN_REV';
|
2009-10-21 13:25:52 +00:00
|
|
|
my $data = `git describe`;
|
|
|
|
if ($data =~ /(verilator.*)/i) {
|
2009-04-23 13:11:40 +00:00
|
|
|
$rev = $1;
|
2006-08-26 11:35:28 +00:00
|
|
|
}
|
2008-06-10 01:25:10 +00:00
|
|
|
|
|
|
|
$data = `git status`;
|
2009-10-27 00:26:28 +00:00
|
|
|
if ($data =~ /Changed but not updated/i
|
|
|
|
|| $data =~ /Changes to be committed/i) {
|
2008-06-10 01:25:10 +00:00
|
|
|
$rev .= " (mod)";
|
|
|
|
}
|
|
|
|
|
|
|
|
print "static const char* DTVERSION_rev = \"$rev\";\n";
|
2009-04-23 13:11:40 +00:00
|
|
|
|
|
|
|
# Die after the print, so at least the header has good contents
|
|
|
|
$rev =~ /UNKNOWN/ and die "%Error: No git revision found,";
|