Makedepend

Makedepend

makedepend is a Unix tool used to generate dependencies of C source files.

History

makedepend was developed as part of MIT's Project Athena. 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. by depcomp and GNU Automake.

Usage

makedepend is invoked with a list of sourcefiles: makedepend [options] foo.c bar.c ...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. One such example target would be as follows: SRCS = file1.c file2.c ... 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. 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. make needs to be informed of these dependencies.

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). It is able to understand conditional compilation constructs so as to not generate excessive dependencies. It then appends rules expressing the dependencies to the Makefile.

Alternatives

Most modern compilers provide a flag (often -M) that uses the compiler's own source parser to generate a list of dependencies. This may be preferred to makedepend because it reduces the likelihood of the dependencies generated being at odds with the compiler's own behaviour.

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). One popular such wrapper script is depcomp, which is distributed with and used by GNU Automake. [ [http://sources.redhat.com/automake/automake.html#Dependency-Tracking Dependency Tracking in Automake] , Automake Manual]

References

*
* [http://xorg.freedesktop.org/releases/individual/util/ Directory where the] sourcecode is available


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • makedepend — is a Unix tool used to generate dependencies of C source files. Contents 1 History 2 Usage 3 Purpose 4 Alternatives …   Wikipedia

  • Automake — Infobox Software name = Automake developer = The GNU Project latest release version = 1.10.1 latest release date = January 21, 2008 operating system = Cross platform genre = Programming tool license = GNU General Public License website =… …   Wikipedia

  • UnxUtils — is a collection of ports of common GNU Unix like utilities to native Win32, with executables only depending on the Microsoft C runtime msvcrt.dll. The collection was last updated on April 15, 2003 by Dr. Karl M. Syring. The distribution includes… …   Wikipedia

  • Автоматизация сборки (разработка ПО) — Автоматизация сборки  этап написания скриптов или автоматизация широкого спектра задач применительно к ПО, применяемому разработчиками в их повседневной деятельности, включая такие действия, как: Компиляция исходного кода в бинарный код… …   Википедия

  • make — (engl. machen, erstellen) ist ein Computerprogramm, das Kommandos in Abhängigkeit von Bedingungen ausführt. Es wird hauptsächlich bei der Softwareentwicklung als Programmierwerkzeug eingesetzt. Genutzt wird es beispielsweise, um in Projekten, die …   Deutsch Wikipedia

  • Автоматизация сборки — Для улучшения этой статьи желательно?: Найти и оформить в виде сносок ссылки на авторитетные источники, подтверждающие написанное. Переработать оформление в соответствии с правилами написания статей …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”