-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
110 lines (88 loc) · 3.07 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
106
107
108
109
110
# See our wiki for getting the CalculiX dependencies:
# https://github.com/precice/calculix-adapter/wiki/Installation-instructions-for-CalculiX
# Set the following variables before building:
# Path to original CalculiX source (e.g. $(HOME)/ccx_2.15/src )
CCX = $(HOME)/PathTo/CalculiX/ccx_2.15/src
# Path to SPOOLES main directory (e.g. $(HOME)/SPOOLES.2.2 )
SPOOLES = $(HOME)/PathTo/SPOOLES
# Path to ARPACK main directory (e.g. $(HOME)/ARPACK )
ARPACK = $(HOME)/PathTo/ARPACK
# Path to yaml-cpp prefix (e.g. $(HOME)/yaml-cpp, should contain "include" and "build")
YAML = $(HOME)/PathTo/yaml-cpp
# Get the CFLAGS and LIBS from pkg-config (preCICE version >= 1.4.0).
# If pkg-config cannot find the libprecice.pc meta-file, you may need to set the
# path where this is stored into PKG_CONFIG_PATH when building the adapter.
PKGCONF_CFLAGS = $(shell pkg-config --cflags libprecice)
PKGCONF_LIBS = $(shell pkg-config --libs libprecice)
# Specify where to store the generated .o files
OBJDIR = bin
# Includes and libs
INCLUDES = \
-I./ \
-I./adapter \
-I$(CCX) \
-I$(SPOOLES) \
$(PKGCONF_CFLAGS) \
-I$(ARPACK) \
-I$(YAML)/include
LIBS = \
$(SPOOLES)/spooles.a \
$(PKGCONF_LIBS) \
-lstdc++ \
-L$(YAML)/build -lyaml-cpp \
# OS-specific options
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LIBS += $(ARPACK)/libarpack_MAC.a
else
LIBS += $(ARPACK)/libarpack_INTEL.a
LIBS += -lpthread -lm -lc
endif
# Compilers and flags
#CFLAGS = -g -Wall -std=c++11 -O0 -fopenmp $(INCLUDES) -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE
#FFLAGS = -g -Wall -O0 -fopenmp $(INCLUDES)
CFLAGS = -Wall -O3 -fopenmp $(INCLUDES) -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE
# OS-specific options
ifeq ($(UNAME_S),Darwin)
CC = /usr/local/bin/gcc
else
CC = mpicc
endif
FFLAGS = -Wall -O3 -fopenmp $(INCLUDES)
FC = mpifort
# FC = mpif90
# FC = gfortran
# Include a list of all the source files
include $(CCX)/Makefile.inc
SCCXMAIN = ccx_2.15.c
# Append additional sources
SCCXC += nonlingeo_precice.c CCXHelpers.c PreciceInterface.c
SCCXF += getflux.f getkdeltatemp.f
# Source files in this folder and in the adapter directory
$(OBJDIR)/%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : %.f
$(FC) $(FFLAGS) -c $< -o $@
$(OBJDIR)/%.o : adapter/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : adapter/%.cpp
g++ -std=c++11 -I$(YAML)/include -c $< -o $@ $(LIBS)
#$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(LIBS)
# Source files in the $(CCX) folder
$(OBJDIR)/%.o : $(CCX)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : $(CCX)/%.f
$(FC) $(FFLAGS) -c $< -o $@
# Generate list of object files from the source files, prepend $(OBJDIR)
OCCXF = $(SCCXF:%.f=$(OBJDIR)/%.o)
OCCXC = $(SCCXC:%.c=$(OBJDIR)/%.o)
OCCXMAIN = $(SCCXMAIN:%.c=$(OBJDIR)/%.o)
OCCXC += $(OBJDIR)/ConfigReader.o
$(OBJDIR)/ccx_preCICE: $(OBJDIR) $(OCCXMAIN) $(OBJDIR)/ccx_2.15.a
$(FC) -fopenmp -Wall -O3 -o $@ $(OCCXMAIN) $(OBJDIR)/ccx_2.15.a $(LIBS)
$(OBJDIR)/ccx_2.15.a: $(OCCXF) $(OCCXC)
ar vr $@ $?
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
rm -f $(OBJDIR)/*.o $(OBJDIR)/ccx_2.15.a $(OBJDIR)/ccx_preCICE