Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Makefile 14 KB

You have to be logged in to leave a comment. Sign In
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
  1. PROJECT := openpose
  2. CONFIG_FILE := Makefile.config
  3. # Explicitly check for the config file, otherwise make -k will proceed anyway.
  4. ifeq ($(wildcard $(CONFIG_FILE)),)
  5. $(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.)
  6. endif
  7. include $(CONFIG_FILE)
  8. BUILD_DIR_LINK := $(BUILD_DIR)
  9. ifeq ($(RELEASE_BUILD_DIR),)
  10. RELEASE_BUILD_DIR := .$(BUILD_DIR)_release
  11. endif
  12. ifeq ($(DEBUG_BUILD_DIR),)
  13. DEBUG_BUILD_DIR := .$(BUILD_DIR)_debug
  14. endif
  15. DEBUG ?= 0
  16. ifeq ($(DEBUG), 1)
  17. BUILD_DIR := $(DEBUG_BUILD_DIR)
  18. OTHER_BUILD_DIR := $(RELEASE_BUILD_DIR)
  19. else
  20. BUILD_DIR := $(RELEASE_BUILD_DIR)
  21. OTHER_BUILD_DIR := $(DEBUG_BUILD_DIR)
  22. endif
  23. # All of the directories containing code.
  24. SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \
  25. -name '*.cpp' | grep -q ." \; -print)
  26. # The target shared library name
  27. LIBRARY_NAME := $(PROJECT)
  28. LIB_BUILD_DIR := $(BUILD_DIR)/lib
  29. STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
  30. DYNAMIC_VERSION_MAJOR := 1
  31. DYNAMIC_VERSION_MINOR := 2
  32. DYNAMIC_VERSION_REVISION := 0
  33. DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
  34. #DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
  35. DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
  36. DYNAMIC_NAME := $(LIB_BUILD_DIR)/$(DYNAMIC_VERSIONED_NAME_SHORT)
  37. COMMON_FLAGS += -DOPEN_POSE_VERSION=$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION)
  38. ##############################
  39. # Enable profiler
  40. ##############################
  41. PROFILER_ENABLED ?= 0
  42. ifeq ($(PROFILER_ENABLED), 1)
  43. COMMON_FLAGS += -DPROFILER_ENABLED
  44. endif
  45. ##############################
  46. # Deep net selection
  47. ##############################
  48. DEEP_NET ?= caffe
  49. # TensorFlow
  50. ifeq ($(DEEP_NET), tensorflow)
  51. # COMMON_FLAGS += -DUSE_TENSOR_FLOW
  52. # Torch
  53. else ifeq ($(DEEP_NET), torch)
  54. # COMMON_FLAGS += -DUSE_TORCH
  55. # Caffe
  56. else
  57. COMMON_FLAGS += -DUSE_CAFFE
  58. LIBRARIES += caffe
  59. LDFLAGS += -Wl,-rpath=$(CAFFE_DIR)/lib
  60. INCLUDE_DIRS += $(CAFFE_DIR)/include
  61. LIBRARY_DIRS += $(CAFFE_DIR)/lib
  62. endif
  63. ##############################
  64. # Get all source files
  65. ##############################
  66. # CXX_SRCS are the source files excluding the test ones.
  67. # CXX_SRCS := $(shell find src/$(PROJECT) ! -name "test_*.cpp" -name "*.cpp")
  68. CXX_SRCS := $(shell find src ! -name "test_*.cpp" -name "*.cpp")
  69. # CU_SRCS are the cuda source files
  70. # CU_SRCS := $(shell find src/$(PROJECT) ! -name "test_*.cu" -name "*.cu")
  71. CU_SRCS := $(shell find src ! -name "test_*.cu" -name "*.cu")
  72. # EXAMPLE_SRCS are the source files for the example binaries
  73. EXAMPLE_SRCS := $(shell find examples -name "*.cpp")
  74. # BUILD_INCLUDE_DIR contains any generated header files we want to include.
  75. BUILD_INCLUDE_DIR := $(BUILD_DIR)/src
  76. # NONGEN_CXX_SRCS includes all source/header files except those generated
  77. # automatically (e.g., by proto).
  78. NONGEN_CXX_SRCS := $(shell find \
  79. src/$(PROJECT) \
  80. include/$(PROJECT) \
  81. examples \
  82. -name "*.cpp" -or -name "*.hpp" -or -name "*.cu" -or -name "*.cuh")
  83. LINT_SCRIPT := scripts/cpp_lint.py
  84. LINT_OUTPUT_DIR := $(BUILD_DIR)/.lint
  85. LINT_EXT := lint.txt
  86. LINT_OUTPUTS := $(addsuffix .$(LINT_EXT), $(addprefix $(LINT_OUTPUT_DIR)/, $(NONGEN_CXX_SRCS)))
  87. EMPTY_LINT_REPORT := $(BUILD_DIR)/.$(LINT_EXT)
  88. NONEMPTY_LINT_REPORT := $(BUILD_DIR)/$(LINT_EXT)
  89. ##############################
  90. # Derive generated files
  91. ##############################
  92. # The objects corresponding to the source files
  93. # These objects will be linked into the final shared library, so we
  94. # exclude the example objects.
  95. CXX_OBJS := $(addprefix $(BUILD_DIR)/, ${CXX_SRCS:.cpp=.o})
  96. CU_OBJS := $(addprefix $(BUILD_DIR)/cuda/, ${CU_SRCS:.cu=.o})
  97. OBJS := $(CXX_OBJS) $(CU_OBJS)
  98. # example objects
  99. EXAMPLE_OBJS := $(addprefix $(BUILD_DIR)/, ${EXAMPLE_SRCS:.cpp=.o})
  100. # Output files for automatic dependency generation
  101. DEPS := ${EXAMPLE_OBJS:.o=.d} ${CXX_OBJS:.o=.d} ${CU_OBJS:.o=.d}
  102. EXAMPLE_BINS := ${EXAMPLE_OBJS:.o=.bin}
  103. ##############################
  104. # Derive compiler warning dump locations
  105. ##############################
  106. WARNS_EXT := warnings.txt
  107. CXX_WARNS := $(addprefix $(BUILD_DIR)/, ${CXX_SRCS:.cpp=.o.$(WARNS_EXT)})
  108. CU_WARNS := $(addprefix $(BUILD_DIR)/cuda/, ${CU_SRCS:.cu=.o.$(WARNS_EXT)})
  109. EXAMPLE_WARNS := $(addprefix $(BUILD_DIR)/, ${EXAMPLE_SRCS:.cpp=.o.$(WARNS_EXT)})
  110. ALL_CXX_WARNS := $(CXX_WARNS) $(EXAMPLE_WARNS)
  111. ALL_CU_WARNS := $(CU_WARNS)
  112. ALL_WARNS := $(ALL_CXX_WARNS) $(ALL_CU_WARNS)
  113. EMPTY_WARN_REPORT := $(BUILD_DIR)/.$(WARNS_EXT)
  114. NONEMPTY_WARN_REPORT := $(BUILD_DIR)/$(WARNS_EXT)
  115. ##############################
  116. # Derive include and lib directories
  117. ##############################
  118. CUDA_INCLUDE_DIR := $(CUDA_DIR)/include
  119. CUDA_LIB_DIR :=
  120. # add <cuda>/lib64 only if it exists
  121. ifneq ("$(wildcard $(CUDA_DIR)/lib64)","")
  122. CUDA_LIB_DIR += $(CUDA_DIR)/lib64
  123. endif
  124. CUDA_LIB_DIR += $(CUDA_DIR)/lib
  125. INCLUDE_DIRS += $(BUILD_INCLUDE_DIR) ./src ./include
  126. ifeq ($(USE_CUDA), 1)
  127. INCLUDE_DIRS += $(CUDA_INCLUDE_DIR)
  128. LIBRARY_DIRS += $(CUDA_LIB_DIR)
  129. LIBRARIES += cudart cublas curand
  130. endif
  131. # LIBRARIES += glog gflags boost_system boost_filesystem m hdf5_hl hdf5 caffe
  132. LIBRARIES += glog gflags boost_system boost_filesystem m hdf5_hl hdf5
  133. # handle IO dependencies
  134. USE_LEVELDB ?= 1
  135. USE_LMDB ?= 1
  136. USE_OPENCV ?= 1
  137. ifeq ($(USE_LEVELDB), 1)
  138. LIBRARIES += leveldb snappy
  139. endif
  140. ifeq ($(USE_LMDB), 1)
  141. LIBRARIES += lmdb
  142. endif
  143. ifeq ($(USE_OPENCV), 1)
  144. LIBRARIES += opencv_core opencv_highgui opencv_imgproc opencv_objdetect
  145. ifeq ($(OPENCV_VERSION), 3)
  146. LIBRARIES += opencv_imgcodecs opencv_videoio
  147. else
  148. LIBRARIES += opencv_contrib
  149. endif
  150. endif
  151. ##############################
  152. # OpenPose extra code: commented
  153. ##############################
  154. # WARNINGS := -Wall -Wno-sign-compare
  155. ##############################
  156. # Set build directories
  157. ##############################
  158. DISTRIBUTE_DIR ?= distribute
  159. DISTRIBUTE_SUBDIRS := $(DISTRIBUTE_DIR)/bin $(DISTRIBUTE_DIR)/lib
  160. DIST_ALIASES := dist
  161. ifneq ($(strip $(DISTRIBUTE_DIR)),distribute)
  162. DIST_ALIASES += distribute
  163. endif
  164. ALL_BUILD_DIRS := $(sort $(BUILD_DIR) $(addprefix $(BUILD_DIR)/, $(SRC_DIRS)) \
  165. $(addprefix $(BUILD_DIR)/cuda/, $(SRC_DIRS)) \
  166. $(LIB_BUILD_DIR) $(LINT_OUTPUT_DIR))
  167. ##############################
  168. # Set directory for Doxygen-generated documentation
  169. ##############################
  170. DOXYGEN_CONFIG_FILE ?= ./.Doxyfile
  171. # should be the same as OUTPUT_DIRECTORY in the .Doxyfile
  172. DOXYGEN_OUTPUT_DIR ?= ./doxygen
  173. DOXYGEN_COMMAND ?= doxygen
  174. # All the files that might have Doxygen documentation.
  175. DOXYGEN_SOURCES := $(shell find \
  176. src/$(PROJECT) \
  177. include/$(PROJECT) \
  178. examples \
  179. -name "*.cpp" -or -name "*.hpp" -or -name "*.cu" -or -name "*.cuh")
  180. DOXYGEN_SOURCES += $(DOXYGEN_CONFIG_FILE)
  181. ##############################
  182. # OpenPose extra code: added flags
  183. ##############################
  184. # Automatic dependency generation (nvcc is handled separately)
  185. CXXFLAGS += -march=native
  186. # Complete build flags.
  187. CXXFLAGS += -fopenmp -Wpedantic -Wall -Wextra
  188. CXXFLAGS += -Wfatal-errors
  189. COMMON_FLAGS += -std=c++11
  190. LINKFLAGS += -fopenmp
  191. ##############################
  192. # Configure build
  193. ##############################
  194. # Determine platform
  195. UNAME := $(shell uname -s)
  196. ifeq ($(UNAME), Linux)
  197. LINUX := 1
  198. else ifeq ($(UNAME), Darwin)
  199. OSX := 1
  200. OSX_MAJOR_VERSION := $(shell sw_vers -productVersion | cut -f 1 -d .)
  201. OSX_MINOR_VERSION := $(shell sw_vers -productVersion | cut -f 2 -d .)
  202. endif
  203. # Linux
  204. ifeq ($(LINUX), 1)
  205. CXX ?= /usr/bin/g++
  206. GCCVERSION := $(shell $(CXX) -dumpversion | cut -f1,2 -d.)
  207. # older versions of gcc are too dumb to build boost with -Wuninitalized
  208. ifeq ($(shell echo | awk '{exit $(GCCVERSION) < 4.6;}'), 1)
  209. WARNINGS += -Wno-uninitialized
  210. endif
  211. # boost::thread is reasonably called boost_thread (compare OS X)
  212. # We will also explicitly add stdc++ to the link target.
  213. LIBRARIES += boost_thread stdc++
  214. VERSIONFLAGS += -Wl,-soname,$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../lib
  215. endif
  216. # OS X:
  217. # clang++ instead of g++
  218. # libstdc++ for NVCC compatibility on OS X >= 10.9 with CUDA < 7.0
  219. ifeq ($(OSX), 1)
  220. CXX := /usr/bin/clang++
  221. ifeq ($(USE_CUDA), 1)
  222. CUDA_VERSION := $(shell $(CUDA_DIR)/bin/nvcc -V | grep -o 'release [0-9.]*' | tr -d '[a-z ]')
  223. ifeq ($(shell echo | awk '{exit $(CUDA_VERSION) < 7.0;}'), 1)
  224. CXXFLAGS += -stdlib=libstdc++
  225. LINKFLAGS += -stdlib=libstdc++
  226. endif
  227. # clang throws this warning for cuda headers
  228. WARNINGS += -Wno-unneeded-internal-declaration
  229. # 10.11 strips DYLD_* env vars so link CUDA (rpath is available on 10.5+)
  230. OSX_10_OR_LATER := $(shell [ $(OSX_MAJOR_VERSION) -ge 10 ] && echo true)
  231. OSX_10_5_OR_LATER := $(shell [ $(OSX_MINOR_VERSION) -ge 5 ] && echo true)
  232. ifeq ($(OSX_10_OR_LATER),true)
  233. ifeq ($(OSX_10_5_OR_LATER),true)
  234. LDFLAGS += -Wl,-rpath,$(CUDA_LIB_DIR)
  235. endif
  236. endif
  237. endif
  238. # boost::thread is called boost_thread-mt to mark multithreading on OS X
  239. LIBRARIES += boost_thread-mt
  240. # we need to explicitly ask for the rpath to be obeyed
  241. ORIGIN := @loader_path
  242. VERSIONFLAGS += -Wl,-install_name,@rpath/$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib
  243. else
  244. ORIGIN := \$$ORIGIN
  245. endif
  246. # Custom compiler
  247. ifdef CUSTOM_CXX
  248. CXX := $(CUSTOM_CXX)
  249. endif
  250. # Static linking
  251. ifneq (,$(findstring clang++,$(CXX)))
  252. STATIC_LINK_COMMAND := -Wl,-force_load $(STATIC_NAME)
  253. else ifneq (,$(findstring g++,$(CXX)))
  254. STATIC_LINK_COMMAND := -Wl,--whole-archive $(STATIC_NAME) -Wl,--no-whole-archive
  255. else
  256. # The following line must not be indented with a tab, since we are not inside a target
  257. $(error Cannot static link with the $(CXX) compiler)
  258. endif
  259. # Debugging
  260. ifeq ($(DEBUG), 1)
  261. COMMON_FLAGS += -DDEBUG -g -O0
  262. NVCCFLAGS += -G
  263. else
  264. COMMON_FLAGS += -DNDEBUG -O3
  265. endif
  266. # configure IO libraries
  267. ifeq ($(USE_OPENCV), 1)
  268. COMMON_FLAGS += -DUSE_OPENCV
  269. endif
  270. ifeq ($(USE_LEVELDB), 1)
  271. COMMON_FLAGS += -DUSE_LEVELDB
  272. endif
  273. ifeq ($(USE_LMDB), 1)
  274. COMMON_FLAGS += -DUSE_LMDB
  275. ifeq ($(ALLOW_LMDB_NOLOCK), 1)
  276. COMMON_FLAGS += -DALLOW_LMDB_NOLOCK
  277. endif
  278. endif
  279. # CPU-only configuration
  280. ifeq ($(USE_CUDA), 1)
  281. COMMON_FLAGS += -DUSE_CUDA
  282. else
  283. COMMON_FLAGS += -DCPU_ONLY # For Caffe
  284. endif
  285. LIBRARY_DIRS += $(LIB_BUILD_DIR)
  286. # Automatic dependency generation (nvcc is handled separately)
  287. CXXFLAGS += -MMD -MP
  288. # Complete build flags.
  289. COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
  290. CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
  291. NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
  292. LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
  293. USE_PKG_CONFIG ?= 0
  294. ifeq ($(USE_PKG_CONFIG), 1)
  295. PKG_CONFIG := $(shell pkg-config opencv --libs)
  296. else
  297. PKG_CONFIG :=
  298. endif
  299. # LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(PKG_CONFIG) \
  300. # $(foreach library,$(LIBRARIES),-l$(library)) -Wl,-rpath=$(CAFFE_DIR)/lib
  301. LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(PKG_CONFIG) \
  302. $(foreach library,$(LIBRARIES),-l$(library))
  303. ##############################
  304. # Define build targets
  305. ##############################
  306. .PHONY: all lib clean docs linecount lint lintclean examples $(DIST_ALIASES) \
  307. warn everything
  308. all: lib examples
  309. lib: $(STATIC_NAME) $(DYNAMIC_NAME)
  310. everything: $(EVERYTHING_TARGETS)
  311. linecount:
  312. cloc --read-lang-def=$(PROJECT).cloc \
  313. src/$(PROJECT) include/$(PROJECT) examples
  314. lint: $(EMPTY_LINT_REPORT)
  315. lintclean:
  316. @ $(RM) -r $(LINT_OUTPUT_DIR) $(EMPTY_LINT_REPORT) $(NONEMPTY_LINT_REPORT)
  317. docs: $(DOXYGEN_OUTPUT_DIR)
  318. @ cd ./docs ; ln -sfn ../$(DOXYGEN_OUTPUT_DIR)/html doxygen
  319. $(DOXYGEN_OUTPUT_DIR): $(DOXYGEN_CONFIG_FILE) $(DOXYGEN_SOURCES)
  320. $(DOXYGEN_COMMAND) $(DOXYGEN_CONFIG_FILE)
  321. $(EMPTY_LINT_REPORT): $(LINT_OUTPUTS) | $(BUILD_DIR)
  322. @ cat $(LINT_OUTPUTS) > $@
  323. @ if [ -s "$@" ]; then \
  324. cat $@; \
  325. mv $@ $(NONEMPTY_LINT_REPORT); \
  326. echo "Found one or more lint errors."; \
  327. exit 1; \
  328. fi; \
  329. $(RM) $(NONEMPTY_LINT_REPORT); \
  330. echo "No lint errors!";
  331. $(LINT_OUTPUTS): $(LINT_OUTPUT_DIR)/%.lint.txt : % $(LINT_SCRIPT) | $(LINT_OUTPUT_DIR)
  332. @ mkdir -p $(dir $@)
  333. @ python $(LINT_SCRIPT) $< 2>&1 \
  334. | grep -v "^Done processing " \
  335. | grep -v "^Total errors found: 0" \
  336. > $@ \
  337. || true
  338. examples: $(EXAMPLE_BINS)
  339. warn: $(EMPTY_WARN_REPORT)
  340. $(EMPTY_WARN_REPORT): $(ALL_WARNS) | $(BUILD_DIR)
  341. @ cat $(ALL_WARNS) > $@
  342. @ if [ -s "$@" ]; then \
  343. cat $@; \
  344. mv $@ $(NONEMPTY_WARN_REPORT); \
  345. echo "Compiler produced one or more warnings."; \
  346. exit 1; \
  347. fi; \
  348. $(RM) $(NONEMPTY_WARN_REPORT); \
  349. echo "No compiler warnings!";
  350. $(ALL_WARNS): %.o.$(WARNS_EXT) : %.o
  351. $(BUILD_DIR_LINK): $(BUILD_DIR)/.linked
  352. # Create a target ".linked" in this BUILD_DIR to tell Make that the "build" link
  353. # is currently correct, then delete the one in the OTHER_BUILD_DIR in case it
  354. # exists and $(DEBUG) is toggled later.
  355. $(BUILD_DIR)/.linked:
  356. @ mkdir -p $(BUILD_DIR)
  357. @ $(RM) $(OTHER_BUILD_DIR)/.linked
  358. @ $(RM) -r $(BUILD_DIR_LINK)
  359. @ ln -s $(BUILD_DIR) $(BUILD_DIR_LINK)
  360. @ touch $@
  361. $(ALL_BUILD_DIRS): | $(BUILD_DIR_LINK)
  362. @ mkdir -p $@
  363. $(DYNAMIC_NAME): $(OBJS) | $(LIB_BUILD_DIR)
  364. @ echo LD -o $@
  365. $(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS)
  366. @ cd $(LIB_BUILD_DIR); rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT)
  367. $(STATIC_NAME): $(OBJS) | $(LIB_BUILD_DIR)
  368. @ echo AR -o $@
  369. $(Q)ar rcs $@ $(OBJS)
  370. $(BUILD_DIR)/%.o: %.cpp | $(ALL_BUILD_DIRS)
  371. @ echo CXX $<
  372. $(Q)$(CXX) $< $(CXXFLAGS) -c -o $@ 2> $@.$(WARNS_EXT) \
  373. || (cat $@.$(WARNS_EXT); exit 1)
  374. @ cat $@.$(WARNS_EXT)
  375. $(BUILD_DIR)/cuda/%.o: %.cu | $(ALL_BUILD_DIRS)
  376. @ echo NVCC $<
  377. $(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -M $< -o ${@:.o=.d} \
  378. -odir $(@D)
  379. $(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -c $< -o $@ 2> $@.$(WARNS_EXT) \
  380. || (cat $@.$(WARNS_EXT); exit 1)
  381. @ cat $@.$(WARNS_EXT)
  382. $(EXAMPLE_BINS): %.bin : %.o | $(DYNAMIC_NAME)
  383. @ echo CXX/LD -o $@
  384. $(Q)$(CXX) $< -o $@ $(LINKFLAGS) -l$(LIBRARY_NAME) $(LDFLAGS) \
  385. -Wl,-rpath,$(ORIGIN)/../../lib
  386. clean:
  387. @- $(RM) -rf $(ALL_BUILD_DIRS)
  388. @- $(RM) -rf $(OTHER_BUILD_DIR)
  389. @- $(RM) -rf $(BUILD_DIR_LINK)
  390. @- $(RM) -rf $(DISTRIBUTE_DIR)
  391. $(DIST_ALIASES): $(DISTRIBUTE_DIR)
  392. $(DISTRIBUTE_DIR): all
  393. @ mkdir -p $(DISTRIBUTE_SUBDIRS)
  394. # add include
  395. cp -r include $(DISTRIBUTE_DIR)/
  396. # add example binaries
  397. cp $(EXAMPLE_BINS) $(DISTRIBUTE_DIR)/bin
  398. # add libraries
  399. cp $(STATIC_NAME) $(DISTRIBUTE_DIR)/lib
  400. install -m 644 $(DYNAMIC_NAME) $(DISTRIBUTE_DIR)/lib
  401. cd $(DISTRIBUTE_DIR)/lib; rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT)
  402. -include $(DEPS)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...