\chapter{Compiling and installing \faust}

The \faust source distribution \lstinline'faust-2.15.0.tar.gz' can be downloaded from GitHub (\myurl{https://github.com/grame-cncm/faust/releases}).

\section{Organization of the distribution}
The first thing is to decompress the downloaded archive. 
\begin{lstlisting}
	tar xzf faust-2.15.0.tar.gz
\end{lstlisting}

The resulting  \lstinline'faust-2.15.0/' folder should contain the following elements:

\begin{tabular}{ll}
	\lstinline'architecture/' 		&\faust libraries and architecture files\\
	\lstinline'benchmark'			&tools to measure the efficiency of the generated code\\
	\lstinline'compiler/'			&sources of the \faust compiler\\
	\lstinline'examples/'			&examples of \faust programs\\
	\lstinline'syntax-highlighting/'&	support for syntax highlighting for several editors\\
	\lstinline'documentation/' 		&\faust's documentation, including this manual\\
	\lstinline'tools/'				&tools to produce audio applications and plugins\\
	\lstinline'COPYING'			&license information\\
	\lstinline'Makefile'			&Makefile used to build and install \faust\\
	\lstinline'README'			&instructions on how to build and install \faust
\end{tabular}

\section{Compilation}
\faust has no dependencies outside standard libraries. Therefore the compilation should be straightforward. There is no configuration phase, to compile the \faust compiler simply do :
\begin{lstlisting}
	cd faust-2.15.0/
	make
\end{lstlisting}

If the compilation was successful you can test the compiler before installing it:
\begin{lstlisting}
	[cd faust-2.15.0/]
	./compiler/faust -v
\end{lstlisting}
It should output:
\begin{lstlisting}
	FAUST, DSP to C++ compiler, Version 2.15.0
	Copyright (C) 2002-2019, GRAME - Centre... 
\end{lstlisting}

Then you can also try to compile one of the examples :
\begin{lstlisting}
	[cd faust-2.15.0/]
	./compiler/faust examples/generator/noise.dsp
\end{lstlisting}
It should produce some C++ code on the standard output

\section{Installation}
You can install \faust with:
\begin{lstlisting}
	[cd faust-2.15.0/]
	sudo make install
\end{lstlisting}
or
\begin{lstlisting}
	[cd faust-2.15.0/]
	su
	make install
\end{lstlisting}
depending on your system.

\section{Compilation of the examples}
Once \faust correctly installed, you can have a look at the provided examples in the \lstinline'examples/' folder. This folder contains a  \lstinline'Makefile' with all the required instructions to build these examples for various \textit{architectures}\marginpar{An architecture file provides the code needed to connect a signal processor to the outside world. It typically defines the audio communications and user interface.}, either standalone audio applications or plugins.

The command \lstinline'make help' will list the available targets. Before using a specific target, make sure you have the appropriate development tools, libraries and headers installed. For example to compile the examples as ALSA applications with a GTK user interface do a \lstinline'make alsagtk'. This will create a \lstinline'alsagtkdir/' subfolder with all the binaries. 

