[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preprocessing files with make
From: |
Paul D. Smith |
Subject: |
Re: Preprocessing files with make |
Date: |
28 Aug 2004 14:23:26 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
%% erik.cato@japro.se (Erik Cato) writes:
>> > SRCS = $(foreach dir,$(VPATH),$(wildcard $(dir)/*.c))
>> > PREPROCS = $(notdir $(patsubst %.c,%.d,$(SRCS)))
>>
>> Now you have a list of SRCS, such as "alpha.c beta.c gamma.c"
>> and a list of PREPROCS, such as "alpha.d beta.d gamma.d".
>> And you want "make" to behave as if you had these dependencies:
>>
>> alpha.d: alpha.c
>> beta.d: beta.c
>> gamma.d: gamma.c
>>
>> I don't know how to do that either. If anybody does know,
>> I'd like to know, too!
>>
>> Gnu Make supports pattern rules with '%' in them:
>>
>> %.d: %.c
This is the right way.
>> However this is not as flexible, and pattern rules interact poorly
>> if you have another dependency rules for the same files.
Not as flexible as what? Sure, it's not possible to build foo.d from
bar.c using a pattern rule, but you don't want to do that anyway: look
at the way you've constructed the names of the .d files! This
environment is _perfect_ for pattern rules.
In what way does it interact poorly with other dependency rules?
ec> Yes, you have the quesion right! Now does anyone have a solution?
There are more advanced features, yes, such as GNU make's auto-re-exec
feature and the $(eval ...) function (introduced in GNU make 3.80).
But before we go into those you'll have to explain why pattern rules
don't solve the problem: in this case they're just what you need and
there's no use getting more complicated if you don't have to.
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- Preprocessing files with make, Erik Cato, 2004/08/18
- Re: Preprocessing files with make, Gisle Vanem, 2004/08/18
- Re: Preprocessing files with make, Erik Cato, 2004/08/19
- Re: Preprocessing files with make, Gisle Vanem, 2004/08/19
- Re: Preprocessing files with make, Colin S. Miller, 2004/08/19
- Re: Preprocessing files with make, Erik Cato, 2004/08/19
- Re: Preprocessing files with make, Michael Chastain, 2004/08/19
- Message not available
- Re: Preprocessing files with make, Erik Cato, 2004/08/28
- Re: Preprocessing files with make,
Paul D. Smith <=
- Re: Preprocessing files with make, Michael Chastain, 2004/08/28
- Message not available
- Re: Preprocessing files with make, Paul D. Smith, 2004/08/29
- Re: Preprocessing files with make, Michael Chastain, 2004/08/29
- Message not available
- Re: Preprocessing files with make, Paul D. Smith, 2004/08/29
- Re: Preprocessing files with make, Michael Chastain, 2004/08/29
- Re: Preprocessing files with make, Paul D. Smith, 2004/08/31
- Re: Preprocessing files with make, Michael Chastain, 2004/08/30