On Tue, Aug 03, 2004 at 05:10:26PM +0000, Oleg Goldshmidt wrote:
> Tzafrir Cohen <[EMAIL PROTECTED]> writes:
> 
> > $(LIST2): $(LIST)
> >     $(COMMAND)
> > 
> > $(LIST1): $(LIST)
> >     $(COMMAND)
> 
> This makes every file in LIST1 and LIST2 dependent on every file in
> LIST. Thus, make will regenerate fooCDU_1baz.c whenever barCDUbaz.c is
> touched. I think...

Right. $? is not good enough here.

so let's generate a makefile on-the-fly:

# SED_1 and SED_2 were defined above
auto.mk: $(LIST)
        echo '' > $@
        for file in $(LIST); do \
          create_lines_for_auto.mk >> $@ \
        done

Or whatever. for each item in $(LIST) auto.mk should include:

  file: fi_1le
        $(COMMAND)
  file: fi_2le
        $(COMMAND)

# the '-' means that it is not included if it does not exist.
# make will restart the evaluation after remaking a file that is
# included in the makefile
-include auto.mk

And if anybody thinks that this is complex: he's right :-(

-- 
Tzafrir Cohen                       +---------------------------+
http://www.technion.ac.il/~tzafrir/ |vim is a mutt's best friend|
mailto:[EMAIL PROTECTED]       +---------------------------+

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to