-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
61 lines (49 loc) · 1.43 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
NUM_CPU ?= $(shell nproc --all)
VARIANT ?= Release
WERROR ?= OFF
SANITIZERS ?= OFF
TESTS ?= ON
MACHINE := $(shell uname -m)-linux-gnu
CMAKE_CMD := cmake \
-DCMAKE_BUILD_TYPE=$(VARIANT) \
-DBUILD_TESTING=$(TESTS) \
-DENABLE_WERROR=$(WERROR) \
-DENABLE_SANITIZERS=$(SANITIZERS)
MAKE_CMD := make -j$(NUM_CPU) --no-print-directory
DOCKER_CMD := docker run -t --rm \
-u "$(shell id -u)" \
-v "$(shell pwd):$(shell pwd)" \
-w "$(shell pwd)" \
-e "CI=${CI}"
all:
mkdir -p build/$(MACHINE)
cd build/$(MACHINE) && $(CMAKE_CMD) ../..
cd build/$(MACHINE) && $(MAKE_CMD)
no_gui:
mkdir -p build/$(MACHINE)
cd build/$(MACHINE) && $(CMAKE_CMD) -DBUILD_GUI=NO ../..
cd build/$(MACHINE) && $(MAKE_CMD)
.PHONY: test
test:
./bin/$(MACHINE)/signal-estimator-test
arm32:
mkdir -p build/arm-linux-gnueabihf
$(DOCKER_CMD) rocstreaming/toolchain-arm-linux-gnueabihf /bin/bash -c \
"cd build/arm-linux-gnueabihf && \
$(CMAKE_CMD) -DBUILD_GUI=NO -DTOOLCHAIN_PREFIX=arm-linux-gnueabihf ../.. && \
$(MAKE_CMD)"
arm64:
mkdir -p build/aarch64-linux-gnu
$(DOCKER_CMD) rocstreaming/toolchain-aarch64-linux-gnu /bin/bash -c \
"cd build/aarch64-linux-gnu && \
$(CMAKE_CMD) -DBUILD_GUI=NO -DTOOLCHAIN_PREFIX=aarch64-linux-gnu ../.. && \
$(MAKE_CMD)"
install:
cd build && make install
clean:
rm -rf build
rm -rf bin
fmt:
find src -type f -name '*.[ch]pp' | while read f; do \
grep -qF "$$f" .fmtignore || clang-format --verbose -i "$$f"; \
done