On Mar 21, 7:39 am, "tuli" <tuli.herscov@gmail.com> wrote:
> Hello,
> I never have to use MAKE. In all the documentation I checked it is
> assumed the the reader knows how to use it.
> I feel stupid but I have to ask:
> How to use MAKE? I understand it works like a script but:
> 1. Does it work only in a DOS window (i.e. have to use 'cmd' and
> navigate to the directory where the MAKE file is)
> 2. what is the syntax for the command? (i.e. MAKE MAKE_FILE ? - tried
> that and it does not work)
I use Microsoft's NMAKE. One advantage it has is not requiring tabs in
make files. Here is my procedure, done at the Windows command line
(cmd).
(1) Create a text file listing the Fortran sources needed to build a
program, one per line, with files containing modules preceding those
that use the modules. For example, it could look like
foo.f90
xfoo.f90
(2) Create a make file that looks as follows. I have a Python program
that does this. With minor modifications it will work with other
compilers -- the opt variable will be different, and most commercial
compilers name object files with the .obj rather than .o extension.
exec = mat_g95mak.exe
obj = foo.o xfoo.o
opt = -Wall -Wextra -ftrace=full -fbounds-check -freal=nan
all: clean run
.f90.o:
g95 -c $(opt) $*.f90
$(exec): $(obj)
g95 -o $(exec) $(opt) $**
compile: $(exec)
echo $(exec) created
run: $(exec)
$(exec)
clean:
if exist $(exec) del $(exec)
This does NOT check for module dependencies, unfortunately.
(3) To compile and run the program, issue the command
nmake /nologo /f make_foo.txt
where make_foo.txt is the file created in the previous step.
To compile but not run, replace
all: clean run
with
all: clean compile