Previous Home Contents Next

Chapter 27: Command line options

27.1 File types

27.2 General options

27.3 Help options

27.4 Argument gathering options

27.5 Directories and libraries options

27.6 Generated file options

27.7 Execution options

27.8 Optimization options

27.9 Debug options

27.10 C code generation options

27.11 Lisp code generation options

27.12 Message options

27.13 Developer options

27.14 Environment variables

The aldor command has the following general form:

     aldor [options] file1 file2 ...
This compiles the files one after the other, each in a fresh environment. Depending on the particular command line options given by the user, the files resulting from the compilations may be combined or run.
The options are case-insensitive so -G INTERP is treated the same way as -g interp.
If the environment variable ALDORARGS is defined, its contents are handled as options before the ones on the command line.

27.1 : File types

Files with the following type extensions are accepted on the command line:
.as Aldor source. If a file name has no type extension, then it is treated as if it were a .as file.
.ai Included Aldor source. This is a file with all ``#include'' and ``#if'' statements processed. This sort of file is produced by running the compiler with a -Fai option.
.ax Parsed Aldor source. This is a file with the program in an S-expression syntax. This is the easiest way to have the Aldor compiler process programs generated by a Lisp program. This sort of file is produced by running the compiler with a -Fax option.
.fm Foam source. ``Foam'' is an acronym for ``First Order Abstract Machine''. The Aldor compiler produces Foam as its intermediate code. An fm file contains Foam code in S-expression syntax. This sort of file is produced by running the compiler with a -Ffm option.
.ao Machine-independent object file. This is the result of compiling an Aldor source file. It contains type information, documentation, Foam code, symbol table information, and so on. Characters are internally represented in ASCII form, and floating point numbers are represented in a transportable format guaranteed not to loose significance or exponent range on any platform.
.al Archive of machine-independent object files. This is treated as a homogeneous aggregated library by the compiler. The file is laid out as a Unix-style archive on all platforms. Thus both .ao and .al files may be moved from machine to machine.
obj Object file. This is a platform-specific object file. These are named in the usual way for the platform. For example on Unix these files have extension .o, while on DOS they have extension .obj and on CMS they have extension TEXT.
arch Archive of object files. The name, contents, and format of these archives is determined by the platform. For example on Unix this would be a .a file containing .o files.


27.2 : General options

-V Run verbosely, giving compilation information.
-D id Add global assertion as #assert id.
-U id Remove global assertion as #unassert id.
-A fn Read command line options from response file fn.
-K n Compile only the first n files (0-9).
-- Treat remaining arguments as input files.
-H ... Help.
-B dir Use dir as the base directory for Aldor system files.
-I dir Search dir for additional include files.
-Y dir Search dir for additional libraries.
-R dir Put the resulting files in directory dir.
-L ... Use the given library.
-F ... Indicate which output files are to be generated.
-E fn Specify the main entry point.
-G Run the program.
-O Standard optimizations.
-Q ... Select code optimizations.
-Z ... Debugging and profiling options.
-C ... Control C generation.
-S ... Control Lisp generation.
-M Control compiler messages.
-W Developer options.


27.3 : Help options

-H elp Brief, general help.
-H all Help about all options.
-H files Help about input file types.
-H options Help about summary of options.
-H [A|args] Help about argument gathering options.
-H [H|help] Help about help options.
-H dir Help about directory and library options.
-H [F|fout] Help about output file options.
-H [G|go] Help about execution options.
-H [O|Q|optimize] Help about optimization options.
-H [Z|debug] Help about debugging options.
-H C Help about C code generation options.
-H [S|lisp] Help about Lisp code generation options.
-H [M|message] Help about message options.
-H [W|dev] Help about developer options.


27.4 : Argument gathering options

-Afn Read command line options from response file fn.
-Kn Use only the first n files (0-9). The remaining arguments are given to the Aldor program, if run with -G.
-- Treat remaining arguments as input files, even if they begin with -. If the environment variable ALDORARGS is defined, its contents are handled as options before the command line.


27.5 : Directories and libraries options

-I dir Search dir for include files. The environment variable INCPATH provides default locations.
-Y dir Search dir for additional libraries. The environment variable LIBPATH provides default locations.
-R dir Put the resulting files in directory dir. The default is the current directory.
-B dir Use dir as the base directory for Aldor system files. If the -B option is omitted, then the base directory must be given by the environment variable ALDORROOT.
-L fn Use the library given by file name fn. An alphanumeric fn is a short form for libfn.a.
-L id=fn Same as -L fn, but the source name id is associated with the library.


27.6 : Generated file options

The -F option indicates which output files are to be generated. Options marked ``(*)'' cause one file of the given type to be generated for each input file, whilst those marked ``(1)'' cause one file to be generated for the entire compilation. statements have been processed (from .as)
-F ai(*) Source after all #include
-F ax(*) Macro-expanded parse tree (from .as)
-F asy(*) Symbol information
-F ao(*) Machine-independent object file
-F fm(*) Foam code
-F lsp(*) Lisp code
-F c(*) C code
-F o(*) Object file
-F x(1) Executable file
-F main(1) Generate main.c containing function main.
If no -F or -G option is given, then -Fao is assumed.
If the parameter fn is given, it is used as the name of the corresponding output file.
The compiler will not overwrite a C or Lisp file it did not generate.


27.7 : Execution options

-G run Compile the program to machine code, and then run it. The executable file is removed afterwards unless the -Fx option is present.
-G interp Translate the program to Foam code, and then run it in interpreted mode. The .ao file is removed afterwards unless the -Fao option is present.
-G loop Run interactively, interpreting each expression typed by the user. With this option, the file aldorinit.as is used for initialization.
-E fn Use the input file fn.* as the main entry point. The default is the first file. -E is useful only with -Fx, -Grun or -Ginterp.


27.8 : Optimization options

Combinations can be used, e.g. -OQno-cc or -Qno-all -Qcc. The default is -Qcfold -Qdeadvar -Qpeep. The option -Qcc may exclude -[gp] on some platforms.
-O Optimize. This is equivalent to -Q2.
-Q n Select a level of code optimization. (default is -Q1).
-Q opt Turn on an optimization opt from the list below.
-Q no-opt Turn off an optimization opt from the list below.


Q0Q1Q2Q3
-Q allAll supported optimizations.X
-Q inlineAllow open coding of functions.XX
-Q inline-allAllow open coding of any functions.X
-Q inline-limit=nSet maximum acceptable increase in code size from inlining to n.1.01.05.06.0
-Q cfold Evaluate non floating point constants at compile time. XXX
-Q ffold Evaluate floating point constants at compile time. XX
-Q hfold Determine, where possible, the run time hash code which domains will have, reducing the number of domain instantiations and speeding up cross-file look-ups. XXX
-Q peep Local ``peep-hole'' optimizations. XXX
-Q deadvar Eliminate unused variables and values. XXX
-Q emerge Combine lexical levels and records. XX
-Q cprop Copy propagation. XX
-Q cse Common sub-expression elimination. XX

Q0Q1Q2Q3
-Q flow Simplify computed tests and jumps. XX
-Q cast Reduce the number of casts. XX
-Q cc Use the C compiler's optimizer. XX


Combinations can be used, e.g. -Q3 -Qno-ffold.
The option -Qcc may exclude -Z on some platforms.

27.9 : Debug options

-Z db Generate debugging information in object files.
-Z prof Generate profiling code in object files.


27.10 : C code generation options

Control the behaviour of -F c, the option for generating C code.
-C standard Generate ANSI/ISO standard C (the default).
-C old Generate old (Kernighan & Ritchie) C.
The options -Cstandard and -Cold are mutually exclusive.
-C comp=name Use name instead of the default C compiler driver unicl. Use -v to see how the driver is invoked.
-C link=name Use name instead of the default linker driver unicl. Use -v to see how the driver is invoked.
-C cc=name Use name instead of the default C compiler and linker driver unicl. Without this option, the environment variable CC is tried. Use -v to see how the driver is invoked.
-C go=name Use name to run the output of the linker. Without "-Cgo=", the environment variable CGO is tried. Use -v to see how the driver is invoked. Most implementations don't need this.
-C args=opts Pass opts as options to the C compiler and linker. Use -v to see how the driver is invoked.
-C smax=n Try to put no more than n statements per file, if necessary splitting the generated file into: name.h, name.c, name001.c, name002.c, etc. Using -C smax=0 turns off file splitting. (default: smax=2000)
-C idlen=n Set the maximum length of C identifiers to be n. Using -C idlen=0 turns off identifier truncation. (default: idlen=32)
-C [no-]idhash (Do not) use hash codes in global C identifiers. (default: idhash)
-C [no-]lines Preserve Aldor source line numbers in generated C. (default: no-lines)
-C sys=name Pass -Wsys=name to the C compiler and linker. This option is interpreted by unicl to select a group of options defined in its configuration file aldor.conf. It also prepends to the list of library directories a modified list in case there is a special implementation for the particular name. This is of great help when making libraries for specific flavours of CPU.
-C runtime=id1,... Select a list of libraries libid1.a, libid2.a etc. that implement the runtime system. Default is foam.
-C fortran Pass -Wfortran to link driver unicl which enables fortran options such as fortran runtime libraries.
-C lib=name Link with the library libname.a


27.11 : Lisp code generation options

Control the behavior of -F lsp.
-S common Produce Common Lisp code (the default).
-S standard Produce Standard Lisp code.
-S scheme Produce Scheme code.
The options -Scommon, -Sstandard and -Sscheme are mutually exclusive.
-S ftype=ft Use ft as the file extension for the generated lisp file (default: "-Sftype=lsp").


27.12 : Message options

-M emax=n Stop after n error messages. (default: 10)
-M db=fn Use fn as the message database. (default: no-db)
-M msgname Turn on warning or remark named msgname. Use -Mname (described below) to find out the names of messages.
-M no-msgname Turn off warning or remark named msgname.
-M nControl how much detail is given. (default: -M2)
-M no-optTurn of -M opt.


M0M1M2M3
-M warnings Display warnings. NYYY
-M source Display the program lines for messages.NNYY
-M details Display details. NNYY
-M notes Display cross reference notes. NNYY
-M remarks Display remarks. NNNY
-M sort Sort messages by source position. YYYY
-M mactext Point to macro text, rather than use. YYYY
-M abbrev Abbreviate types in messages. YYYY
-M human Human-oriented format. YYYY
-M name Show the name of each message as well as the message itself.NNNN
-M antiques Display warnings for old-style code. NNNN
-M preview Display messages as they occur. NNNN
-M inspect Use interactive inspector for errors. NNNN

27.13 : Developer options

Developer options (subject to change):
-W check Turn on internal safety checks.
-W runtime Produce code suitable for the runtime system.
-W nhash Assume all exported types have constant hashcodes.
-W loops Always inline generators when possible.
-W missing-ok Do not stop the compiler if an export is missing in a domain.
-W audit Set maximum Foam auditing level.
-W trap Trap failure exits (for debugging Aldor).
-W gc Garbage collect as needed (if gc is available).
-W gcfile Garbage collect after each file (if gc is available).
-W sexpr Run a read-print loop.
-W seval Run a read-eval-print loop.
-W test=name Run compiler self-test name. Use -W test+show to see a list of self-tests.
-W D+name Turn on debug hook name. Use -W D+show to see a list of debug hooks.
-W D-name Turn off debug hook name. Use -W D+show to see a list of debug hooks.
-W Tapdrgst0+ph Phase tracing: Several phases can be given as "ph1+ph2+ph3" or "all". Several options can be given at once, e.g. "-WTags+all". Compile a file with "-v" to see the phase abbreviations. The remaining options give more details about the trace code letters.
-WTa+phAnnounce entry to ph.
-WTp+phPretty print result of ph.
-WTd+phPrint debug information for ph.
-WTr+phShow result of ph.
-WTg+phGarbage collect after ph.
-WTs+phStorage audit after ph.
-WTt+phTerminate after ph.
-WT0+phIgnore earlier -WT option for ph.


27.14 : Environment variables

Sometimes there are certain aspects of the compiler's behaviour which you may wish to change for most of your compilations.
Most operating systems have some notion of environment variables and the Aldor compiler checks a number of these to guide its actions. None of these needs to be defined, but if they are the Aldor compiler will use them.
ALDORROOT This gives a directory under which the compiler will find its own include files, libraries, etc.
ALDORARGS This provides options to the compiler which are treated before those appearing on the command line.
INCPATH This gives the compiler additional places to search for include files. The syntax is according to the operating system's conventions.
For example, on Unix a suitable initialization could be
  setenv INCPATH "/u/jane/myincludes:.:/usr/applications/include"
  
This has the same effect as using the command line options
  -I/u/jane/myincludes -I. -I/usr/applications/include
  
LIBPATH This gives the compiler additional places to search for libraries.
CC This gives the Aldor compiler the name of a C compiler which it should call to generate and link object code. The default is unicl -- a program provided in the Aldor distribution to convert C compile command lines to the native system syntax.
CGO This gives the Aldor compiler the name of a loader which it should call to run an executable program it has generated. On most platforms no explicit loader is needed.
Sometimes you will wish to specify CC and CGO together. For example on DOS using the djgpp port of GCC, a useful combination is
  set CC=gcc
  set CGO=go32
  


Previous Home Contents Next