-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (55 loc) · 1.75 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
# The compiler
FC = gfortran-5
CC = gcc
# flags for debugging or for maximum performance, comment as necessary
FCFLAGS = -Og -g -I$(INC) -J$(INC) -fPIC
LDFLAGS = -Og -g
# ifort flags:
#FCFLAGS = -g -O0 -traceback -check all -assume realloc_lhs
#FCFLAGS = -O3
# flags forall (e.g. look for system .mod files, required in gfortran)
#FCFLAGS += -I/usr/include
# libraries needed for linking, unused in the examples
#LIBS = -L. -lpolycon
# List of executables to be built within the package
SDIR = src
INC = mod
ODIR = obj
OUTSHARED = libpolycon.so
OUTSTATIC = libpolycon.a
_OBJS = abstract_container_mod.o container_mod.o
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
# "make" builds all
shared: init $(OBJS)
$(FC) -shared -o $(OUTSHARED) $(filter-out init,$^) $(LDFLAGS)
static: init $(OBJS)
ar rcs $(OUTSTATIC) $(filter-out init,$^)
$(OUTSTATIC): static
test: $(OUTSTATIC) $(ODIR)/tests/container_test.o
$(FC) -o $@ $(filter-out $(OUTSTATIC),$^) $(OUTSTATIC) $(LDFLAGS)
stack: init $(OBJS) $(ODIR)/tests/stack.o
$(FC) -o $@ $(filter-out init,$^) $(LDFLAGS)
#$(ODIR)/tests/stack.o: $(SDIR)/tests/stack.f90 $(OBJS)
# $(FC) $(FCFLAGS) -fpic -o $@ -c $<
$(ODIR)/tests/container_test.o: $(SDIR)/tests/container_test.f90 $(OBJS)
$(FC) $(FCFLAGS) -fpic -o $@ -c $<
%: $(ODIR)/%.o
$(FC) $(FCFLAGS) -o $@ $^ $(LDFLAGS)
$(ODIR)/%.o: $(SDIR)/%.f
$(FC) $(FCFLAGS) -o $@ -c $<
$(ODIR)/%.o: $(SDIR)/%.F
$(FC) $(FCFLAGS) -o $@ -c $<
$(ODIR)/%.o: $(SDIR)/%.f90
$(FC) $(FCFLAGS) -o $@ -c $<
$(ODIR)/%.o: $(SDIR)/%.F90
$(FC) $(FCFLAGS) -o $@ -c $<
$(ODIR)/%.o: $(SDIR)/%.f95
$(FC) $(FCFLAGS) -o $@ -c $<
$(ODIR)/%.o: $(SDIR)/%.F95
$(FC) $(FCFLAGS) -o $@ -c $<
clean:
/bin/rm -rf $(ODIR)/*.o ./tmp $(INC)/*.mod test
init:
mkdir -p $(ODIR)
mkdir -p $(ODIR)/tests
mkdir -p $(INC)