F�lix Hauri wrote:
> 

> %.err: %.ps %.h
>         file="$<";\
>         cat $${file%.ps}.h $< |\
>         gs -dBATCH -dNOPAUSE -sDEVICE=bbox -q -sOutputFile=/dev/null\
>                 -dSAFER - -c quit >$@

> P.S. Je n'aime pas trop le 'bricolage' (file=...) que j'ai fait pour
> r�cup�rer le nom du fichier sans extension � la premi�re ligne de
> '%.err:' (ou pour r�cup�rer le nom du deuxi�me 'pr�-requis').
> 
> Si qqn peut me corriger...

Je ne sais pas si c'est propre � GNU Make, mais dans mon manuel il y a
pour r�cup�rer le nom sans extension (ou plus pr�cis�ment la partie qui
correspond au '%') :
`$*'
     The stem with which an implicit rule matches (*note How Patterns
     Match: Pattern Match.).  If the target is `dir/a.foo.b' and the
     target pattern is `a.%.b' then the stem is `dir/foo'.  The stem is
     useful for constructing names of related files.

     In a static pattern rule, the stem is part of the file name that
     matched the `%' in the target pattern.


Mais dans le cas pr�sent, je pense que $^ est plus adapt� :
`$^'
     The names of all the dependencies, with spaces between them.  For
     dependencies which are archive members, only the member named is
     used (*note Archives::.).  A target has only one dependency on
     each other file it depends on, no matter how many times each file
     is listed as a dependency.  So if you list a dependency more than
     once for a target, the value of `$^' contains just one copy of the
     name.


Ainsi la r�gle deviendrait :
%.err: %.h %.ps
        cat $^ |\
        gs -dBATCH -dNOPAUSE -sDEVICE=bbox -q -sOutputFile=/dev/null\
           -dSAFER - -c quit >$@


-- 
Marc Mongenet
--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question.

Répondre à