[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to methodically generate a set of rules?
From: |
Nick Patavalis |
Subject: |
Re: how to methodically generate a set of rules? |
Date: |
Tue, 28 Mar 2006 03:32:21 +0300 |
User-agent: |
Mutt/1.5.9i |
On Mon, Mar 27, 2006 at 02:34:35PM -0500, Robert P. J. Day wrote:
>
> now, from each source file i'm given, i can *calculate* from its
> contents the object files that will be generated so being able to
> loop through the set of source files and generate each rule one at a
> time would be terrific.
>
Don't use "make" to do the loop. Use the shell for this. Use the shell
to generate a "new" Makefile, and included it from you "main"
Makefile. Something like this:
auto.mk : s1.c s2.c ... sN.c
rm -f $@
for i in $+; do
write_rule $i >> $@
done
include auto.mk
Where, obviously, "write_rule" is whatever is required to deduce the
prerequisites for "sX.c" and output the respective Make rule.
Hope this helps
/npat
--
Saw `cout' being shifted "Hello world" times to the left and stopped
right there.
-- Steve Gonedes