Почему заставляют настаивать, что файлы актуальны - PullRequest
0 голосов
/ 02 февраля 2020

Рассмотрим этот простой пример Makefile во FreeBSD.

all: hello

hello: hello.o
     gcc -o hello hello.o

hello.o: hello.c
     gcc -c hello.c

clean:
     rm hello.o hello

И что бы я ни делал, измените привет. c, или даже если я изменю содержимое в Makefile, чтобы завершить глупость , make говорит:

`makefile' is up to date.

Что может быть объяснением того, что там происходит?

1 Ответ

1 голос
/ 02 февраля 2020

Полагаю, у вас небольшой беспорядок с make-файлами. Обратите внимание, что (для GNU Make): By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile. - убедитесь, что вы не создали GNUmakefile`

Когда речь идет о FreeBSD на основе make, это будет: If no -f makefile makefile option is given, make will try to open 'makefile' then 'Makefile' in order to find the specifications.

Единственный случай, который я могу себе представить, следующий:

> cat Makefile
all: hello

hello: hello.o
    cc -o hello hello.o


hello.o: hello.c
    cc -c hello.c

clean:
    rm hello.o hello
> make
cc -c hello.c
cc -o hello hello.o
> ./hello
Hello world!
> make clean
rm hello.o hello
> touch makefile
> echo "makefile:" > .depend
> make
`makefile' is up to date.
...