compile
compile [-c_code] [options] <Root-Class> [<Root-Procedure>]
Command compile is the SmallEiffel compiler.
Source code is Eiffel and target code is ANSI C code.
Execution of command compile has three 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 - | C compiling, and C linking of C files using the
script file produced at first step.
|
Step 3 - | Some cleaning is done using command clean unless option
-c_code is present.
|
Thus, command compile is a simple driver to call separately
command compile_to_c, the C compiler, the linker and command
clean.
As 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.
-
-c_code:
- All options of command compile_to_c can be used with
command compile (they are simply passed to command
compile_to_c). Option -c_code is the only one not to be passed
to command compile_to_c
The option -c_code must be used if you want to save the produced
C code (as well as object files). Saving C code is useful for
application delivery.
Saving C code also turns on the incremental C compilation mode.
Each old C file is saved as well as the corresponding object file.
Only modified C files are recompiled. When a C file is not modified,
the corresponding old object file is used. Be careful with
additional C options because they are not take in account when
using -c_code option (see example 3 below to work around).
-
-verbose:
-
to have information during the compilation (the full path of
loaded files is printed, type inference score, created files, etc).
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 manual
of gcc). Options -boost and -no_split are passed to command
compile_to_c (see
compile_to_c
). This is usually the
best way to finalize.
Only one C file is produce (option -no_split)
Example 3
To compile a big project (class PROJECT) with C code saving
and require assertions checked:
-
compile -c_code -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 you are lucky (if there are only minor changes in produced
C files), only modified C files are passed to the C compiler
(object files have been saved).
Keep in mind that C compiler options are not taken in account.
Thus if you now want to do:
-
compile -c_code -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 in account.
Copyright © Dominique COLNET and Suzanne COLLIN -
<colnet@loria.fr>
Last update: Saturday November 22, 1997