help-make
[Top][All Lists]
Advanced

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

pattern rule dependency question


From: Der Herr Hofrat
Subject: pattern rule dependency question
Date: Mon, 7 Mar 2005 20:57:16 +0100 (CET)

HI !

 We have a large set of targets-groups, with each target needing a set of
 sub-targets that may need building independantly. So we have something like

 audio.mss
 audio.mhs
 ....
 video.mss
 video.mhs
 ..
 etc.

 So instead of having a gigantic long list of targets to maintain - as they
 all are actually similar, we tried to wrap them up in a pattern rule like:


_%: $*

%.mss:
        @echo mss build for $*

%.mhs:
        @echo mhs build for $*

And we then call make as  make _video.mss which as I had expected then runs
the %.mss rule. This works ok in that it calls the body of the .mss pattern
rule - so we had it wrapped up as we wanted. But it seems like its directly
calling it and not calling the _%: rule as I had expected - so what are the
precedence rules for pattern rules ? What I don't understand

1) why does the above construct call the %.mss rule directly and not the 
   _%: rule if called with make _video.mss ?

1) As soon as the _%: $* rule got a body it stoped working so

_%: $*
        @echo main rule

and it stops working - that is it outputs "main rule" but no longer calls the
%.mss or %.mhs pattern rules which I assumed it would as those are listed as
its prerequisites (indicating that the _% rule was called befor the %.mss 
rule).

2) if I tried to add prerequisites to the .mss pattern rule or set variables
   using any of the automatic variables in the form:

%.mss: project/$*/base.mss   # make the target-groups base.mss a prerequisite
        @echo processing mss
  or:

%.mss: base_mss=project/$*/base.mss
        @echo modifyin $(base_mss)

This rule fails - and I was not able to figure out how I could beuild a 
prerequisite list for this target using $* or $@ within a path contstruction.

Using constructs like

%.mss: VAR=value

work fine as long as value does not contain any of the automatic variables, 
but I could not find any note in the info pages stating that automatic 
variables can't be used in prerequisites

Can anyone give me a hint on how this could be done ? Or am I just trying to
do something stupid ?

thx !
hofrat




reply via email to

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