-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.legacy
143 lines (118 loc) · 3.24 KB
/
Makefile.legacy
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#
# NOTE: this Makefile is here only for legacy purposes and to
# provide a record of the functionality wanted from cmake
#
SHELL = /bin/sh
packagename = ecuda
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
sbindir = $(exec_prefix)/sbin
libexecdir = $(exec_prefix)/libexec
datarootdir = $(exec_prefix)/share
datadir = $(datarootdir)
sysconfdir = $(prefix)/etc
sharedstatedir = $(prefix)/com
localstatedir = $(prefix)/var
runstatedir = $(localstatedir)/run
includedir = $(prefix)/include
oldincludedir = /usr/include
docdir = $(datarootdir)/doc/$(packagename)
infodir = $(datarootdir)/info
htmldir = $(docdir)
dvidir = $(docdir)
pdfdir = $(docdir)
psdir = $(docdir)
libbdir = $(exec_prefix)/lib
lispdir = $(datarootdir)/emacs/site-lisp
localedir = $(datarootdir)/locale
mandir = $(datarootdir)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
manext = .1
man1ext = .1
man2ext = .2
#srcdir = ./src
AR = ar
CC = gcc -x c
CFLAGS = -Wall
CXX = g++
CXXFLAGS = -Wall -flto -L/usr/local/cuda/lib64 -pedantic
CXXFLAGS += -I./include
#CXXFLAGS += -I../Catch/include
#-std=c++11
FC = gfortran
NVCC = /usr/local/cuda/bin/nvcc
NVCCFLAGS = -arch=sm_21 -O3
NVCCFLAGS += -Xptxas -v
#NVCCFLAGS += -I../Catch/include
NVCCFLAGS += -I./include
# for OpenMP support add to above: -X compiler -fopenmp
# for C++11 support add to above: -std=c++11
LDLIBS = -lcudart
CATCHDIR = ../Catch/include
-include local-config.cfg
ifeq ($(std),c++11)
CXXFLAGS += -std=c++11
NVCCFLAGS += -std=c++11
endif
ifeq ($(mode),debug)
CXXFLAGS += -g
CFLAGS += -g
else
mode = release
CXXFLAGS += -O3 -march=native
CFLAGS += -O3 -march=native
endif
install:
@mkdir -p $(includedir)
cp -a include/ecuda $(includedir)/ecuda
test/% :: test/%.cu
@mkdir -p bin/test
@mkdir -p obj/test
$(NVCC) $(NVCCFLAGS) -c $< -o obj/[email protected]
$(CXX) $(CXXFLAGS) obj/[email protected] $(LDLIBS) -o bin/$@
test/cpu/% :: test/%.cu
@mkdir -p bin/test/cpu
cp $< $<.cpp
$(CXX) -g $(CXXFLAGS) -Wno-long-long $<.cpp -o bin/$@
rm $<.cpp
t/% :: t/%.cu
@mkdir -p bin/t
@mkdir -p obj/t
$(NVCC) $(NVCCFLAGS) -I$(CATCHDIR) -c $< -o obj/[email protected]
$(CXX) $(CXXFLAGS) -I$(CATCHDIR) obj/[email protected] $(LDLIBS) -o bin/$@
t/cpu/% :: t/%.cu
@mkdir -p bin/t/cpu
cp $< $<.cpp
$(CXX) -g $(CXXFLAGS) -I$(CATCHDIR) -Wno-long-long $<.cpp -o bin/$@
rm $<.cpp
T_FILES = $(basename $(shell find t -name '*.cu'))
unittests :: $(T_FILES)
.PHONY: unittests
% :: tools/%.cu
@mkdir -p bin
@mkdir -p obj
$(NVCC) $(NVCCFLAGS) -c $< -o obj/[email protected]
$(CXX) $(CXXFLAGS) obj/[email protected] $(LDLIBS) -o bin/$@
cpu/% :: tools/%.cu
@mkdir -p bin/cpu
cp $< $<.cpp
$(CXX) -g $(CXXFLAGS) -Wno-variadic-macros -Wno-long-long $<.cpp -o bin/$@
rm $<.cpp
benchmark/% :: benchmark/%.cu
@mkdir -p bin/benchmark
@mkdir -p obj/benchmark
$(NVCC) $(NVCCFLAGS) -c $< -o obj/[email protected]
$(CXX) $(CXXFLAGS) obj/[email protected] $(LDLIBS) -o bin/$@
benchmark/ptx/% :: benchmark/%.cu
@mkdir -p ptx/benchmark
$(NVCC) -ptx $< -o ptx/$<.ptx
dist:
tar zcvf ecuda-dist.tar.gz LICENSE.txt include/ecuda/*.hpp test/*.cu benchmarks/*.cu
docs: FORCE
doxygen doxygen.cfg
tests: test/test_array test/test_cube test/test_matrix test/test_vector
cpu_tests: test/cpu/test_array test/cpu/test_cube test/cpu/test_matrix test/cpu/test_vector
benchmarks: benchmarks/array benchmarks/matrix
FORCE: