Overrides to allow Objective-C

[email protected] (Sherm Pendley)
Newsgroups perl.makemaker
Message-ID <[email protected]>
Attached is my Makefile.PL, with a few MY::* methods to allow the use of
Objective-C.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Makefile.PL (text/plain, 1.2 KB)
use ExtUtils::MakeMaker;

WriteMakefile(
    NAME              => 'Mac::BridgeSupport',
    VERSION_FROM      => 'lib/Mac/BridgeSupport.pm',
    ABSTRACT_FROM     => 'lib/Mac/BridgeSupport.pm',
    AUTHOR            => 'Sherm Pendley <[email protected]@gmail.com>',
    LIBS              => ['-lobjc'],
    INC               => '-I.',
    XS                => { 'BridgeSupport.xs' => 'BridgeSupport.m' },

    OBJECT            => '$(O_FILES)',
);

# Add some required machinery to support .m files
package MY;
sub c_o {
    my $inherited = shift->SUPER::c_o(@_);
    $inherited .= <<'EOMESS';
.m$(OBJ_EXT):
	$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.m

EOMESS
    $inherited;
}

sub xs_c {
    my $inherited = shift->SUPER::xs_c(@_);
    $inherited .= <<'EOMESS';
.xs.m:
	$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsm && $(MV) $*.xsm $*.m

EOMESS
    $inherited;
}

sub init_dirscan {
    my $self = shift;
    $self->SUPER::init_dirscan;
    
    foreach my $name ($self->lsdir($self->curdir)) {
        next unless $name =~ /\.m$/;
        push @{$self->{'C'}}, $name;
        $name =~ s/\.m$/$self->{'OBJ_EXT'}/;
        push @{$self->{'O_FILES'}}, $name;
    }
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.