Skip to content

Commit

Permalink
[Configure] experimental timing option for Makefile
Browse files Browse the repository at this point in the history
Inspired by sorear++
  • Loading branch information
moritz committed May 8, 2010
1 parent b52bbee commit 7247277
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Configure.pl
Expand Up @@ -9,7 +9,7 @@

MAIN: {
my %options;
GetOptions(\%options, 'help!', 'parrot-config=s',
GetOptions(\%options, 'help!', 'parrot-config=s', 'makefile-timing!',
'gen-parrot!', 'gen-parrot-prefix=s', 'gen-parrot-option=s@');

# Print help if it's requested
Expand Down Expand Up @@ -81,7 +81,7 @@ END
verify_parrot(%config);

# Create the Makefile using the information we just got
create_makefile(%config);
create_makefile($options{'makefile-timing'}, %config);
my $make = $config{'make'};

{
Expand Down Expand Up @@ -159,7 +159,7 @@ END

# Generate a Makefile from a configuration
sub create_makefile {
my %config = @_;
my ($makefile_timing, %config) = @_;

my $maketext = slurp( 'build/Makefile.in' );

Expand All @@ -171,6 +171,10 @@ sub create_makefile {
$maketext =~ s{http:\S+}{ do {my $t = $&; $t =~ s'\\'/'g; $t} }eg;
}

if ($makefile_timing) {
$maketext =~ s{(?<!\\\n)^\t(?!\s*-?cd)(?=[^\n]*\S)}{\ttime }mg;
}

my $outfile = 'Makefile';
print "\nCreating $outfile ...\n";
open(my $MAKEOUT, '>', $outfile) ||
Expand Down Expand Up @@ -209,6 +213,8 @@ sub print_help {
Set parrot config option when using --gen-parrot
--parrot-config=(config)
Use configuration information from config
Experimental developer's options:
--makefile-timing Insert 'time' command all over in the Makefile
END

return;
Expand Down

0 comments on commit 7247277

Please sign in to comment.