| 1 | ############################################################################# | ||
| 2 | ## Name: MakeMaker.pm | ||
| 3 | ## Purpose: MakeMaker class for HPLOO classes. | ||
| 4 | ## Author: Graciliano M. P. | ||
| 5 | ## Modified by: | ||
| 6 | ## Created: 30/10/2004 | ||
| 7 | ## RCS-ID: | ||
| 8 | ## Copyright: (c) 2004 Graciliano M. P. | ||
| 9 | ## Licence: This program is free software; you can redistribute it and/or | ||
| 10 | ## modify it under the same terms as Perl itself | ||
| 11 | ############################################################################# | ||
| 12 | |||
| 13 | package Class::HPLOO::MakeMaker ; | ||
| 14 | |||
| 15 | use 5.006 ; | ||
| 16 | use strict qw(vars) ; | ||
| 17 | |||
| 18 | use vars qw($VERSION $SYNTAX @ISA) ; | ||
| 19 | |||
| 20 | $VERSION = '0.1'; | ||
| 21 | |||
| 22 | ############ | ||
| 23 | # EXPORTER # | ||
| 24 | ############ | ||
| 25 | |||
| 26 | require Exporter; | ||
| 27 | @ISA = qw(Exporter UNIVERSAL) ; | ||
| 28 | our @EXPORT = qw(WriteMakefile) ; | ||
| 29 | our @EXPORT_OK = @EXPORT ; | ||
| 30 | |||
| 31 | ########### | ||
| 32 | # REQUIRE # | ||
| 33 | ########### | ||
| 34 | |||
| 35 | use Class::HPLOO::Build ; | ||
| 36 | |||
| 37 | use ExtUtils::MakeMaker () ; | ||
| 38 | |||
| 39 | eval(' use Inline::MakeMaker () ;') ; | ||
| 40 | my $USE_INLINE = $@ ? 0 : 1 ; | ||
| 41 | |||
| 42 | ################# | ||
| 43 | # WRITEMAKEFILE # | ||
| 44 | ################# | ||
| 45 | |||
| 46 | sub WriteMakefile { | ||
| 47 | |||
| 48 | if ( $USE_INLINE ) { | ||
| 49 | my ( %args ) = @_ ; | ||
| 50 | |||
| 51 | my $ver = -s $args{VERSION_FROM} ? ExtUtils::MM_Unix::parse_version('MM' , $args{VERSION_FROM} ) : undef ; | ||
| 52 | |||
| 53 | Class::HPLOO::Build::build([$ver],"-r") ; | ||
| 54 | |||
| 55 | $args{clean} ||= { FILES=>q[_Inline *.inl] } ; | ||
| 56 | |||
| 57 | Inline::MakeMaker::WriteMakefile(%args) ; | ||
| 58 | |||
| 59 | if ( $args{VERSION_FROM} =~ /(.*?)(\w+)\.pm$/ ) { | ||
| 60 | my ($path,$name) = ($1,$2) ; | ||
| 61 | open (MKFL,"Makefile") ; | ||
| 62 | my $data = join '' , <MKFL> ; | ||
| 63 | close (MKFL) ; | ||
| 64 | |||
| 65 | $data =~ s/(\npure_all :: )$name(.inl)/${1}$path$name$2/si ; | ||
| 66 | |||
| 67 | open (MKFL,">Makefile") ; | ||
| 68 | print MKFL $data ; | ||
| 69 | close (MKFL) ; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | else { | ||
| 73 | Class::HPLOO::Build::build("-r") ; | ||
| 74 | ExtUtils::MakeMaker::WriteMakefile(@_) ; | ||
| 75 | } | ||
| 76 | |||
| 77 | } | ||
| 78 | |||
| 79 | ####### | ||
| 80 | # END # | ||
| 81 | ####### | ||
| 82 | |||
| 83 | 1; | ||
| 84 | |||
| 85 |