comparison libtommath/pretty.build @ 293:9d110777f345 contrib-blacklist

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