-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (87 loc) · 2.59 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
# This file
MAKEFILE = Makefile
#----------------------------------------------------------------------
# User choices - edit to suit
#----------------------------------------------------------------------
# 0. Shell (if it really matters)
#SHELL = /bin/bash
#----------------------------------------------------------------------
# 1. Architecture
# Compiling for a parallel machine? blank for a scalar machine
MPP = false
OMP = false
ARCH = MAC
INSTALLDIR=${HOME}/lib
#Compiler Type:
ifeq ($(ARCH),INTEL)
ifeq ($(strip ${OMP}),true)
CC = icpc -openmp
else
CC = icpc
endif
endif
ifeq ($(ARCH),VAN)
ifeq ($(strip ${OMP}),true)
CC = g++ -fopenmp
else
CC = g++
endif
endif
ifeq ($(ARCH),CRAY)
CC = CC
endif
ifeq ($(ARCH),MAC)
ifeq ($(strip ${OMP}),true)
CC = g++ -fopenmp
else
CC = g++
endif
endif
#Compiler Optimization Level:
ifeq ($(ARCH),INTEL)
OPT = -O2 -march=native -ipo
FLAGS = -fPIC -Wall -debug -std=c++11
LD = icpc
LINK = -shared -Wl,-soname,libpertutils.so -o libpertutils.so.1.0 *.o
FINISH = cp libpertutils.so.1.0 ${INSTALLDIR}/; ln -sf ${INSTALLDIR}/libpertutils.so.1.0 ${HOME}/lib/libpertutils.so
endif
ifneq (,$(filter $(ARCH),VAN CRAY))
OPT = -O2 -march=native
FLAGS = -fPIC -Wall -g
LD = g++
LINK = -shared -Wl,-soname,libpertutils.so -o libpertutils.so.1.0 *.o
FINISH = cp libpertutils.so.1.0 ${INSTALLDIR}/; ln -sf ${INSTALLDIR}/libpertutils.so.1.0 ${INSTALLDIR}/libpertutils.so
endif
ifeq ($(ARCH),MAC)
OPT = -O2 -march=native
FLAGS = -fPIC -Wall -g
LD = g++
LINK = -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.0,-current_version,1.0,-install_name,${INSTALLDIR}/libpertutils.dylib -o ${INSTALLDIR}/libpertutils.1.0.dylib *.o
FINISH = ln -sf ${INSTALLDIR}/libpertutils.1.0.dylib ${INSTALLDIR}/libpertutils.dylib
endif
#Extra libraries and includes:
ifeq ($(ARCH),INTEL)
LIBADD = -lpthread -lm
MYINCLUDEDIR = -I./ -I../mathutils/
DEFINES =
endif
ifneq (,$(filter $(ARCH),VAN CRAY))
LIBADD = -lpthread -lm
MYINCLUDEDIR = -I./ -I../mathutils/
DEFINES =
endif
ifeq ($(ARCH),MAC)
LIBADD = -lpthread -lm
MYINCLUDEDIR = -I./ -I../mathutils/
DEFINES =
endif
#Complete Set of Flags:
CFLAGS = ${DEFINES} ${MYINCLUDEDIR} ${FLAGS} ${OPT}
all::
${CC} ${CFLAGS} -c gamma.cpp -o gamma.o ${LIBADD}
${CC} ${CFLAGS} -c runnings.cpp -o runnings.o ${LIBADD}
${CC} ${CFLAGS} -c chiptfuncs.cpp -o chiptfuncs.o ${LIBADD}
${LD} ${LINK}
${FINISH}
clean::
-/bin/rm -f *.o *.a *.so.*