From: Gurusamy Sarathy Date: Fri, 3 Dec 1999 06:52:50 +0000 (+0000) Subject: support -a switch to append bytecode to an existing file and make X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a07043ec8c6b8db003369856eadf14ccd8d179cc;p=p5sagit%2Fp5-mst-13.2.git support -a switch to append bytecode to an existing file and make perlcc use it (from Tom Hughes ) p4raw-id: //depot/perl@4631 --- diff --git a/ext/B/B/Bytecode.pm b/ext/B/B/Bytecode.pm index 8764a0d..c085071 100644 --- a/ext/B/B/Bytecode.pm +++ b/ext/B/B/Bytecode.pm @@ -705,6 +705,10 @@ sub compile { $arg ||= shift @options; open(OUT, ">$arg") or return "$arg: $!\n"; binmode OUT; + } elsif ($opt eq "a") { + $arg ||= shift @options; + open(OUT, ">>$arg") or return "$arg: $!\n"; + binmode OUT; } elsif ($opt eq "D") { $arg ||= shift @options; foreach $arg (split(//, $arg)) { @@ -814,6 +818,10 @@ extra arguments, it saves the main program. Output to filename instead of STDOUT. +=item B<-afilename> + +Append output to filename. + =item B<--> Force end of options. diff --git a/utils/perlcc.PL b/utils/perlcc.PL index a585580..a8c6ab4 100644 --- a/utils/perlcc.PL +++ b/utils/perlcc.PL @@ -253,6 +253,7 @@ sub _createCode { my ( $backend, $generated_file, $file, $final_output ) = @_; my $return; + my $output_switch = "o"; local($") = " -I"; @@ -264,6 +265,8 @@ sub _createCode print GENFILE "#!$^X\n" if @_ == 3; print GENFILE "use ByteLoader $ByteLoader::VERSION;\n"; + + $output_switch ="a"; } close(GENFILE); @@ -278,7 +281,7 @@ sub _createCode chomp $stash; _print( "$^X -I@INC -MO=$backend,$stash $file\n", 36); - $return = _run("$^X -I@INC -MO=$backend,$stash,-o$generated_file $file", 9); + $return = _run("$^X -I@INC -MO=$backend,$stash,-$output_switch$generated_file $file", 9); $return; } else # compiling a shared object @@ -286,7 +289,7 @@ sub _createCode _print( "$^X -I@INC -MO=$backend,-m$final_output $file\n", 36); $return = - _run("$^X -I@INC -MO=$backend,-m$final_output,-o$generated_file $file ", 9); + _run("$^X -I@INC -MO=$backend,-m$final_output,-$output_switch$generated_file $file ", 9); $return; } }