Top
Menu
compile_to_c
SmallEiffel Tools: Compile
Syntax
compile [-c_code] [options] Root-Class [Root-Procedure]
Compile is the SmallEiffel compiler.
The source code is Eiffel and the target is an executable program.
Execution of the command compile has three major steps:
- the command compile_to_c is called to produce various
C files (*.h and *.c). Compile_to_c produces a script file
and prints its name (*.make on
Unix or *.BAT on DOS, for example) to standard output;
- C compiling, and linking of C files using the
script produced at step 1.
- Some cleaning is done using clean unless option
-c_code is used.
Thus, compile is a simple driver to call separately the
command compile_to_c, the C compiler, the linker and clean.
Like compile_to_c, 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 the options of command compile_to_c can be used with
compile (they are simply passed to
compile_to_c). Option -c_code is the only one not to be passed
to compile_to_c.
The option -c_code must be used if you want to save the generated
C code, as well as the 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 taken in account when
using the -c_code option (see example 3 below for a work around).
- -verbose Use this option to see additional information during the compilation (the full path of
loaded files is printed, type inference score, created 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 the 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. This is usually the
best way to finalize.
Only one C file is produced (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.
Subsequently, if you type the same command after some changes in the
Eiffel source files, all C files are again produced from scratch.
If you are lucky (if there are only minor changes in produced
C files), only the 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 first:
clean project
All C files will then be recompiled using the new C option -O3.
You are thus assured that the new C options will be taken into account.
Top
Menu
compile_to_c
This page was last changed by Oliver Elphick on 28th August 1997.