2009年10月20日

Careless you doing "perl Makefile", then you take many error messages.
Your trouble will be solved if the polyglot technology is used.

# Example Makefile
irst_labe: length
X;$Y=Z;
dummy_label: length
        0;
        print "perl world\n";
        $x = <<'END_OF_MAKEFILE='
length:
        echo "make world"

END_OF_MAKEFILE=
actually, this code is works on perl and make command.
$ perl Makefile 
perl world
$ make
echo "make world"
make world

Makefile is processible into Makefile.PL polyglot by perl code shown below.

perl Makefile.PLをperl Makefileと打ち込まんでエラーメッセージを出しちゃうドジっ娘さんは沢山いらっしゃるとおもいます。
そんな悩みを解決すべくperl Makefileと打ち込んでもexec $^X, 'Makefile.PL'を実行してくれるMakefileのsnipetを作りました。

規則名をlabelとして扱わせて、その次にperlの構文のlengthをぶち込み、セミコロン必要な所は何故かGNU makeでX;$Y=Z;が通ったので、それでごまかしてlengthの規則名を定義してmakeで実行させる規則を作りつつ。perlで実行された時にはlengthの規則の定義部分は$xにぶち込まれるようにしてあるという具合です。(説明めんどう

ExtUtils::MakeMakerにパッチあてれば良い感じになりますか?

GNU Make 3.81 で確認済み

thanks to tokuhirom and takesako

Posted by Yappo at 2009年10月20日 14:27 | TrackBack | Perl
Comments
Post a comment









Remember personal info?






コメントを投稿する前に↓の場所にnospamと入力してください。