Makedepend
makedepend is a Unix tool used to generate dependencies of C source files.[src] A Microsoft Windows version was made available in 2002 and last updated in 2007 on UnxUtils.[src]
makedepend is a Unix tool used to generate dependencies of C source files.[src] A Microsoft Windows version was made available in 2002 and last updated in 2007 on UnxUtils.[src] ==History== makedepend was developed as part of MIT's Project Athena.[src] It was used extensively in building X11 and ancillary packages, but has since become superseded by the dependency generation facilities of various compilers, and is now used primarily as a worst-case fallback, e.g.[src] by depcomp and GNU Automake.[src] ==Usage== makedepend is invoked with a list of sourcefiles: makedepend [options] foo.c bar.c ...[src] However, it is more often invoked as a target from a makefile, typically under the depend target, such that make depend will invoke makedepend on all source files in the project.[src] One such example target would be as follows: SRCS = file1.c file2.c ...[src] CFLAGS = -O -DHACK -I../foobar -xyz depend: makedepend -- $(CFLAGS) -- $(SRCS) ==Purpose== When building C language projects, it is imperative for incremental compilation (and useful for clean compilation) to be able to track dependencies between compilation units.[src] C expresses interfaces between compilation units via header files; as such, it is often necessary to rebuild a compilation unit when a header it includes is changed.[src] make needs to be informed of these dependencies.[src] makedepend solves this problem by parsing the code of C source files to generate a list of dependencies (those header files included directly and indirectly).[src] It is able to understand conditional compilation constructs so as to not generate excessive dependencies.[src] It then appends rules expressing the dependencies to the Makefile.[src] ==Shortcomings== Much modern source code uses "conditional compilation" to control which part of the source code to be used based on C pre-processor symbols defined by the compiler.[src] These symbols may state the compiler name or family, version number, operating system, and word size.[src] Depending on these symbols, the included files may change.[src] However, makedepend isn't itself a compiler and defines no such symbols, so the output may be incorrect.[src] Further, some code will purposefully produce an explicit error if it cannot recognize any supported compiler, and thus will not be usable by makedepend at all.[src] ==Alternatives== Most modern compilers provide a flag (often -M ) that uses the compiler's own source parser to generate a list of dependencies .[src] This may be preferred to makedepend because it reduces the likelihood of the dependencies generated being at odds with the compiler's own behavior.[src] Since compilers accept different flags for dependency generation, and may behave differently in outputting dependency information, it is desirable to use a wrapper script that can invoke the compiler appropriately (and fall back to makedepend if necessary).[src] One popular such wrapper script is depcomp, which is distributed with and used by GNU Automake.[src] Solaris make includes support for dependency tracking that is activated by specifying the "special-function target" .KEEP_STATE .[src] ==References== ==External links== Directory where the sourcecode is available[src]
27 sentences · 27 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Makedepend." encyclopegia.org, 2025, https://encyclopegia.org/wiki/makedepend. Accessed 05 December 2026.
Chicago
"Makedepend." encyclopegia.org. Accessed December 5, 2026. https://encyclopegia.org/wiki/makedepend.
APA
encyclopegia.org. (2025). Makedepend. Retrieved December 5, 2026, from https://encyclopegia.org/wiki/makedepend
Accessed December 5, 2026 · CC BY-SA 4.0 · citation page · JSON