help-make
[Top][All Lists]
Advanced

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

Variables within Pattern Rules


From: Barry Clarkson
Subject: Variables within Pattern Rules
Date: Wed, 5 Jan 2005 11:25:47 +0000 (GMT)

Hi,

How do you create a variable on the fly within a
pattern rule?

If I have two files called 'myfile.c' and
'anotherfile.c', a pattern rule for '(%.o) : %.c' I
want to be able to pass 'MYFILE_DEFS' and
'ANOTHERFILE_DEFS' as a define to $(CC) along the
lines of...

DEF=`echo $(basename $<) | tr '[a-z]' '[A-Z]'`_DEFS

...so that I can perform...

gcc -DMYFILE_DEFS myfile.c ...
gcc -DANOTHERFILE_DEFS anotherfile.c ...

...for each prerequisite.

Thanks in advance,

Barry



        
        
                
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com




reply via email to

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