First off, I'm a make/build newbie with only basic experience in the area, so if some of this is obvious I apologize. I have tried to search here prior to asking and have read into MakeMaker and Module::Build documentation.

I have a project made of multiple modules. I'd like them all to be build from the upper most make/build file, but I haven't been able to figure out how to do that.

I've used ExtUtils::ModuleMaker to create the initial project skeleton. I've also checked out h2xs. I've noticed they create the base directory structure differently.

For example, assume I'm working on a module Foo, and a module Foo::Bar required by Foo all located in my 'project' directory. If I use h2xs to start both modules, I end up with a project/Foo/ directory and a project/Foo-Bar/ directory that are independent of each other. Modulemaker on the other hand creates a project/Foo/ directory (containing Changes, MANIFEST, t, lib, etc) and then a project/Foo/Bar directory (also with its own t, lib, etc.)for the second module, tying the second module into the first. Is one of these preferred over the other? The modules are being co-developed and Foo must have Foo::Bar to work.

Next question: I would like to build both modules from the uppermost Foo build file as Foo::Bar is really just a sub part of that module. I've checked out MakeMaker and Module::Build documentation, and I can see how to declare the Foo::Bar module as a prereq, but not how to actually tell it to go build the other module.

So from a methodology standpoint, should I have one make file for Foo that handles both modules; two make files with the Foo makefile executing the Foo::Bar makefile; or two completely independent files that must both be make, test, installed? The second seems like the right way to do it.

Finally, how do you ensure the Foo::Bar makefile is executed from the Foo makefile? I'd be interested in how this is done from a Makefile.PL as well as a Build.PL file.


In reply to Building a multi module project by tj_thompson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.