forked from stan-dev/math
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
142 lines (125 loc) · 4.62 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
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
# Makefile for Stan.
##
# The default target of this Makefile is...
help:
## Disable implicit rules.
SUFIXES:
include make/default_compiler_options
##
# Library locations
##
MATH ?=
include make/libraries
-include $(HOME)/.config/stan/make.local # define local variables
-include make/local # overwrite local variables
CXX = $(CC)
##
# Get information about the compiler used.
# - CC_TYPE: {g++, clang++, mingw32-g++, other}
# - CC_MAJOR: major version of CC
# - CC_MINOR: minor version of CC
##
-include make/detect_cc
# OS_TYPE is set automatically by this script
##
# These includes should update the following variables
# based on the OS:
# - CFLAGS
# - GTEST_CXXFLAGS
# - EXE
##
-include make/detect_os
include make/tests # tests
include make/cpplint # cpplint
##
# Dependencies
##
ifneq (,$(filter-out test-headers generate-tests clean% %-test %.d,$(MAKECMDGOALS)))
-include $(addsuffix .d,$(subst $(EXE),,$(MAKECMDGOALS)))
endif
.PHONY: help
help:
@echo '--------------------------------------------------------------------------------'
@echo 'Stan Math makefile:'
@echo ' Current configuration:'
@echo ' - OS_TYPE (Operating System): ' $(OS_TYPE)
@echo ' - CC (Compiler): ' $(CC)
@echo ' - CC_TYPE ' $(CC_TYPE)
@echo ' - Compiler version: ' $(CC_MAJOR).$(CC_MINOR)
@echo ' - O (Optimization Level): ' $(O)
@echo ' - O_STANC (Opt for stanc): ' $(O_STANC)
ifdef TEMPLATE_DEPTH
@echo ' - TEMPLATE_DEPTH: ' $(TEMPLATE_DEPTH)
endif
@echo ' Library configuration:'
@echo ' - EIGEN ' $(EIGEN)
@echo ' - BOOST ' $(BOOST)
@echo ' - CVODES ' $(CVODES)
@echo ' - GTEST ' $(GTEST)
@echo ''
@echo 'Tests:'
@echo ''
@echo ' Unit tests are built through make by specifying the executable as the target'
@echo ' to make. For a test in test/*_test.cpp, the executable is test/*$(EXE).'
@echo ''
@echo ' Header tests'
@echo ' - test-headers : tests all source headers to ensure they are compilable and'
@echo ' include enough header files.'
@echo ''
@echo ' To run a single header test, add "-test" to the end of the file name.'
@echo ' Example: make stan/math/constants.hpp-test'
@echo ''
@echo ' - test-math-dependencies : walks through all the header files and indicates'
@echo ' when the math dependencies are violated. Dependencies should follow:'
@echo ' * rev -> prim'
@echo ' * fwd -> prim'
@echo ' * mix -> {rev, fwd, prim}'
@echo ' * within {prim, rev, fwd, mix}: mat -> arr -> scal'
@echo ''
@echo ' Cpplint'
@echo ' - cpplint : runs cpplint.py on source files. requires python 2.7.'
@echo ' cpplint is called using the CPPLINT variable:'
@echo ' CPPLINT = $(CPPLINT)'
@echo ' To set the version of python 2, set the PYTHON2 variable:'
@echo ' PYTHON2 = $(PYTHON2)'
@echo ''
@echo 'Documentation:'
@echo ' Doxygen'
@echo ' - doxygen : runs doxygen on source files. requires doxygen.'
@echo ''
@echo 'Clean:'
@echo ' - clean : Basic clean. Leaves doc and compiled libraries intact.'
@echo ' - clean-deps : Removes dependency files for tests. If tests stop building,'
@echo ' run this target.'
@echo ' - clean-libraries : Removes binaries built for libraries including CVODES.'
@echo ' - clean-all : Cleans up all of Stan.'
@echo ''
@echo '--------------------------------------------------------------------------------'
## doxygen
.PHONY: doxygen
doxygen:
mkdir -p doc/api
doxygen doxygen/doxygen.cfg
##
# Clean up.
##
.PHONY: clean clean-doxygen clean-deps clean-all
clean:
@echo ' removing test executables'
$(shell find test -type f -name "*_test$(EXE)" -exec rm {} +)
$(shell find test -type f -name "*_test.d" -exec rm {} +)
$(shell find test -type f -name "*_test.d.*" -exec rm {} +)
$(shell find test -type f -name "*_test.xml" -exec rm {} +)
$(shell find test -type f -name "*.o" -exec rm {} +)
$(shell find test -type f -name "lib*.so" -exec rm {} +)
clean-doxygen:
$(RM) -r doc/api
clean-deps:
@echo ' removing dependency files'
$(shell find . -type f -name '*.d' -exec rm {} +)
$(shell find . -type f -name '*.d.*' -exec rm {} +)
$(RM) $(shell find stan -type f -name '*.dSYM') $(shell find stan -type f -name '*.d.*')
clean-all: clean clean-doxygen clean-deps clean-libraries
@echo ' removing generated test files'
$(shell find test/prob -name '*_generated_*_test.cpp' -type f -exec rm {} +)
$(RM) $(wildcard test/prob/generate_tests$(EXE))