-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.old
109 lines (80 loc) · 2.47 KB
/
Makefile.old
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
# @Author: Julien Vial-Detambel <vial-d_j>
# @Date: 2018-06-12T11:58:18+01:00
# @Email: [email protected]
# @Project: CUDA-Based Simulator of Quantum Systems
# @Filename: Makefile
# @Last modified by: vial-d_j
# @Last modified time: 2018-06-27T14:53:37+01:00
# @License: MIT License
CXX= g++
OPTIFLAGS= -g3
CXXFLAGS= -Wextra -Wall -std=c++14 $(OPTIFLAGS)
NVCC= nvcc
NVCCFLAGS= -std=c++14 -arch=sm_61 --device-c
RM= rm -rf
NAME= quSim
# .cpp source files directory
SDIR= src
# .cu source files firectory
CUSDIR= cuda_src
# objects from .cpp sources directory
ODIR= obj
# objects from .cu sources directory
CUODIR= cuda_obj
# .cu source files
CUSRC= QCUDA.cu \
QCUDA_operations.cu \
GPUExecutor.cu \
CPUExecutor.cu \
ExecutorManager.cu
# .cpp sources
SRC= Parser/FloatExprAst.cpp \
Parser/ASTGenerator.cpp \
Parser/CircuitBuilder/CXBuilder.cpp \
Parser/CircuitBuilder/MeasureBuilder.cpp \
Parser/CircuitBuilder/RegisterDeclarationBuilder.cpp \
Parser/CircuitBuilder/UBuilder.cpp \
Parser/CircuitBuilder/UserDefinedGateBuilder.cpp \
Parser/CircuitBuilder/CircuitBuilder.cpp \
Parser/CircuitBuilder/CircuitBuilderUtils.cpp \
Parser/FloatExpressionEvaluator.cpp \
CircuitPrinter.cpp \
Matrix.cpp \
Simulator.cpp \
main.cpp
$(ODIR)/Parser/ASTGenerator.o: CXXFLAGS:=$(filter-out $(OPTIFLAGS),$(CXXFLAGS))
# Includes for CXX
INC= -Iinclude -I/usr/include/boost -Icuda_include
# Includes for NVCC
CUINC= -I$(CUDA_HOME)/samples/common/inc/ -Icuda_include -Iinclude
# objects from .cpp source files
_OBJS= $(SRC:.cpp=.o)
OBJS= $(patsubst %,$(ODIR)/%,$(_OBJS))
# objects from .cu source files
_CUOBJS= $(CUSRC:.cu=.o)
CUOBJS= $(patsubst %,$(CUODIR)/%,$(_CUOBJS))
LDIR= -L$(CUDA_HOME)/lib64 -lcuda -lcudart
all: $(ODIR) $(CUODIR) $(NAME)
# create objects from .cpp source files directory
$(ODIR):
mkdir $(ODIR)
mkdir $(ODIR)/Parser
mkdir $(ODIR)/Parser/CircuitBuilder
# create objects from .cpp source files
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INC) $(CUINC) -o $@ -c $<
# create objects from .cu source files directory
$(CUODIR):
mkdir $(CUODIR)
# create objects from .cu source files
$(CUODIR)/%.o: $(CUSDIR)/%.cu
$(NVCC) $(CUINC) $(NVCCFLAGS) -o $@ -c $<
$(NAME): $(OBJS) $(CUOBJS)
$(NVCC) $(CUINC) -std=c++14 -arch=sm_61 --device-link -o $(CUODIR)/dlink.o $(CUOBJS) $(LDIR)
$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJS) $(CUOBJS) $(CUODIR)/dlink.o $(LDIR)
clean:
$(RM) $(ODIR) $(CUODIR)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re