next up previous contents index
Next: Protocol Scheduling Up: Developer's Guide Previous: Overview

Compilation Configuration Process

 

Organization

The gated building process allows the compilation of gated for different architectures using the same source tree. Each different system can use a subdirectory of the src directory to compile the source files into architecture dependent object files.

Moreover the list of files to be compiled, and their content are dependent on the list of protocols the user chooses to configure in his Config file.

The 'make config' process is in charge of configuring the object directory with the set of files needed for a certain configuration, as well as creating certain files used during the building process.

The make config process

The 'make config' process creates the following files:

The files needed for this configuration process are:

To summarize, when executing make config the util/configure.pl script is first run. This script will:

Then a make config will be executed in the object directory. This process will:

Make's targets list

The object directory Makefile defines the following targets for any program to be built. Other can be added on a case by case rule.

File filtering

 

Some files in the distribution package are run through a filter to obtain a version which only supports of the user configured protocols. For example if only rip and bgp are needed then the resulting file will only contain the code for RIP and BGP, which makes the final binary smaller. The general syntax for filtering in or out some part of the code is similar to the C processor. The syntax is:

@BEGIN [NOT] SYMBOL [| SYMBOL2...] text... @END

The text in between @BEGIN and @END will be kept if the symbol SYMBOL (or SYMBOL2...) is defined. Those symbols are any variable, protocol or option defined in the Config file. They include program names ( cc, lex...), directory or file names ( path_config, mandir, ...), options ( NEED_STRERROR, POSIX_SIGNALS, ...) and protocols ( bgp, rip, ...). For the later the symbol to add after @BEGIN is PROTO_BGP for bgp, PROTO_RIP for rip, etc... (See the %proto definition in util/configure.pl for the equivalence between protocol names and symbols).

Also some generic names (as the dump file name, configuration file name, etc...) are replaced by their real value chosen by the user. If the source file contains the tokens @(symbol) then this token will be replaced by the value of symbol defined in the Config file. For instance, if the Config file contains

path_config /etc/\%s.conf

and the file paths.h contains

#define _PATH_CONFIG "@(_path_config)"

then the resulting file will be

#define _PATH_CONFIG "/etc/\%s.config"

[ Note: trailing '_' are ignored and substitution is case insensitive.]

Adding a new protocol

The following are recommendation to install a new protocol into gated:



next up previous contents index
Next: Protocol Scheduling Up: Developer's Guide Previous: Overview



Laurent Joncheray
Wed Jun 12 15:35:22 EDT 1996