[ale] Makefile madness

Jim Patterson unixdude at gmail.com
Mon Apr 11 14:32:04 EDT 2005


On Apr 8, 2005 10:57 AM, Jim Popovitch <jimpop at yahoo.com> wrote:
> I'm looking for some Makefile advice.  In my Makefile I have a target
> setup to build some perl modules in a non-standard directory.
> 
> At the top of the Makefile there is this definition:
> 
> ----------------
> PERL_MODS=DBD-Oracle-1.16 IO-Tty-1.02 IO-Stty-.02 Expect-1.15 \
>       Parse-RecDescent-1.94 XML-SAX-0.12 SOAP-Lite-0.60 \
>       XML-NamespaceSupport-1.08 XML-Simple-2.14 XML-Parser-2.34
> ----------------
> 
> Here is the target to build the Perl modules:
> ----------------
> perl_mods:
>         find perl_mods -name Makefile.old -exec rm {} \;
>         for F in ${PERL_MODS}; do \
>            cd perl_mods/$$F; ${PERL} Makefile.PL \
>                PREFIX=/home/jimpop/perl5 ; make install; cd $(PWD) ; \
>         done
> ---------------
> 
> The issue I am having is that "make perl_mods" reports that perl_mods is
> up to date even though the destination directory /home/jimpop/perl5
> doesn't exist.  I want to add some dependencies to the perl_mods target,
> but I don't want to add a make target for each Perl module.  Any ideas
> on what to do?

Jim,

The issue is happening because you have a directory called perl_mods and
the target perl_mods has no dependancies.  This causes make to think
that the target is up to date.

You have a couple of options from here:
1) You can educate make about the real work of that target so that
    make can verify the dependancies.
2) You can tell make that it is a phony target and cause it to rebuild
    every time.
3) Remove perl_mods from the overall build list so that make will not
    automatically build it, then you call it explicity when you want it
    to happen.

I'm sure there are other options, but those would seem to be the
most likely.

#1 is the hardest, but it would be done by replacing perl_mods target
with a rule that uses an macro to convert the module list into a list of
real targets and changing the rules to use the correct automatic
variable.  If you want to do this, I can help but I would need to 
know more about what Makefile.PL and make install does for
those packages.

#2 and #3 are done by adding a ".phony: perl_mods" line and then
either having or not having perl_mods as a dependancy of one of the
other targets.

Jim Patterson



More information about the Ale mailing list