-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.25 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.25 KB
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
48
49
50
51
52
53
54
55
FC = gfortran
# If not mods in current path, use mkdir -p mods
MODDIR = mods
FLAGS = -O3 -I$(MODDIR) -J$(MODDIR)
# Path to the heasfot
HEADAS = /data/heasoft/heasoft-6.31.1/x86_64-pc-linux-gnu-libc2.17/
# Please find specific version of these lib
LIBS = $(HEADAS)/lib/libcfitsio.so \
$(HEADAS)/lib/libxanlib_6.31.so \
$(HEADAS)/lib/libape_2.9.so \
-lm -lc -fopenmp
NAME = dao
CODE = $(NAME).f90
EXEC = $(NAME).x
MODSRC = global
MOD_F90 = $(shell find $(MODSRC) -name '*.f90')
MODOBJ = $(MOD_F90:.f90=.o)
SRCDIR = modellib
SRC_F90 = $(shell find $(SRCDIR) -name '*.f90')
SRC_F = $(shell find $(SRCDIR) -name '*.f')
SRC_OBJ = $(SRC_F90:.f90=.o) $(SRC_F:.f=.o)
OBJECTS = $(MODOBJ) $(SRC_OBJ) $(NAME).o
$(EXEC): $(OBJECTS)
$(FC) $(FLAGS) $(LIBS) -o $@ $^ $(EXT_LIBS)
@echo "Compilation successful: $(EXEC) has been built."
$(MODSRC)/%.o: $(MODSRC)/%.f90
$(FC) $(FLAGS) -c $< -o $@
# Subroutine
$(SRCDIR)/%.o: $(SRCDIR)/%.f90 $(MODOBJ)
$(FC) $(FLAGS) -c $< -o $@
$(SRCDIR)/%.o: $(SRCDIR)/%.f $(MODOBJ)
$(FC) $(FLAGS) -c $< -o $@
# Main
$(NAME).o: $(CODE) $(MODOBJ)
$(FC) $(FLAGS) -c $< -o $@
# Clean
clean:
find $(MODSRC) -name '*.o' -delete
find $(MODSRC) -name '*.mod' -delete
find $(SRCDIR) -name '*.o' -delete
rm $(NAME)*.o $(NAME)*.x