The `compile` command

Usage

`compile [-clean] [-verbose] [ compile_to_c_options] <Root-Class> [<Root-Procedure>]`

Command `compile` is the SmallEiffel compiler.
Source code is Eiffel and target code is ANSI C code.

Command `compile` executes in two major steps:

Step 1 - | command `compile_to_c` is called to produce various C files (*.h and *.c). A script file is also produced by command `compile_to_c`. The name of the script file is also printed by command `compile_to_c` (*.make on Unix or *.BAT on DOS for example).
Step 2 - | The script file produced during step 1 is runned, launching the C compilation and linking of all the C files produced during the previous step .

Thus, command `compile` is a simple launcher used to sequentially call command `compile_to_c`, the C compiler and the linker.

Like command `compile_to_c`, command `compile` must have at least one argument to indicate the starting execution point of the system. Thus execution will start in <Root-Procedure> of <Root-Class>. The default <Root-Procedure> is make.

Options

-clean:
  By default, the generated C files and object files are kept from one invocation of command `compile` to another. This enables incremental C compilation, since only the C files which have been modified since the last invocation of command `compile` will be recompiled. Because the Eiffel to C compilation performed by SmallEiffel is generally much faster than the C compilation itself, incremental C compilation saves times. However, there are situations where you want to get rid of all the previously generated C and object files, to start afresh. This occurs, for example, when you change the C compiler options: these new options apply only to the C files which are actually recompiled (see example 3 below).
  Option -clean removes the C and object files previously generated by making command `clean` be called at the end of the compilation.
-verbose:
  Displays (a lot of) useful information during the compilation (full path of loaded files, type inference score, generated files, etc).

Examples

Example 1
When SmallEiffel is correctly installed, you can simply type the following command to test the hello world program:

  `compile hello_world`

The compiler should tell you what's wrong or should compile Eiffel source files telling you the full path used to load the Eiffel source code.
Under UNIX, the executable file is named "a.out" by default.

Example 2
Type following command to finalize the hello_world simple program:

  `compile -boost -no_split -O3 hello_world`

Note that option -O3 is passed to the C compiler (see the manual of your C compiler). Options -boost and -no_split are passed to command `compile_to_c`. This is usually the best way to finalize your application.
Only one C file is produced (option -no_split)

Example 3
To compile a big project (class PROJECT) with C files splitting and require assertions checked:

  `compile -require_check project`

The very first time, all C files are produced and compiled. Then, if you type the same command after some changes in the Eiffel source files, all C files are also produced from scratch. If there are only minor changes in the generated C files, only modified ones are passed to the C compiler (previous object files have been saved).
Keep in mind that C compiler options are not taken into account. Thus if you now want to do:

  `compile -require_check project -O3`

You must use the clean command before:

  `clean project`

All C files will be then recompiled using the new C option -O3. You are thus sure that the new C options are taken into account.
Copyright © Dominique COLNET and Suzanne COLLIN - <colnet@loria.fr>
Last update: 05 June 1999, by DC & OZ.