2 # Output a version.c file that includes information about the current build
3 # Normally a couple of lines of bash would be enough (see openpcd project, original firmware by Harald Welte and Milosch Meriac)
4 # but this will, at least in theory, also work on Windows with our current compile environment.
5 # -- Henryk Plötz <henryk@ploetzli.ch> 2009-09-28
9 # Clear environment locale so that svn will not use localized strings
16 my @compiletime = gmtime();
18 # Strategy one: call svn info and extract last changed revision, call svn status and look for ^M
19 if(open(SVNINFO
, "svn info $main_dir|")) {
21 if (/^Last Changed Rev: (.*)/) {
24 ## last; # Do not abort here, since SVN tends to complain about a Broken pipe
29 if(open(SVNSTATUS
, "svn status $main_dir|")) {
41 # Strategy two: look for .svn/entries. The third line should be "dir", the fourth line should contain
42 # the currently checked out revision, the eleventh line should contain the last changed revision.
44 if(open(ENTRIES
, "$main_dir/.svn/entries")) {
47 last if($i == 3 and !/^dir/);
48 if($i == 11 and /^([0-9]*)/) {
58 $compiletime[5] += 1900;
59 my $ctime = sprintf("%6\$04i-%5\$02i-%4\$02i %3\$02i:%2\$02i:%1\$02i", @compiletime);
60 $svnversion=~ s/(^\s+|\s+$)//g;
63 #include "proxmark3.h"
64 /* Generated file, do not edit */
65 const struct version_information __attribute__((section(".version_information"))) version_information = {
66 VERSION_INFORMATION_MAGIC,