Generating the Makefile

If a project has been saved, the user can explicitly generate a makefile for a project via the Generate Makefile command in the Build menu . Alternatively, the makefile generation procedure will be performed whenever the user executes any of the other build procedures , as these other procedures rely on the existence of a makefile.

Internal Procedure

When the makefile is being generated, Simply Fortran scans all project files to determine the interdependencies of any Fortran 90 (or higher) files. Because Fortran files containing modules relied on by other files must be compiled first, Simply Fortran generates a makefile that explicitly requires necessary modules and their source files to be compiled first.

Additionally, Simply Fortran also scans Fortran files for INCLUDE statements. The include statement pulls the contents of another file into the file containing the INCLUDE statement. If an included file is part of the current project, it is added as a dependency to the file containing the INCLUDE statement. If the included file is not explicitly contained in the project, the file is not marked as a dependency for the originating source file. This procedure allows changes in included project files to properly trigger rebuilding source files which INCLUDE the changed file, but it avoids unnecessarily complicating the build process with static extra-project file dependencies.

Using the Makefile Outside of Simply Fortran

The generated makefile can be used outside of the Simply Fortran environment to build projects as well. The makefile is kept after any build procedure. To construct a project with a makefile externally, the make command is:

make all

or, alternatively,

wmake all

The makefile that Simply Fortran generates should be compatible with almost any modern make implementation. The makefile, however, is tailored to the specific compiler location .

Automatic Makefile Generation

By default, makefiles are only generated when they do not yet exist or the user explicitly commands their generation. However, Simply Fortran can automatically regenerate the makefile every time a build is initiated in order to capture any changes in the project structure or individual file dependencies. Automatic regeneration of makefiles can be enabled in the Project Options dialog.

See Also

Building in Simply Fortran
Make and Makefile Options