-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (47 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
# compiler must be compliant to C Standard 99
CC = gcc
CUBATUREPATH = cubature
INCLUDE = -Isrc -I$(CUBATUREPATH)
CFLAGS = -Wall -fno-exceptions -Wfatal-errors -std=c11 -O3 -m64 -fopenmp
LINK = -L. -llapack -lopenblas -lgfortran -lpthread -lfftw3 -lm -ldl
## Intel MKL version:
#INCLUDE = -Isrc -I$(CUBATUREPATH) -I${MKLROOT}/include
#CFLAGS = -Wall -fno-exceptions -Wfatal-errors -std=c11 -O3 -DMKL_ILP64 -DMKL_Complex16="_Complex double" -m64 -fopenmp
#LINK = -L. -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lfftw3 -lm -ldl
OBJECTS = electrode.o auxiliary.o hcubature.o grid.o linalg.o
.DEFAULT_GOAL := dynamic_library
.PHONY: clean cleanout dynamic_library
clean : cleanout
rm -f *.exe *.so *.lib
cleanout :
rm -f *.o *.csv *.gif *.png
# Objects
hcubature.o : $(CUBATUREPATH)/hcubature.c
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -c $(CUBATUREPATH)/hcubature.c $(LINK)
auxiliary.o : src/auxiliary.c
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -c src/auxiliary.c $(LINK)
electrode.o : src/electrode.c
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -c src/electrode.c $(LINK)
grid.o : src/grid.c
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -c src/grid.c $(LINK)
linalg.o : src/linalg.c
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -c src/linalg.c $(LINK)
test : $(OBJECTS)
$(CC) $(CFLAGS) -fPIC $(INCLUDE) -Isrc/test -o test.exe src/test/testing.c $(OBJECTS) $(LINK)
# Libraries
dynamic_library : libhphem.so
libhphem.so : $(OBJECTS)
$(CC) $(CFLAGS) -fPIC -shared $(INCLUDE) -o libhphem.so $(OBJECTS)
# Examples are named based on publication: author_volume_journal_issue
alipio83powsys : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o alipio83powsys.exe examples/alipio83powsys.c $(OBJECTS) $(LINK)
grcev12pwrd01 : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o grcev12pwrd01.exe examples/grcev12pwrd01.c $(OBJECTS) $(LINK)
harmonic_impedance : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o harmonic_impedance.exe examples/harmonic_impedance.c $(OBJECTS) $(LINK)
sunjerga173powsys : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o sunjerga173powsys.exe examples/sunjerga173powsys.c $(OBJECTS) $(LINK)
three_grids : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o three_grids.exe examples/three_grids.c $(OBJECTS) $(LINK)
visacro57emc01 : $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDE) -o visacro57emc01.exe examples/visacro57emc01.c $(OBJECTS) $(LINK)