3
# Cute little builder for perl
4
# Total waste of development time...
6
# This will build all the object files and then the archive .a file
7
# requires GCC, GNU make and a sense of humour.
15
print "Scanning for source files...\n";
16
foreach my $filename (glob "*.c") {
19
print "Source files to build: $count\nBuilding...\n";
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 "|, "; }
30
my $tleft = ($count - $i) / $rate;
32
my $tmin = ($tleft/60)%60;
33
my $thour = ($tleft/3600)%60;
34
printf("%2d:%02d:%02d left, ", $thour, $tmin, $tsec);
36
my $cnt = ($i/$count)*30.0;
39
for (; $x < $cnt; $x++) { print "#"; }
40
for (; $x < 30; $x++) { print " "; }
43
$tmp =~ s/\.c/".o"/ge;
44
if (open(SRC, "<$tmp")) {
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: $!";
55
if (time != $starttime) {
56
my $delay = time - $starttime;
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";
b'\\ No newline at end of file'