annotate pretty.build @ 152:97a078d6fbfc libtommath

remove unused files
author Matt Johnston <matt@ucc.asn.au>
date Mon, 20 Dec 2004 14:27:07 +0000
parents d29b64170cf0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
142
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #!/bin/perl -w
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 #
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 # Cute little builder for perl
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 # Total waste of development time...
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 #
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 # This will build all the object files and then the archive .a file
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 # requires GCC, GNU make and a sense of humour.
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 #
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 # Tom St Denis
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 use strict;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 my $count = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 my $starttime = time;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 my $rate = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 print "Scanning for source files...\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 foreach my $filename (glob "*.c") {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 ++$count;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 print "Source files to build: $count\nBuilding...\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 my $i = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 my $lines = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 my $filesbuilt = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 foreach my $filename (glob "*.c") {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 printf("Building %3.2f%%, ", (++$i/$count)*100.0);
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 if ($i % 4 == 0) { print "/, "; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26 if ($i % 4 == 1) { print "-, "; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 if ($i % 4 == 2) { print "\\, "; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 if ($i % 4 == 3) { print "|, "; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 if ($rate > 0) {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 my $tleft = ($count - $i) / $rate;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 my $tsec = $tleft%60;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 my $tmin = ($tleft/60)%60;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 my $thour = ($tleft/3600)%60;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 printf("%2d:%02d:%02d left, ", $thour, $tmin, $tsec);
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 my $cnt = ($i/$count)*30.0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 my $x = 0;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 print "[";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 for (; $x < $cnt; $x++) { print "#"; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 for (; $x < 30; $x++) { print " "; }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 print "]\r";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 my $tmp = $filename;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 $tmp =~ s/\.c/".o"/ge;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 if (open(SRC, "<$tmp")) {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 close SRC;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 } else {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 !system("make $tmp > /dev/null 2>/dev/null") or die "\nERROR: Failed to make $tmp!!!\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 ++$lines while (<SRC>);
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 close SRC or die "Error closing $filename after reading: $!";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 ++$filesbuilt;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 # update timer
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 if (time != $starttime) {
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 my $delay = time - $starttime;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 $rate = $i/$delay;
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 }
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 # finish building the library
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 printf("\nFinished building source (%d seconds, %3.2f files per second).\n", time - $starttime, $rate);
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 print "Compiled approximately $filesbuilt files and $lines lines of code.\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 print "Doing final make (building archive...)\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 !system("make > /dev/null 2>/dev/null") or die "\nERROR: Failed to perform last make command!!!\n";
d29b64170cf0 import of libtommath 0.32
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 print "done.\n";