CMake: What's the usage of "make depend"?
Asked Answered
I

2

9

One of the targets generated by cmake is depend:

The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... edit_cache
... rebuild_cache

What would be the effect of executing "make depend"?

Incontrollable answered 8/6, 2013 at 8:55 Comment(0)
S
3

This builds the dependencies rules of some goals of the Makefile. See http://en.wikipedia.org/wiki/Makedepend

Southdown answered 8/6, 2013 at 11:2 Comment(1)
What's the output of "make depend"?Incontrollable
C
3

As part of every file compilation, CMake asks the compiler to record the dependencies it read during compilation using a combination of the -MD, -MT and -MF flags. When you then change a file, the underlying build system (Make) can quickly see if any file needs to be recompiled if either itself or one of the files it depends on has changed.

This dependency information is stored in lots of small files. Since reading lots of small files can be very slow, they are consolidated onto "depend.cmake" and "compiler_depend.cmake" files deep inside the CMake-generated build system. On my local version of CMake, this is notified as a purple "Consolidate compiler generated dependencies of target T" message.

Finally, calling make depend does two things:

  • It checks whether the build system is complete and not corrupt, and
  • it replaces all the consolidated dependency files with empty files so the next run will start fresh and regenerate these files.
Concinnate answered 12/10, 2022 at 9:7 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.