help-make
[Top][All Lists]
Advanced

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

multi pattern rules?


From: Daniel Mahler
Subject: multi pattern rules?
Date: Wed, 5 Nov 2003 19:47:52 -0600

I am using file names to encode parameter vaules of how the are
generated. for example one run the command

 cmd param <name.ext1 >name-param.ext2

I chain many such phases to end up with a file named

 name-param1-..-paramN.extN

ie each stage is identified by a unique extension and
the final file name contains all the parameter values used along the
way.

I have the whole process written in a monolithic bash script,
but would like to brak it up into a makefile

What is the best way to encode such rule?

Is there a way to have 2 wildcards in a rule?


I could imagine something like

%-&.ext2 : %.ext1
    cmd $& < $? > $@

where & acts as a second wildcard character
and $& refers to whatever & matched.

I see nothing like that in the docs and would run into the problem
of people wanting 2,3, ... parametric parts of target

Maybe something like 

%.ext2 : $(patsubst ...)

but I am not sure hoa that sould actually be done.
My initial experiment was

%.a : $(subst x,y,%.c)
        : $@ : $?

%.c :
        : $@

but I get

bash-2.04$ make x.a
: x.c
: x.a : x.c

instead of

bash-2.04$ make x.a
: y.c
: x.a : y.c

[ie the $(subst ..) does not seem to be kicking in]

thanks
Daniel











reply via email to

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