-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.23 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
SRCDIR = src
TARGET1 = libcmils.so
SRCS1 = $(SRCDIR)/gfunc/cmils.f90 $(wildcard $(SRCDIR)/lib/**/*.f)
OBJS1 = $(addsuffix .o, $(basename $(SRCS1)))
TARGET2 = libils.so
SRCS2 = $(SRCDIR)/gfunc/ils.f90 $(wildcard $(SRCDIR)/lib/**/*.f)
OBJS2 = $(addsuffix .o, $(basename $(SRCS2)))
TARGET3 = libics.so
SRCS3 = $(SRCDIR)/gfunc/ics.f90 $(wildcard $(SRCDIR)/lib/**/*.f)
OBJS3 = $(addsuffix .o, $(basename $(SRCS3)))
FC = gfortran
#FC = ifort
FFLAGS =
LDFLAGS =
LIBS =
SOFLAGS = -shared
# for gfortran
ifeq ($(FC),gfortran)
FFLAGS += -fPIC -fopenmp
FFLAGS += -O3 -fall-intrinsics
LIBS += -llapack -lblas
endif
# for ifort
ifeq (${FC},ifort)
FFLAGS += -fpic -fast
LIBS += -qmkl -qopenmp
endif
all: $(TARGET1) $(TARGET2) $(TARGET3)
$(TARGET1) : $(OBJS1)
$(FC) $(SOFLAGS) $(FFLAGS) $(LDFLAGS) $(LIBS) -o $@ $^
@echo $@ created!
$(TARGET2) : $(OBJS2)
$(FC) $(SOFLAGS) $(FFLAGS) $(LDFLAGS) $(LIBS) -o $@ $^
@echo $@ created!
$(TARGET3) : $(OBJS3)
$(FC) $(SOFLAGS) $(FFLAGS) $(LDFLAGS) $(LIBS) -o $@ $^
@echo $@ created!
%.o:%.f90
$(FC) $(FFLAGS) $(LDFLAGS) $(LIBS) -o $@ -c $<
%.o:%.f
$(FC) $(FFLAGS) $(LDFLAGS) $(LIBS) -o $@ -c $<
.PHONY: clean
clean:
$(RM) $(TARGET1) $(OBJS1) $(TARGET2) $(OBJS2) $(TARGET3) $(OBJS3) *.mod
test:
@echo $(SRCS1)