## 6 Building and installing `sketch`

`Sketch` is so small that compiling by brute force is probably best. The following command ought to do the trick on any systems where `gcc` is installed. Make sure to first change current directories to the place where you have unpacked the sources.

         gcc *.c -o sketch.exe -lm

The .exe at the end is necessary for Windows systems. Drop it if your system is some version of Unix. Other C compilers ought to work as just as well. For example,

         cl *.c -o sketch.exe

is the correct command for many versions of MS Visual C. In the latest versions, Microsoft has deprecated the `-o` option and, by default, does not define the `__STDC__` macro. This causes problems with some versions of `flex`, `bison`, `lex`, and `yacc`, which are used to create the `sketch` scanner and parser. It's nearly always possible to find a set of options that compiles with no errors or warnings, and this means `sketch` is very likely to work correctly. For example, the Visual C++ 2005 Express Edition compiler (available free of charge from the Microsoft web site), `flex` version 2.5.4, and `bison` version 2.1 build error-free with

         cl -DYY_NEVER_INTERACTIVE=1 -Za -Ox -Fesketch.exe *.c

For purists, there is also a `makefile` compatible with GNU `make` and `gcc`. The command

         make

will build the executable, including the rebuilding of the scanner and parser with `flex` and `bison` if you have changed sketch.l or `sketch.y` respectively.

While not essential, building the manual is an excellent test of your `sketch` installation. To build this document in all its myriad forms (assuming you have the necessary conversion programs on your system), use

         make docs

The possibilities are listed in this following table.

Format | Converter | Pictures | Description
--- | --- | --- | ---
manual.info | makeinfo | .txt | GNU Info.
manual.dvi | texi2dvi | .eps | TeX typeset output.
manual.ps | texi2dvi,dvips | .eps | Postscript.
manual.pdf | texi2dvi | .pdf | Adobe PDF.
manual.html | makeinfo | .png | A single web page.
manual/index.html | makeinfo | .png | Linked web pages, one per node.

All the required tools are included in the standard `TeX Live` distribution except that an additional open source program `epstool` is needed to refine the Encapsulated Postscript bounding boxes of `sketch`-generated figures in the manual. This tool is available in binary form for Windows, and it builds easily with a simple `make` under linux or Cygwin installations that have development tools installed or under `Mac OS X` with `XCode` installed.