Answer the question
In order to leave comments, you need to log in
Why do we need make dependencies?
hello: main.c hello.c
gcc -o hello main.c hello.c
Answer the question
In order to leave comments, you need to log in
So that in the event that main.c OR hello.c has changed by the time make is executed, each of them would be recompiled. If this is not done, there is a risk that the source is newer, and the older object module will be included in the binary.
Because in the general case, the command and dependencies are not related in any way.
Specifically, here you can avoid duplication using automatic variables gcc -o [email protected] $^
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question