help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using % in $(call)


From: geisler
Subject: using % in $(call)
Date: Fri, 12 Apr 2002 13:04:33 -0500 (CDT)

Let me say what I'm trying to do and then tell you how I'm trying to do
it and what my problem is.

I have a list of Perl scripts that I want to make in
$(perl-subcommands) that I want to make into an executable.  The values
in $(perl-subcommands) can have either .pl or .pm suffixes.  I have
stored the executables like so:

    perl-subcommand-names := $(basename $(perl-subcommands))

I've created the function pl-or-pm that looks like:

    pl-or-pm = $(findstring $(1).pl,$(perl-subcommands)) $(findstring 
$(1).pm,$(perl-subcommands)) $(warning FINDING $(1))

(excuse the long line, I have a style document that explicitly states
that I should not use \ continuations!, but lets not argue about
something I can't change)  I've included the $(warning) to show you
quickly what happens if you do a cut-and-paste job.

So then to make the executables dependent on the proper file, I created
the following line:

    $(perl-subcommand-names):%:$(call pl-or-pm,%)
        #commands to put the right path for perl at the #! at the top of
        #the executable

When I execute the make, the wrong dependency is formed because "%" is
passed to pl-or-pm instead of the value it substitutes for.  So nothing
matching is found.  This really screws up the make in the case where I
have:

    util.pm: util.pm.in
        #massage util.pm.in into util.pm

which never gets called because util doesn't see its dependency on
util.pm .

My question, then, is how do I pass the "right" value to pl-or-pm?

                                                -- Jonathan Geisler --



reply via email to

[Prev in Thread] Current Thread [Next in Thread]