user69453
user69453

Reputation: 1405

Why does make insist that the files are up to date

Consider this simple example of a Makefile on FreeBSD.

all: hello

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

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

clean:
     rm hello.o hello

And whatever I do, change hello.c, or even if I change the content in the Makefile to complete nonsense, make says:

`makefile' is up to date.

What could be an explanation whats going on there?

Upvotes: 0

Views: 693

Answers (1)

Oo.oO
Oo.oO

Reputation: 13385

I guess you have small mess with makefiles. Please note that (for GNU Make): By default, when make looks for the makefile, it tries the following names, in order: GNUmakefile, makefile and Makefile. - make sure you haven't created GNUmakefile`

When it comes to FreeBSD based make it will be: If no -f makefile makefile option is given, make will try to open 'makefile' then 'Makefile' in order to find the specifications.

The only case, I can imagine, follows:

> 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.

Upvotes: 1

Related Questions