News: Stay up to date

The Étoilé community is an active group of developers, designers, testers and users. New work is being done every day. Visit often to find out what we've been up to.


Simplifying Internal Dependency Handling

Posted on 2 September 2006 by Quentin Mathé

Inside Étoilé repository, it's common to have a module depending on other Étoilé modules. To build such a module you need to include the headers of the dependency and link the related object code (usually in a library or framework form).

This is easy if you compile and install modules one by one by taking care of any dependencies yourself. For example, Grr application relies on RSSKit framework. With a fresh copy of the repository… First, you step in Framework/RSSKit, type make && make install, then you move to Services/User/Grr and type make && make install once again.

This becomes more tricky, when you do make && make install for the whole repository (specially when you install Étoilé for the first time). Without any GNUmakefile tweaks, Grr compilation will fail reporting an error about missing RSSKit on your system. Until now, every modules in the repository got to be hacked in order to be included in the default build process. The default build process is what gets compiled when you type make at the root of the repository.

The hack was usually in form of such GNUmakefile.postamble and GNUmakefile.preamble (both from PreferencesKitExample module in this case).

To avoid the repetition of this boilerplate code everywhere, I recently committed a new makefile called etoile.make directly at the root of the repository. By including it in your GNUmakefile, the only code you have to write to handle an internal dependency is drastically reduced. Here are the lines needed to handle RSSKit dependency in Grr GNUmakefile:


-include ../../../etoile.make

Finally before including this code, you need to check this dependency is already declared in etoile.make with a line like:
RSSKit = Frameworks/RSSKit
If it's not the case, you need to update etoile.make too.

There is currently a limitation with etoile.make, you cannot declare more than one dependency trough DEPENDENCIES variable, but this should improve really soon.