Created
November 9, 2009 08:10
-
-
Save snarkyboojum/229775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read Makefile.in, edit, write Makefile | |
my $maketext = slurp( 'Makefile.in' ); | |
$maketext .= subst( .key, .value ) for | |
'Makefile.in' => 'Makefile', | |
'To be read' => 'Written', | |
'replaces <TOKENS>' => 'defined these', | |
# Maintainer note: keep the following in sync with pod#VARIABLES below | |
'<PERL6>' => $perl6, | |
'<PERL6LIB>' => $perl6lib, | |
'<PERL6BIN>' => $perl6bin, | |
'<RAKUDO_DIR>' => $rakudo_dir; | |
squirt( 'Makefile', $maketext ); | |
# Job done. | |
.say for | |
'', | |
q[Makefile is ready, and you can run 'make'.]; | |
# The opposite of slurp | |
sub squirt( Str $filename, Str $text ) { | |
my $handle = open( $filename, :w ) | |
or die $!; | |
$handle.print: $text; | |
$handle.close; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment