I'm looking to get a makefile working inside a perl scripts.
Long explanation why, but it concerns mas quanitities of lines generated
froma a lot perl hashs
I have to generate a large amount of strings as input to a program,12+
permutations.
I would like to not to have to generate the make file and execute it
seperately.
My basic steps will be
1. create permutations with perl program, as a list of perl hashes.
2. convert hashs to strings with perl program.
Strings are command lines options for external script
3. use make to utilize the --max-load feature.
These 12k+ jobs should be < 2 second each and use virtually no memory.
Make should run them much faster then perl multithread of using LSF to
distribute across the network.
Espically LSF can take a minute to get it logged into it's system.
Here it is in bash
#!/bin/bash
printf "In bash\n";
DO_THIS=/bin/ls
make -f - all<<!
all :
@echo "In the make section"
@echo "DO_THIS = ${DO_THIS}"
!
Here's what I've tried in perl with no success
print "this is perl\n";
$make = <<MAKE;
all : do_this do_that
do_this:
[EMAIL PROTECTED] 'this'
do_that:
[EMAIL PROTECTED] 'that'
MAKE
open OUT , ">z";
print OUT "$make\n";
close OUT;
print "$make\n";
$_ = `make -j --max-load 1.0 -f - all <<$make`;
$st = $?>>8;
print "In perl again with status = $st , ret = '$_'\n";
When I execute perl z.pl
this is perl
all : do_this do_that
do_this:
@echo 'this'
do_that:
@echo 'that'
sh: -c: line 1: syntax error near unexpected token `newline'
sh: -c: line 1: `make -j --max-load 1.0 -f - all <<'
In perl again with status = 2 , ret = ''
When I execute make -f z I get:
make -f z
this
That
So I know the make file is gettting written correctly.
this is perl
all : do_this do_that
do_this:
@echo "doing_this"
do_that:
@echo "doing_doing_that"
make: *** No rule to make target `all'. Stop.
In perl again with status = 2 , ret = ''
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make