Vitaly Pinjagin wrote:
> Hе подскажет ли многоуважаемый All, что будет с файлом f.o,
> после выполнения
> touch f.c; rm -f *.[ob]; gmake -f Makefile-1 all
> --------- Makefile-1 ------------
> all: f.b
> all2: f.b f.o
> %.o: %.c
> cp $< $@
> %.b: %.o
> cp $< $@
> -------- end Makefile-1 ----------
>
> а если закоментарить строку "all2: f.b f.o" ?
>
> если *внезапное* появление 'rm f.o' вас не озадачило - то укажите мне то
> место в прсловутом RTFM-е которое погло бы энто пояснить.
Похоже на дело рук подразумеваемых правил (по умолчанию)
http://www.gnu.org/manual/make/html_chapter/make_10.html#SEC89
(Using Implicit Rules)
Linking a single object file
`n' is made automatically from `n.o' by running the linker (usually
called ld) via the C compiler. The precise command used is `$(CC)
$(LDFLAGS) n.o
$(LOADLIBES)'. This rule does the right thing for a simple program
with only one source file. It will also do the right thing if there are
multiple object files
(presumably coming from various other source files), one of which
has a name matching that of the executable file. Thus,
x: y.o z.o
when `x.c', `y.c' and `z.c' all exist will execute:
cc -c x.c -o x.o
cc -c y.c -o y.o
cc -c z.c -o z.o
cc x.o y.o z.o -o x
rm -f x.o
rm -f y.o
rm -f z.o
Вадим Чекан.
-- end of forwarded message --
-- С тем, что не помешает никогда, Kittle