Next: Project, Previous: Sourcecode objects, Up: Extending EDE

### 7.4 Compiler and Linker objects

In order for a target to create a `Makefile`, it must know how to compile the sources into the program or desired data file, and possibly link them together.

A compiler object instantiation is used to associate a given target with a given source code type. Some targets can handle many types of sources, and thus has many compilers available to it. Some targets may have multiple compilers for a given type of source code.

EDE will examine the actual source files in a target, cross reference that against the compiler list to come up with the final set of compilers that will be inserted into the Makefile.

Compiler instantiations must also insert variables specifying the compiler it plans to use, in addition to creating Automake settings for `configure.in` when appropriate.

Compiler objects are stored in the target objects as a list of symbols, where the symbols value is the object. This enables the project output mechanism to work more efficiently.

Targets will also have a special "compiler" slot which lets a user explicitly choose the compiler they want to use.

Here is an example for texinfo:

         (defvar ede-makeinfo-compiler
           (ede-compiler
            "ede-makeinfo-compiler"
            :name "makeinfo"
            :variables '(("MAKEINFO" . "makeinfo"))
            :commands '("makeinfo -o $ $<")
            :autoconf '(("AC_CHECK_PROG" . "MAKEINFO, makeinfo"))
            :sourcetype '(ede-makeinfo-source)
            )
           "Compile texinfo files into info files.")

See Compilers.

When creating compiler instantiations, it may be useful to `clone` an existing compiler variable. Cloning allows you to only modify parts of the original, while keeping the rest of the same. Modification of the original will result in the clone also being changed for shared value slots.

The second important object is the linker class. The linker is similar to the compiler, except several compilers might be used to create some object files, and only one linker is used to link those objects together.

See `ede-proj-obj.el` for examples of the combination.