in reply to Re: Makefile.PL: Howto make OS dependent modules
in thread Makefile.PL: Howto make OS dependent modules

Thank you for you hint with Devel::AssertOS.

I looked into it, but I´m afraid it does not quite serve my purpose.

As I understand it dies when the underlying OS is not the intended one, but I covered that aspect already.

What I need is, that by saying something like:
perl Makefile.PL # Maybe some option here? os=all|Linux|AIX|RHEL|Suse make # To get everything or things covered with option # And if option is not possible: make Linux # To get Base plus all Linux stuff make RHEL # To get Base plus Linux.pm plus RHEL.pm make Suse # To get Base plus Linux.pm plus Suse.pm make AIX # To get Base plus AIX.pm make test # To test all related tests make install # To install only selected modules

That way only the selected modules get installed out of my manifest.

As I see it, I must teach somehow Makefile.PL either to select the appropriate things I need when I call it (with options) or to make Makefile.Pl make additional targets (like AIX, Linux ...).

I saw the CONFIGURE attribute in the documentation of ExtUtils::MakeMaker which looked very promising to accomplish this:

CONFIGURE CODE reference. The subroutine should return a hash reference. The hash may contain further attributes, e.g. {LIBS => ...}, that have to be determined by some evaluation method.

I also found a small article in CPAN how to create own make targets:

sub MY::postamble { return <<'MAKE_FRAG'; $(MYEXTLIB): sdbm/Makefile cd sdbm && $(MAKE) all MAKE_FRAG }

But all that I find extremely vague and unintuitive...

A good example could help :-)

Replies are listed 'Best First'.
Re^3: Makefile.PL: Howto make OS dependent modules
by Anonymous Monk on Jan 08, 2015 at 09:50 UTC

    I looked into it, but I´m afraid it does not quite serve my purpose.

    Look up :) AssertOS is in the CheckOS distribution ... Devel::CheckOS - check what OS we're running on ... this mean it doesn't die

    So then

    package System::Scaller; use Module::Load qw/ load /; use Devel::CheckOS qw/ os_is /; my @targets = ( [qw/ AIX System::Scanner::AIX /], [qw/ RHEL System::Scanner::Linux::RHEL /], [qw/ SUSE System::Scanner::Linux::SUSE /], ); for my $targ ( @targets ){ my( $name, $module ) = @_; if( os_is( $name ) ){ load $module; @System::Scaller::ISA = $module; last; } } 1;

    You install everything, you only load the module thats appropriate for the platform

    Hacking Makefiles and only packing certain files is PITA, avoid it