c++ - Would GNU Make automatically add extra prerequisite? -


the following example snippet "managing projects gnu make(3rd edition)" p.21.

count_words: counter.o lexer.o -lfl 

the author says make automatically add count_words.o prerequisite list implicit rule. quoted:

..., make identifies 4 prerequisites: count_words.o (this prerequisite missing makefile, provided implicit rule), counter.o, lexer.o, , -lfl.

however, test doesn't conform that. here test:

prog: abc.o     @echo $^ abc.o:     @echo abc.o built. prog.o:     @echo prog.o bulit. 

the output after running make is:

abc.o built.

abc.o

make didn't seek prog.o target prog. what's problem? there wrong test?

by way, test on cygwin gnu make 4.1.

you gave recipe prog target. author didn't count_words target. that's difference.

the author counting on built in %: %.o rule take effect. overrode rule.

remove @echo $^ prog recipe , try again.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -