WebFortran has a limited set of options to pass to the compiler. While our backend uses a standard compiler, only certain options are available from WebFortran.

Options Controlling Your WebFortran Account

--login

Connect this instance of the WebFortran Command Line Interface to your WebFortran account. In order for this compiler to function, the user must first login to their account. Once completed, the compiler will work like any other native compiler, and the user will not have to perform this step again.

--reset

Disconnect this instance of the WebFortran Command Line Interface from your WebFortran account. This feature will reset the interface such that logging in again will work correctly, erasing any previous sessions.

Options Controlling Compiler Output

-c

Compile the file only, but do not perform the linking step. When included, the compiler will return an object file for the requested platform/architecture. If the Fortran source code included any module statements, intermediate module interface files will also be generated.

-o <filename>

Write the compiler output the specified filename. By default, the compiler will write the output to an object file or executable with the same base name as the first input file, but with the appropriate extension. This option overrides the behavior, writing to the filename argument instead.

Options Controlling Search Paths

-J<path>

Use the specified path to both search for and output module interface files generated by the compiler. This option provides the same functionality as the -I<path> option, but it also instructs the compiler to store any generated module interface files in the specified <path>.

-I<path>

Add the specified path to the list of directories searched for needed module interface files and files referenced by Fortran's INCLUDE statement. When multiple paths are specified by this option or the -J<path> option, they are searched in order of their appearance on the command line. Currently, WebFortran does not support using the C preprocessor; preprocessor directives, notably #include will generate an error.

Options Controlling Code Generation

-O<n>

Enable the specified level of optimizations. The value of n can range from 0, or no optimizations, to 3, or maximum optimizations. Because level 3 optimizations can introduce unsafe math operations, generally optimization level 2 is utilized for performance.

-g

Enable the generation of debugging information. The resulting object or executable will include information about variables, procedures, and source code to allow the use of a debugger, such as the GNU Debugger or Simply Fortran's built-in debugger.

--runtime-diagnostics

Turn on certain runtime diagnostics features. When enabled, certain bounds violations, format errors, and other common Fortran bugs will cause the compiled code to terminate with a message explaining the issue along with the location in the code.

--sys <architecture:os>

Compile for the specified architecture and operating system combination. The WebFortran compiler supports a selection of target systems. By default, the compiler generate code for the native system upon which it is running, if possible. For a list of supported systems, run the command webfortran --help.

Options Controlling the Fortran Dialect

--legacy

Enable support for legacy Fortran standards or features. This flag generally instructs the compiler to allow pre-Fortran-90 features to be used, some of which have been deprecated or removed entirely in recent standards. While usually unnecessary, this flag may eliminate some issues encountered with older code.

--fixed-format-length <n>

Set the fixed format line length to a nonstandard value of n. This value is normally 72. The compiler will issue a warning for values smaller than the default.

--free-format-length <n>

Set the free format line length to a nonstandard value of n. This value is normally 132. The compiler will issue a warning for values smaller than the default.

--init-locals-zero

Initialize all local variables to zero (or equivalent, depending on type). Some legacy Fortran source code assumes variables are initialized to zero, though the standard does not specify initial values. By default, variables will contain meaningless values before initial assignment.

--implied-save

Local variables in all procedures will assume a SAVE attribute added to all variable declarations. Some legacy Fortran code assumes variables in procedures hold values that persist between procedure calls. By default, local variables in procedures without the SAVE attribute in their declaration should be assumed to be uninitialized upon entry into said procedure.

Options Controlling Libraries and Linking

-L<path>

Add the specified path to the list of directories for which to search for library files. The current directory is already searched by default. On Linux hosts when cross-compiling is not being employed, the directories /usr/local/lib and /usr/lib are also searched by default.

-l<library name>

Link to the specified library. The compiler will search the list of search directories specified by the -L<path> flag as well as the current directory and, on Linux hosts using native compiling only, /usr/local/lib and /usr/lib. The compiler assumes the library file will be named exactly lib<library name>.a when searching for the file.

--lapack

Link with both BLAS and LAPACK libraries, common in number-crunching Fortran codes. This option will cause the compiler to link to hosted, pre-built BLAS and LAPACK distributions. On Windows, the option uses a highly optimized version of OpenBLAS. On all other platforms, the reference LAPACK and BLAS libraries are used.

Options Controlling the Optional Preprocessor

--pp

Enable the preprocessor for all passed source files. By default, only files with capitalized file extensions will be passed through the preprocessor, but this compiler flag will trigger preprocessing for all files.

--no-pp

Disable the preprocessor for all passed source files. By default, only files with capitalized file extensions will be passed through the preprocessor, but this compiler flag will disable the preprocessing of all files, including those with capitalized extensions.

-D<label>
-D<label>=<value>

Define a macro to be used during preprocessing. The label can be assigned a value. Otherwise, the label is assigned a value of 1.

Options for Requesting Assistance

-h
--help

Display help information on the command line. This option will present a summary of options available and the list of currently supported architectures.

--docs

Opens the WebFortran Command Line Interface home page in the system's default web browser.