Example 2 hello.f90

PROGRAM main

CALL hello()

END PROGRAM main

SUBROUTINE hello()

PRINT *, 'Hello, I must be going.'

END SUBROUTINE hello

When compiled with the command line:

$ f90 hello.f90

f90 produces two files, hello.o (object code) and a.out(the executable program).

If the command line contains only an object file, as in the following:

$ f90 hello.o

f90passes the object file to the linker, which (if successful produces the executable program a.out.

Here is a sample run of the executable program:

$ a.out

Hello, I must be going.

This section provides more detailed information about using the f90 command, including:

Command-line syntax

Command-line options

Filenames recognized by f90

f90 command syntax

The syntax for using the f90command is:

f90 [options][files]

where options is a list of one or more command-line options andfilesis a list of one or more files containing HP Fortran source code to be compiled or object code to be linked. Items in options and files can be interspersed on the command line, separated by spaces. However, some options are order-sensitive. For example, the -l option, which is used to specify a library for linking, must follow the program file to which it will be linked.

For information about using the-loption, see “Linking to nondefault libraries” (page 52). For more information about the f90command line, see HP Fortran Programmer’s Reference.

Command-line options

Command-line options enable you to override the default behavior of the f90command. Some options affect how files are compiled or linked; for example, the -Ooption requests optimization. Other options may cause the f90 command to skip a process entirely; for example, the -coption compiles without linking. And still others invoke processes other than the default ones; for example, the +cpp=yes option causes the f90 command to send source files to the C preprocessor (cpp) before compiling. (For information about using cpp, see “Using the C preprocessor” (page 60).)

Command-line options enable you to override the default behavior of the f90 command. Some options affect how files are compiled or linked; for example, the -Ooption requests optimization. Other options may cause the f90command to skip a process entirely; for example, the -coption compiles without linking. And still others invoke processes other than the default ones; for example, the +cpp=yes option causes the f90 command to send source files to the C preprocessor (cpp) before compiling. (For information about using cpp, see “Using the C preprocessor” (page 60).)

Many options are of the form +[no]option, where +option enables the option’s functionality and +nooption disables it. Other options have more than just an on or off state; these are of the

Command-line options 19