-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (38 loc) · 1.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FC=gfortran
CFLAGS=-O3 -c
LDFLAGS=-L. -I. -O3
LDLIBS=-lfortranmodules
MODULES=mod_Kinds.o mod_Sorting.o mod_Random.o mod_Timers.o mod_LUdcmp.o mod_Cmdline.o
# target: libraries - Compilates modules and creates large static library
libraries: libfortranmodules.a
# target: example - Compiles and runs the test program
example: test
@echo
@echo =======================================
@echo = Running example to test all modules =
@echo =======================================
@./test option1 option2 option3
# target: test - Creates simple program to test modules
test: test.f90 libfortranmodules.a
$(FC) $(LDFLAGS) -o $@ $^
libfortranmodules.a: $(MODULES)
$(AR) cr $@ $(MODULES)
mod_Kinds.o: mod_Kinds.f03
$(FC) $(CFLAGS) $<
mod_Sorting.o: mod_Sorting.f90 mod_Kinds.o
$(FC) $(CFLAGS) $<
mod_Random.o: mod_Random.f03 mod_Kinds.o
$(FC) $(CFLAGS) $<
mod_Timers.o: mod_Timers.f03 mod_Kinds.o
$(FC) $(CFLAGS) $<
mod_LUdcmp.o: mod_LUdcmp.f90 mod_Kinds.o
$(FC) $(CFLAGS) $<
mod_Cmdline.o: mod_Cmdline.f03
$(FC) $(CFLAGS) $<
# target: clean - Removes intermediate and object files
clean:
rm -f *.o *.mod test *a
# target: help - Display callable targets.
help:
@egrep "^# target:" [Mm]akefile
.PHONY: clean help example