-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
87 lines (72 loc) · 2.03 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
##################################################
#
# SIMPLE Makefile to build the Fortran SPH code
# from the book Smoothed Particle Hydrodynamics
# a meshfree particle method by Liu & Liu (2003)
# with the GNU compiler on Linux (gfortran).
# Again, a SIMPLE Makefile.
#
# Author: Ryan Clement
#
# Date: March 2020
#
##################################################
.SUFFIXES : .o .f90 .f
# DIRECTORIES
SRCDIR = source
BLDDIR = build
DATDIR = data
MOVDIR = movies
# ensure that the build and data directories exist...
$(shell mkdir -p $(BLDDIR))
$(shell mkdir -p $(DATDIR))
$(shell mkdir -p $(MOVDIR))
# Compiler
FC = gfortran
FCFLAGS = -I. -O3 -w
# Program
MAIN = sph.x
# Source Files
FSRCS = art_heat.f art_visc.f av_vel.f density.f direct_find.f eos.f
FSRCS += external_force.f grid_geom.f hsml.f init_grid.f input.f
FSRCS += internal_force.f kernel.f link_list.f output.f single_step.f
FSRCS += sph.f time_integration.f virt_part.f viscosity.f
F90SRCS = time_elapsed.f90 time_print.f90
#$(info $(FSRCS)) # Uncomment to print *.f files.
#$(info $(F90SRCS)) # Uncomment to print *.f90 files.
# Include Files
FINCS = $(SRCDIR)/param.inc
# Object Files
FOBJS = $(FSRCS:.f=.o)
F90OBJS = $(F90SRCS:.f90=.o)
FOBJS := $(addprefix $(BLDDIR)/, $(FOBJS))
F90OBJS:= $(addprefix $(BLDDIR)/, $(F90OBJS))
#$(info $(FOBJS)) # Uncomment to print *.f files.
#$(info $(F90OBJS)) # Uncomment to print *.f90 files.
# Add dir to srcs
#FSRCS := $(addprefix $(SRCDIR)/,$(FSRCS))
.PHONY: all
all: $(FOBJS) $(F90OBJS) $(FINCS)
@echo Compiled all files...
$(FC) $(FCFLAGS) -o $(MAIN) $(FOBJS) $(F90OBJS)
# Compile Rules
$(FOBJS) : $(BLDDIR)/%.o : $(SRCDIR)/%.f
$(FC) $(FCFLAGS) -c $< -o $@
$(F90OBJS) : $(BLDDIR)/%.o : $(SRCDIR)/%.f90
$(FC) $(FCFLAGS) -c $< -o $@
.PHONY: clean
clean:
rm -f $(BLDDIR)/*.o
rm -f sph.x
.PHONY: cleaner
cleaner:
rm -f $(BLDDIR)/*.o
rm -f $(DATDIR)/*.dat
rm -f sph.x
.PHONY: sanitary
sanitary:
rm -rf $(BLDDIR)
rm -rf $(DATDIR)
rm -rf $(MOVDIR)
rm -f sph.x