-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
96 lines (76 loc) · 2.52 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#---------------------------------------------------------------
# Directories Of the project
#---------------------------------------------------------------
SRCDIR=src
OBJDIR=obj
EXECDIR=exec
DATADIR=data
MODSDIR=mods
IMGDIR=images
EXE=$(EXECDIR)/HLLC
VPATH=$(SRC):$(OBJ):$(EXEC)
FFLAGS= -U -03
FC=gfortran $(FFLAGS)
OBJ=\
parameters.o\
globals.o\
hydrocore.o\
utilities.o\
init.o\
boundaries.o\
hllc.o\
solver.o
MAIN=$(OBJDIR)/main.o
OBJS=$(patsubst %.o, $(OBJDIR)/%.o, $(OBJ))
SRCS=$(patsubst $(OBJDIR)/%.o, $(SRCDIR)/%.f03, $(OBJS))
MODS=$(patsubst $(OBJDIR)/%.o, $(MODSDIR)/%.mod, $(OBJS))
.PHONY= all run rerun clean plot gif compilingMessage
all: compile run plot gif
rerun: all | clean
compile: compilingMessage $(EXE)
$(EXE): $(OBJS) $(MAIN) | $(MODS) $(EXECDIR) $(MODSDIR)
@$(FC) -I$(MODSDIR) $^ -o $@
$(MAIN): $(patsubst $(OBJDIR)/%.o, $(SRCDIR)/%.f03, $(MAIN))
@echo "Compiling " $^ " ..."
@$(FC) -I$(MODSDIR) -c $< -o $@
$(MODSDIR)/%.mod $(OBJDIR)/%.o: $(SRCDIR)/%.f03 | $(OBJDIR) $(MODSDIR)
@echo "Compiling " $^ " ..."
@$(FC) -J$(MODSDIR) -c $< -o $@
$(OBJDIR) $(MODSDIR) $(EXECDIR) $(DATADIR) $(IMGDIR):
@mkdir $@
compilingMessage:
@echo "=========================================================="
@echo "Compiling the source files"
@echo "=========================================================="
run: $(EXE) | $(DATADIR)
@echo "=========================================================="
@echo "Excecuting the program"
@echo "=========================================================="
ifneq ("$(wildcard $(DATADIR)/*)","")
rm $(DATADIR)/*
endif
ifneq ("$(wildcard $(IMGDIR)/*)","")
rm $(IMGDIR)/*
endif
@$<
@mv *.dat $(DATADIR)
plot: $(DATADIR) $(IMGDIR)
@echo "=========================================================="
@echo "Generating images of the data"
@echo "=========================================================="
@for file in $(DATADIR)/*.dat; do \
python $(SRCDIR)/plotter.py $$file ;\
echo "ploted: " $$file ;\
mv $(DATADIR)/*.png $(IMGDIR);\
done
gif:
@echo "=========================================================="
@echo "Generating animation of the data"
@echo "=========================================================="
@convert -delay 15 -loop 0 $(IMGDIR)/*.png simulation.gif
@echo "Done."
clean: $(OBJDIR) $(MODSDIR) $(EXECDIR) $(DATADIR) $(IMGDIR)
@echo "=========================================================="
@echo "Cleaning the project"
@echo "=========================================================="
@rm -R $(OBJDIR) $(MODSDIR) $(EXECDIR) $(DATADIR) $(IMGDIR)