forked from eiscor/eiscor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (69 loc) · 2.37 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
97
98
99
100
101
102
103
104
105
include make.inc
UTILDIR := ./src/utilities
ISRCDIR := ./src/integer
DSRCDIR := ./src/double
ZSRCDIR := ./src/complex_double
USRCS := $(wildcard $(UTILDIR)/*.f90)
UOBJS := $(patsubst $(UTILDIR)/%.f90,$(UTILDIR)/%.o,$(wildcard $(UTILDIR)/*.f90))
ISRCS := $(wildcard $(ISRCDIR)/*.f90)
IOBJS := $(patsubst $(ISRCDIR)/%.f90,$(ISRCDIR)/%.o,$(wildcard $(ISRCDIR)/*.f90))
DSRCS := $(wildcard $(DSRCDIR)/*.f90)
DOBJS := $(patsubst $(DSRCDIR)/%.f90,$(DSRCDIR)/%.o,$(wildcard $(DSRCDIR)/*.f90))
ZSRCS := $(wildcard $(ZSRCDIR)/*.f90)
ZOBJS := $(patsubst $(ZSRCDIR)/%.f90,$(ZSRCDIR)/%.o,$(wildcard $(ZSRCDIR)/*.f90))
DEXDIR := ./examples/double
ZEXDIR := ./examples/complex_double
DEXSRCS := $(wildcard $(DEXDIR)/*.f90)
DEXS := $(patsubst $(DEXDIR)/%.f90,$(DEXDIR)/%,$(wildcard $(DEXDIR)/*.f90))
ZEXSRCS := $(wildcard $(ZEXDIR)/*.f90)
ZEXS := $(patsubst $(ZEXDIR)/%.f90,$(ZEXDIR)/%,$(wildcard $(ZEXDIR)/*.f90))
DTESTDIR := ./tests/double
ZTESTDIR := ./tests/complex_double
DTESTSRCS := $(wildcard $(DTESTDIR)/*.f90)
DTESTS := $(patsubst $(DTESTDIR)/%.f90,$(DTESTDIR)/%,$(wildcard $(DTESTDIR)/*.f90))
ZTESTSRCS := $(wildcard $(ZTESTDIR)/*.f90)
ZTESTS := $(patsubst $(ZTESTDIR)/%.f90,$(ZTESTDIR)/%,$(wildcard $(ZTESTDIR)/*.f90))
all: lib$(LIBNAME).so.$(VERSION)
examples: $(DEXS) $(ZEXS)
tests: $(DTESTS) $(ZTESTS)
lib$(LIBNAME).so.$(VERSION): $(UOBJS) $(IOBJS) $(DOBJS) $(ZOBJS)
$(FC) $(FFLAGS) -shared -o lib$(LIBNAME).so.$(VERSION) $(UOBJS) $(IOBJS) $(DOBJS) $(ZOBJS)
$(UOBJS): $(USRCS)
make -C $(UTILDIR)
$(USRCS):
$(IOBJS): $(ISRCS)
make -C $(ISRCDIR)
$(ISRCS):
$(DOBJS): $(DSRCS)
make -C $(DSRCDIR)
$(DSRCS):
$(ZOBJS): $(ZSRCS)
make -C $(ZSRCDIR)
$(ZSRCS):
$(DEXS): $(DEXSRCS) install
make -C $(DEXDIR)
$(DEXSRCS):
$(ZEXS): $(ZEXSRCS) install
make -C $(ZEXDIR)
$(ZEXSRCS):
$(DTESTS): $(DTESTSRCS) install
make -C $(DTESTDIR)
$(DTESTSRCS):
$(ZTESTS): $(ZTESTSRCS) install
make -C $(ZTESTDIR)
$(ZTESTSRCS):
install: lib$(LIBNAME).so.$(VERSION)
mkdir -p $(INSTALLDIR)/$(LIBNAME)/lib &&\
cp ./lib$(LIBNAME).so.$(VERSION) $(INSTALLDIR)/$(LIBNAME)/lib
uninstall: clean
rm -rf $(INSTALLDIR)/$(LIBNAME)
clean:
make clean -C $(UTILDIR) &&\
make clean -C $(ISRCDIR) &&\
make clean -C $(DSRCDIR) &&\
make clean -C $(ZSRCDIR) &&\
make clean -C $(DEXDIR) &&\
make clean -C $(ZEXDIR) &&\
make clean -C $(DTESTDIR) &&\
make clean -C $(ZTESTDIR) &&\
rm -f lib$(LIBNAME).so.$(VERSION)