FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


WRITE MAKEFILE

Syntax:

[DO NOT] MAKE MAKEFILE

[DO NOT] WRITE MAKEFILE

MKMF

Function:

FPT writes a Makefile for the program(s) in the project. The Makefile contains compilation and linking commands and describes the dependencies on include files and Fortran modules. The Makefile is named "Makefile" and has no file name extension. The format is compatible with gnu make. It is written to the primary output directory.

Compilation switches for the primary Fortran files may optionally be specified in the fsp file. The file name may be followed by the keyword FCFLAGS= followed by the compilation switches written as a quoted string. The switches may be specified explicitly or as a symbol, for example:

ball_main.f90		FCFLAGS="-c -O0"
ball_dynamic.f90	FCFLAGS="$(FLAGS_OPTIMISE)"
If no specification is made for the compilation flags, FPT uses the default symbolic name "$(FCFLAGS)"

The Makefile begins with an include statement for the file compiler.make. This file is supplied by the user and contains:

Where to use this command:

Operating system command line

Yes


Configuration file, config.fsp

Yes


Specification (FSP) files, *.fsp

Yes


Interactively, to FPT> prompt:

Yes


Interactive command files

Yes


Embedded in the Fortran code

Yes


Default:

A Makefile is not generated by default (Note that defaults may be changed in the configuration file).

Example:

The file ball.fsp is set up for a model of a cannon ball. There are four primary files, three of which, ball_init.f90, ball_dynamic.f90 and ball_terminal.f90 include two INCLUDE files.

! ball.fsp		13-Jan-14		John Collins
 
% input directory ..\original_source
% primary input file name extension: ".f90"
% include input file name extension: ".i90"
% free format input
 
ball_main.f90		FCFLAGS="-c -O0"
ball_init.f90
ball_dynamic.f90	FCFLAGS="$(FLAGS_OPTIMISE)"
ball_terminal.f90
 
% free format output
% lower case symbols
% space before "::"
% space after "::"
% space before "="
% space after "="
 
% keep file name extensions
% output directory ..\build
% overwrite changed files
% make makefile
 
! End of ball.fsp

Note that compilation flags are specified explicitly for ball_main.f90 and symbolically for ball_dynamic.f90. The fsp file contains the command % make makefile.

The Makefile generated is shown below:

# *****************************************************************************
# File: ..\BUILD\\Makefile
# Output by FPT 3.8-b Win32  On 13-JAN-14  At 15:32:05
# Licensee:  SimCon: Development version.
# *****************************************************************************
 
include compiler.make
 
ball_main.exe: \
	 ball_main.o \
	 ball_init.o \
	 ball_dynamic.o \
	 ball_terminal.o
	$(LN) -o ball_main.exe \
	 ball_main.o \
	 ball_init.o \
	 ball_dynamic.o \
	 ball_terminal.o \
	 $(ADDITIONAL_OBJECTS)
 
ball_main.o: ball_main.f90
	$(FC) -c -O0 $<
 
ball_init.o: ball_init.f90 \
	 ic.i90 \
	 coords.i90
	$(FC) $(FCFLAGS) $<
 
ball_dynamic.o: ball_dynamic.f90 \
	 ic.i90 \
	 coords.i90
	$(FC) $(FLAGS_OPTIMISE) $<
 
ball_terminal.o: ball_terminal.f90 \
	 ic.i90 \
	 coords.i90
	$(FC) $(FCFLAGS) $<
 
 
# End of Makefile *************************************************************

Note that the dependencies of the executable on the objects and of the objects on the INCLUDE files are represented. FPT also tracks USE dependencies on and between Fortran modules.

The file compiler.make is supplied by the user. In this case it is:

# compiler.make				14-Jan-14		John Collins
# =============================================================================
 
LN 		= gfortran
FC 		= gfortran
 
# Default value of flags
FCFLAGS    = -c -O0 -ffree-form
 
FLAGS_OPTIMISE = -c -O3 -ffree-form
 
# end of compiler.make ========================================================


Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.