help-make
[Top][All Lists]
Advanced

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

Re: Multiple patterns (or Wildcards) in targets?


From: Jens Schweikhardt
Subject: Re: Multiple patterns (or Wildcards) in targets?
Date: Wed, 8 Aug 2001 08:05:49 +0200
User-agent: Mutt/1.2.5i

On Tue, Aug 07, 2001 at 09:39:31PM +0000, Nestor Amaya wrote:
# This is somewhat related to my previous posting titled "help with the scope
# of pattern-specific variables".
# 
# I have searched books, websites, man pages, and cannot find any clues as to
# how one might define a pattern-specific variable (or target, for that
# matter) when the pattern is neither a suffix nor a prefix to the target. For
# example, I need:
# 
#       %pattern% : PAT_DEP_VAR = success
 
As Paul already pointed out, you just can't do this.

# To match any target that has "pattern" in it. A simple testcase follows:
#       ====================== Makfile ================================
#       %.1.% : PAT_DEP_VAR = yes
#       first.1.1 :
#               @echo $(PAT_DEP_VAR)
#       second.1.2 :
#               @echo $(PAT_DEP_VAR)
# 
# The output of either "make first.1.1" or "make second.1.2" should yield
# "yes". In this case, I am not particularly interested in the/either "stem"
# (but note that the "prefix-stem" and the "suffix-stem" usually do differ).
# 
# Note that I cannot automatically generate a list of the possible targets
# from an "ls", since the files may or may not exist, and the combinations may
# be too many... So in other words, I cannot search a variable
# $(POSSIBLE_TARGETS) for a match.

I'm afraid you have to bite the bullet and use target specific variables
for each target:

   first.1.1 : PAT_DEP_VAR = success
   first.1.1 :
           @echo $(PAT_DEP_VAR)
   second.1.2 : PAT_DEP_VAR = success
   second.1.2 :
           @echo $(PAT_DEP_VAR)

Not too elegant, but does the job. If you're wanting to be fancy,
autogenerate that part of the makefile and include it in the master.

Regards,

        Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



reply via email to

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