corazza
corazza

Reputation: 32354

How deep does make check for dependencies?

I have the install target depend on my all target, which then depends on prog, the name of the program that needs to be installed. The problem is, when I change prog.cpp, and run make install, it doesn't recompile. However, when I just run make, it does. How deep will make actually check to see if there are targets that need to be updated? Because it seems to stop very soon...

Upvotes: 0

Views: 124

Answers (1)

Christian Stieber
Christian Stieber

Reputation: 12496

"Make" checks dependencies no matter how "deep" they are, but it doesn't do ANYTHING automatically. If "make install" doesn't establish a proper dependency chain leading to the actual build then it simply won't happen.

Example:

install:
   cp Program /usr/bin/Program

will do just that: it will copy the program and do nothing else.

install: Program
   cp Program /usr/bin/Program

says that "install" depends on "Program", so before actually doing the commands associated with the "install", make will look for stuff to do about "Program".

Upvotes: 2

Related Questions