Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Why do you need makefile in perl?

by venky4289 (Novice)
on Dec 17, 2013 at 21:05 UTC ( [id://1067527]=perlquestion: print w/replies, xml ) Need Help??

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

Hi,

As i am aware the make program aids you in developing your large programs by keeping track of which portions of the entire program have been changed, compiling only those parts of the program which have changed since the last compile.

As we wont compile code in perl, But in Perl why do we need makefile.pl ?

Are there any differences between the make command in unix and the makefile.pl concept in perl ?

Replies are listed 'Best First'.
Re: Why do you need makefile in perl?
by toolic (Bishop) on Dec 17, 2013 at 21:13 UTC
    A conventional way to install a Perl module is using the Makefile.PL file with ExtUtils::MakeMaker. This automates installation and testing.
Re: Why do you need makefile in perl?
by dcmertens (Scribe) on Dec 17, 2013 at 21:19 UTC
    Straight Perl code does not need a makefile, only distributions that you wish to install. That was a huge, huge attraction for me when I first came to Perl. Also, distributions do not need to use makefiles: their build process can be automated by the Perl-based Module::Build (or similar) system.
Re: Why do you need makefile in perl?
by taint (Chaplain) on Dec 17, 2013 at 22:27 UTC
    Greetings, venky4289.

    It's hard to know where to start on this -- volumes could be written. But I'll do my best to be concise. Traditionally Make has been a standard, integral part of UNIX, and UNIX-like (*NIX) systems. In fact, that's how you often built the system you were installing. This makes for a great deal of flexibility, and personalization -- hey, everybody likes choices. Anyway, This wasn't the case, with MS-DOS/Windows, presumably because they were a "for profit" company, and they already had a product they sold, that provided a make. On the other hand, this also paved the way for the likes of ActiveState. Well, given that Perl is free, and the fact that MS products didn't come with a free version of make, someone created nmake (I've forgotten details, and wikipedia doesn't provide accurate details). Which was a free version of make. That would run within dos (MS-DOS). Did you know that make will allow you to build Perl, and install it where ever you want to? Did you also know that every time you download a Perl Module, and unpack it, you can use Perl, and make to make, and install it? Did you also know that having make allows you to install 16 (or more) different versions of Perl, and by simply providing PERFIX=, you can install them anywhere you want to? See also: perlbrew

    I wish I could clearly recall the actual origin, and author of nmake. But I'll update this, if I do (recall/find it).

    Hope this helped, and best wishes.

    --Chris

    UPDATE here's the oldest reference I could find where Microsoft references nmake: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084
    UPDATE Here's also a related article, on PerlMonks: 803600
    Yes. What say about me, is true.
    

      Wow, if this is the concise version, I don't want to have to read the comprehensive one.

      Btw, nmake on Windows is from Microsoft according to Wikipedia.

        Ahem.

        "-- volumes could be written. But I'll do my best to be concise."
        I did. But part of being concise also means being complete. :)

        Yes. M$ does have a version. But their version is not the original. Wikipedia also complains of the way the document was written. You don't suppose an M$ employee wrote it, do you? :)

        As memory serves; it was either Redhat (Cygnus), or ATT. ATT had a UNIX environment for early Windows, and NT. I've got both copies. But haven't had time to look thoroughly enough to find it.

        The original nmake dates back to the '80's, and my memory isn't so good with tiny, seemingly insignificant details about MS-DOS -- an interpreter I've tried hard to forget. ;)

        All the best, hdb.

        --Chris

        UPDATE; forgot to cite Cygnus
        See also: Cygnus solutions
        Yes. What say about me, is true.
        

      Thanks for the Reply. Now i got an idea, But can you please tell me waht does each command do ? perl makefile.pl make make test make install

        perl Makefile.PL sets up the necessary build directories and creates a Makefile.

        make builds the module by copying the contents of <t>lib/ into blib ("build library"); if there are any XS modules, these get compiled at this point.

        make test runs all the tests vs. the code now in blib to verify that it passes its tests.

        make install copies the code in blib to the local Perl module directory as defined in the Perl install.

        make disttest verifies that we have all the files we expect, we don't have any files we don't expect, and that they are all in the right relative locations when we ready the code for distribution; it also rechecks that the ready-for-distribution code still passes its tests.

        make dist creates a tar ball of the source we want to distribute.

Re: Why do you need makefile in perl?
by Anonymous Monk on Dec 18, 2013 at 00:41 UTC

    As we wont compile code in perl, But in Perl why do we need makefile.pl ?

    For the same exact purpose as when you did "compile code", the purpose doesn't change

    Are there any differences between the make command in unix and the makefile.pl concept in perl ?

    Yes, the documentation explains the difference

    Are these interview questions (for a job) of homework question (for a grade)?
    make ... To prepare to use make, you must write a file called the makefile
    ExtUtils::MakeMaker - Create a module Makefile
    Module::Install - Standalone, extensible Perl module installer
    Module::Build - Build and install Perl modules

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found