forked from tsduck/tsduck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
190 lines (140 loc) · 4.77 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
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
#-----------------------------------------------------------------------------
#
# TSDuck - The MPEG Transport Stream Toolkit
# Copyright (c) 2005-2025, Thierry Lelegard
# BSD-2-Clause license, see LICENSE.txt file or https://tsduck.io/license
#
# Root makefile for the TSDuck project.
#
# Additional options which can be defined: see CONFIG.txt
#
#-----------------------------------------------------------------------------
include Makefile.inc
# By default, update git hooks and build TSDuck binaries.
default: git-hooks
@$(MAKE) -C src $@
# Build and run all tests.
.PHONY: test-all
test-all: test test-suite
# Build and run unitary tests.
.PHONY: test test-static test-shared
test test-static test-shared: default
@$(MAKE) -C src/utest $@
# Build and run unitary tests under valgrind control.
.PHONY: valgrind valgrind-shared valgrind-static
valgrind valgrind-shared valgrind-static:
@$(MAKE) DEBUG=true
@$(MAKE) DEBUG=true -C src/utest $@
# Execute the TSDuck test suite from a sibling directory, if present.
.PHONY: test-suite
test-suite: default
@if [[ -d ../tsduck-test/.git ]]; then \
cd ../tsduck-test; git pull; ./run-all-tests.sh --bin "$(BINDIR)"; \
elif [[ -x ../tsduck-test/run-all-tests.sh ]]; then \
../tsduck-test/run-all-tests.sh --bin "$(BINDIR)"; \
else \
echo >&2 "No test repository in ../tsduck-test"; \
fi
# Alternative target to build with cross-compilation
.PHONY: cross
cross:
+@$(MAKE) CROSS=true
# Alternative target to recompile with debug options
.PHONY: debug
debug:
+@$(MAKE) DEBUG=true
# Alternative target to recompile with optimizations for reduced code size.
.PHONY: optsize
optsize:
+@$(MAKE) CXXFLAGS_OPTIMIZE="$(CXXFLAGS_OPTSIZE)"
# Alternative target to recompile with LLVM (clang) compiler
.PHONY: llvm clang
llvm clang:
+@$(MAKE) LLVM=true
# Alternative target to recompile with gcov support.
.PHONY: gcov
gcov:
+@$(MAKE) DEBUG=true GCOV=true
# Alternative target to recompile with gprof support.
.PHONY: gprof
gprof:
+@$(MAKE) DEBUG=true GPROF=true
# Alternative target to recompile for 32-bit target
.PHONY: m32
m32:
+@$(MAKE) M32=true
# Generate the documentation.
DOC_TARGETS = doxygen docs docs-html docs-pdf \
userguide userguide-html userguide-pdf open-userguide open-userguide-html open-userguide-pdf \
devguide devguide-html devguide-pdf open-devguide open-devguide-html open-devguide-pdf
.PHONY: $(DOC_TARGETS)
$(DOC_TARGETS):
$(if $(NODOC),@true,@$(MAKE) -C doc $@)
# Install Git hooks.
.PHONY: git-hooks
git-hooks:
@$(PYTHON) $(SCRIPTSDIR)/git-hook-update.py
# Cleanup utilities
.PHONY: clean distclean
clean distclean:
@$(PYTHON) $(SCRIPTSDIR)/cleanup.py
# Build the sample applications.
.PHONY: sample
sample:
@$(MAKE) -C sample $@
# Display the built version
.PHONY: show-version
show-version: default
@$(BINDIR)/tsversion --version=all
# Install files, using SYSROOT as target system root if necessary.
.PHONY: install install-tools install-devel
install install-tools install-devel:
@$(MAKE) NOTEST=true -C src $@
@$(MAKE) NOTEST=true -C doc $@
# Build installer packages.
.PHONY: installer install-installer
installer install-installer:
@$(MAKE) -C pkg $@
# Count lines of code: Run cloc on the source code tree starting at current directory.
CLOC = cloc
CLOC_SOURCES = src
CLOC_FLAGS = --skip-uniqueness --quiet --exclude-ext=.tgz,.tar.gz,.tar,.pdf,.pptx,.docx
.PHONY: cloc
cloc:
@$(CLOC) $(CLOC_FLAGS) $(CLOC_SOURCES)
# Static code analysis: Run Coverity.
COVERITY = cov-build
COVERITY_DIR = cov-int
COVERITY_SOURCES = src
.PHONY: coverity
coverity:
rm -rf $(COVERITY_DIR)
$(COVERITY) --dir $(COVERITY_DIR) $(MAKE) -C $(COVERITY_SOURCES)
$(TAR) czf $(COVERITY_DIR).tgz $(COVERITY_DIR)
# Static code analysis: Run cppcheck on the source code tree.
# In debug mode, the diagnostics are more aggressive but may be false positive.
CPPCHECK = cppcheck
CPPCHECK_SOURCES = src
CPPCHECK_FLAGS = $(CXXFLAGS_INCLUDES) --inline-suppr --quiet --force \
--template="{file}:{line}: ({severity}) {id}: {message}" \
--enable=all --suppress=unusedFunction --suppress=missingIncludeSystem \
$(if $(DEBUG),--inconclusive,)
.PHONY: cppcheck cppcheck-xml
cppcheck:
$(CPPCHECK) $(CPPCHECK_FLAGS) $(CPPCHECK_SOURCES)
cppcheck-xml:
$(CPPCHECK) $(CPPCHECK_FLAGS) --xml --xml-version=2 $(CPPCHECK_SOURCES)
# Static code analysis: Run flawfinder on the source code tree.
FLAWFINDER = flawfinder
FLAWFINDER_SOURCES = src
FLAWFINDER_FLAGS = --quiet --dataonly
.PHONY: flawfinder
flawfinder:
$(FLAWFINDER) $(FLAWFINDER_FLAGS) $(FLAWFINDER_SOURCES)
# Static code analysis: Run scan-build on the source code tree.
SCANBUILD = scan-build
SCANBUILD_SOURCES = src
SCANBUILD_FLAGS = -o $(BINDIR)
.PHONY: scan-build
scan-build:
$(SCANBUILD) $(SCANBUILD_FLAGS) $(MAKE) -C $(SCANBUILD_SOURCES)