http://www.perlmonks.org?node_id=1008092

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

Hi there

I'm working with Perl for quite some years on small scripts. As I'm doing a bigger project I see the use using a makefile like people do with C(++) projects.

Is this possible with pp to, and does anyone has an example of how to do this using require files in scripts. I haven't found any example of how to do this on the Net. I must say that I never created a makefile.

Yours sincerely

Albert

Replies are listed 'Best First'.
Re: how to create a makefile using PAR::Packer
by ww (Archbishop) on Dec 10, 2012 at 14:55 UTC
    Your SOPW baffles me (perhaps because of my own iggerance or deficient caffination) but some clarification would help:
    1. Would Module::Build work?
    2. How does Par Packer fit your intent?
    3. What is it that you're building that requires a makfile?
    4. How does the concept/functionality of require play a role?

      What does SOPW mean?

      1) I don't want to build Perl modules, but executables

      2) To build executables like: pp -o file.exe --link=C:\strawberry\c\bin\libmysql_.dll -x -c -vvv file.pl

      3) I have a project that consists of several .pl that I want to turn into .exe file (Windows). I can build them with a .bat file containing the pp calls but that does not include dependencies. So I want to make a new .exe if a related .pl file has changed, including the .pl file used by require

      4) When .pl are used within a .pl file the .exe. depends on them aswel

Re: how to create a makefile using PAR::Packer
by karlgoethebier (Abbot) on Dec 10, 2012 at 15:18 UTC

    I read this: pp only to create executable when source has changed

    Update: Perhaps this helps:

    Makefile

    hello: hello.pl Foo.pm pp hello.pl -o hello.exe

    Foo.pm

    package Foo; # test1 1;

    hello.pl

    #!/c:/perl/bin/perl use lib q(.); use Foo; print "Hello!\n";

    First call of dmake builds hello.exe. Next call shows `hello' is up to date. Change Foo.pm and run dmake.

    Search

    Update: Another weird use of make ;-) 28.13 make Isn't Just for Programmers! in "Unix Power Tools"

    OK, i've bought the book and i hope Tim doesn't blame...

    manual: ch01.fmt ch02.fmt ch03.fmt lp ch0[1-3].fmt ch01.fmt: ch01 nroff -mm ch01 > ch01.fmt ch02.fmt: ch02 tbl ch02 | nroff -mm > ch02.fmt ch03.fmt: ch03a ch03b ch03c nroff -mm ch03[abc] > ch03.fmt

    Best Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Thx for the replay

      What is the use of the Foo.pm in this story and why do you need it?

      In the last example you are using Visual Fox pro examples, why is this?, I thought this was a Perl forum and for me it makes it more confusing?

        Thx for the replay

        My pleasure.

        At pp only to create executable when source has changed you wrote:

        As the projects get bigger it takes longer before executables are created, what I would like and not have found yet is that executables are only created when the source (pl) has been changed. So executables are not recreated when no changes to sources have been made.

        In my simple example Foo.pm is a source file - and only when it is changed, pp is run.

        In the last example you are using Visual Fox pro examples, why is this?

        I can't see any Visual Fox Pro example for the moment, sorry. So i can't answer why this is. Please correct my if i'm wrong.

        I thought this was a Perl forum and for me it makes it more confusing?

        Nothing but the truth, this is a Perl forum - but it doesn't confuse you.

        I hope that helps.

        Best regards, Karl

        Update: P.S.: I'm about loosing my faith...please correct my if i'm wrong.

        «The Crux of the Biscuit is the Apostrophe»

Re: how to create a makefile using PAR::Packer
by Anonymous Monk on Dec 10, 2012 at 23:08 UTC

      Thanks for all help so far, although I don't have the feeling I'm closer to the solution. I think the solution provided aren't either what I'm looking for, or I'm missing some steps so I don't see the solution.

      What I'm looking for is something like this (in own created syntax)

      pp -o file1.exe --link=C:\strawberry\c\bin\libmysql_.dll -x -c -vvv f +ile1.pl dependenc: file_basicfunc.pl, file_vars.pl pp -o file2.exe --link=C:\strawberry\c\bin\libmysql_.dll -x -c -vvv f +ile2.pl dependenc: file_basicfunc.pl, file_vars.pl, file1.pl pp -o file3.exe --link=C:\strawberry\c\bin\libmysql_.dll -x -c -vvv f +ile3.pl dependenc: file_basicfunc.pl, file_vars.pl

      Unfortunately I have to do this project on Windows

      Or is it possible to create .exe on Linux used for Windows, my guts say no

        "Or is it possible to create .exe on Linux used for Windows, my guts say no"

        Your guts and the documentation are in agreement. See PAR::FAQ or http://par.perl.org.