Joined: 29 Nov 2006
|Posted: Tue Sep 07, 2004 9:54 pm Post subject: Compiling multiple source files using batch files
This article outlines a simple method of developing a project using DOS batch files allowing for global and non-global compiler switches.
This method uses two batch files. One called comp.bat, containing the one line:
ftn95 %1 %2 %3 %4 %5 %6 %7 %8 %9 [plus any global options e.g. /CHECK]
and another, called compall.bat, which is simply a list of the files to be compiled using comp.bat thus:
comp file3.f95 [plus options relating to a particular file e.g. /INTL]
An easy way to create this file is to type
|dir *.for /b > compall.bat |
then edit the newly created compall.bat and put 'comp' before each filename in the file.
This will give you total control over the switches and options applied to the compilation of each of the files.
To compile all your code you can now simply type COMPALL at the MS-DOS Command Prompt
Note that you will still need to link the object code produced from the compilation. An easy way to do this is to use a SLINK command script. See the Users Guide for more information on this.