in reply to Re^2: how to create makefile?
in thread how to create makefile?

This sounds like a great job for make, but this is Perlmonks, not makemonks. I suggest that you learn about make and then use that knowledge to create the appropriate Makefile. If you want to implement this in Perl, there is Algorithm::Depends, which allows you to list file dependencies and then perform actions based on the dependencies.

The Makefile for your case would likely be something like the following. You will need to preserve the tabs, because tabs are special characters in make:

.PHONY all all: resultfile1 resultfile2 resultfile1: perl -I -Mmod1 -Mmod2 pgm.pl paramFile resultfile2: resultfile1 perl -I -Mmod3 -Mmod4 pgm2.pl paramFile2

As you haven't told us the names of the resulting files of the program runs, I've substituted resultfile1 and resultfile2 for them.

Replies are listed 'Best First'.
Re^4: how to create makefile?
by carolw (Sexton) on Jan 09, 2015 at 09:33 UTC

    so, do I not have to use

    use ExtUtils::MakeMaker; WriteMakefile( NAME => 'myPgm', VERSION => .... );

    with your code for the make or they are 2 different things? If different, how to run yours, just by typing make or perl fileName.PL?

      No. ExtUtils::MakeMaker is for creating a Makefile for module installation.

      If your process is not about module installation for Perl, ExtUtils::MakeMaker is the wrong tool.

      Maybe now it's time for you to explain what the actual goal is and why you think that a Makefile is the appropriate tool.

        well, as I said, the purpose was to run the script automatically and I got the idea from the makefile that is used for c programs in which we list all c programs, compile, create obj file and then, run the executable. but as I said, perhaps I wrongly made the analogy with the perl makefile.