Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

MakeMaker to make Makefile in subdir

by scain (Curate)
on Sep 23, 2003 at 20:51 UTC ( [id://293675]=perlquestion: print w/replies, xml ) Need Help??

scain has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,

So, how many times can I put the word 'make' in a title?

OK, here is the question, I have a big application that is composed of several smaller components developed by separate but related groups plus utility code, glue code, examples and documentation. Because these smaller components have Makefile.PLs of their own, I want to write a super Makefile.PL that will know about the Makefile.PL files that are in subdirectories. While I have read man make, perldoc ExtUtils::MakeMaker, perldoc ExtUtils::MakeMaker::Tutorial and info make, it is still not clear to me how to do this. Can anyone shed light on this?

Scott
Project coordinator of the Generic Model Organism Database Project

Replies are listed 'Best First'.
Re: MakeMaker to make Makefile in subdir
by PodMaster (Abbot) on Sep 23, 2003 at 22:33 UTC
    Its mostly magic. This has been discussed before, but I can't be bothered to super search it, so i'm just gonna give you a few examples of distributions that do this

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Great. I checked out libwin32-0.191 and it does seem to magically cascade to Makefile.PL's. But a little experimentation showed the trick is to ensure that each makefile is only one directory below the next. So even though h2xs builds a tree, the next set of modules only want the leaf directory of that tree, and in fact build totally correctly regardless as to what that leaf directory is called. (the latter fact is not shown below. Anyways thanks for the heads up on how to figure this out, I hope its as useful to scain as it has been to me.

      D:\perl\Recursive\L1>dir Volume in drive D is New Volume Volume Serial Number is 0842-2896 Directory of D:\perl\Recursive\L1 2003/09/24 11:12 <DIR> . 2003/09/24 11:12 <DIR> .. 2003/09/24 00:12 168 Changes 2003/09/24 00:12 1,214 L1.pm 2003/09/24 11:12 <DIR> L2 2003/09/24 10:00 498 Makefile.PL 2003/09/24 00:12 56 MANIFEST 2003/09/24 00:12 1,112 README 2003/09/24 11:12 <DIR> Recurse 2003/09/24 11:12 <DIR> Recursive 2003/09/24 00:12 487 test.pl 6 File(s) 3,535 bytes 5 Dir(s) 6,143,295,488 bytes free D:\perl\Recursive\L1>tree D:\perl\Recursive Folder PATH listing for volume New Volume Volume serial number is 0006FE80 0842:2896 D:\PERL\RECURSIVE +---L1 +---L2 +---Recurse +---Recursive +---Recursive D:\perl\Recursive\L1>perl makefile.pl Checking if your kit is complete... Looks good Checking if your kit is complete... Looks good Writing Makefile for Recursive::L2 Checking if your kit is complete... Looks good Writing Makefile for Second::Recurse Checking if your kit is complete... Looks good Checking if your kit is complete... Looks good Writing Makefile for Recursive::Recursive::Recursive Writing Makefile for Recursive::Recursive Writing Makefile for Recursive::L1 D:\perl\Recursive\L1>nmake Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cp L1.pm blib\lib\Recursive\L1.pm cp L2.pm ..\blib\lib\Recursive\L2.pm cp Recurse.pm ..\blib\lib\Second\Recurse.pm cp Recursive.pm ..\blib\lib\Recursive\Recursive.pm cp Recursive.pm ..\..\blib\lib\Recursive\Recursive\Recursive.pm D:\perl\Recursive\L1>tree D:\perl\Recursive Folder PATH listing for volume New Volume Volume serial number is 0006FE80 0842:2896 D:\PERL\RECURSIVE +---L1 +---blib | +---arch | | +---auto | | +---Recursive | | | +---L1 | | | +---L2 | | | +---Recursive | | | +---Recursive | | +---Second | | +---Recurse | +---lib | +---auto | | +---Recursive | | | +---L1 | | | +---L2 | | | +---Recursive | | | +---Recursive | | +---Second | | +---Recurse | +---Recursive | | +---Recursive | +---Second +---L2 +---Recurse +---Recursive +---Recursive D:\perl\Recursive\L1>

      Cheers mate.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi


        Thanks demerphq and PodMaster; this is at least getting me close. There is some magic here. My directory structure looks like this:
        gmod/ src/ component1/ component2/ component3/
        All I had to do was put a simple Makefile.PL in the src/ directory and when the main Makefile.PL was executed in the gmod/ directory, it saw the one in src/, which in turn saw the ones in component directories.

        This probably would have worked flawlessly if the items in the component directories were only Perl modules, but they are more complicated than that, and have in their Makefile.PLs custom overrides to the install target (so that items can be installed under /usr/local/apache, for instance). I may be able to get around that by overriding the install target in the main Makefile.PL, but that is unattractive for at least one reason: it makes the main Makefile.PL more fragile (if the author of component1 changes his Makefile.PL and doesn't tell me, it won't work as expected).

        Thanks again,
        Scott
        Project coordinator of the Generic Model Organism Database Project

Re: MakeMaker to make Makefile in subdir
by demerphq (Chancellor) on Sep 23, 2003 at 23:09 UTC

    I dont think there is a way "standard" way to do this if you mean recursively generating the makefiles from Makefile.PL's and then the appropriate action as a cascade. I can think of a few (horrible) ways to do this by hand but... :-(

    The solution ive come with at work is to merge components into one extremely large distro, with some twenty or so modules controlled from one Makefile. Its relatively easy to do, but a touch of a pain to admin. Anway, if you do find a way, please let me know. I do recommend of all places perlXStut as it has something in there involving MYEXTLIB but it looks like that is oriented towards building C libraries and not a perl distro.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://293675]
Approved by sgifford
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found