[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefile remaking loop
From: |
Boris Kolpackov |
Subject: |
Re: Makefile remaking loop |
Date: |
Mon, 14 Mar 2005 13:59:54 +0000 (UTC) |
User-agent: |
nn/6.6.5+RFC1522 |
address@hidden (Frank Küster) writes:
> Boris Kolpackov <address@hidden> wrote:
>
> > address@hidden (Frank Küster) writes:
> >
> >> all: fileB
> >> echo "made $@"
> >> -ls --full-time -l $<
> >>
> >> fileB: ../fileA
> >> test -e $< && test $< -nt $@ && cp $< $@ || true
> >>
> >> ../fileA:
> >> true
> >>
> >> This seems to go well, does anybody still see a problem?
> >
> > You don't really need the last rule, i.e.,
> >
> > all: fileB
> > echo "made $@"
> > -ls --full-time -l $<
> >
> > fileB:
> > test -e $< && test $< -nt $@ && cp $< $@ || true
> >
> But if fileA does not exist, it gives an error:
>
> make: *** No rule to make target `../fileA', needed by `fileB'. Stop.
It's because you haven't removed the dependency of fileB on fileA (as
in the example I gave above). Also note that you will need to use actual
file name instead of $< in the rule's command script, i.e.:
fileB:
test -e ../fileA && test ../fileA -nt $@ && cp ../fileA $@ || true
hth,
-boris