This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
72 lines (56 loc) · 2.39 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
include ./proto/nanopb/extra/nanopb.mk
# CMAKE FLAGS
# VERBOSE_MAKEFILE=on to allow verbose mode for cmake makefiles
ifeq ($(VERBOSE_MAKEFILE),on)
CMAKE_FLAGS:=-v
endif
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
.DEFAULT_GOAL := jenkins
# COMMON ###################################################################################################################################
.PHONY: jenkins
jenkins:
make -C highlevel jenkins
proto/gen/cpp/proto/outech.pb.c: proto/outech.proto
$(PROTOC) $(PROTOC_OPTS) --nanopb_out=./proto/gen/cpp proto/outech.proto -I=./proto
proto/gen/python/outech_pb2.py: proto/outech.proto
$(PROTOC) -I=./proto --python_out=./proto/gen/python proto/outech.proto
.PHONY: protoc
protoc: proto/gen/cpp/proto/outech.pb.c proto/gen/python/outech_pb2.py
.PHONY: clean
clean:
make -C highlevel clean
rm -rf lowlevel/cmake-build-debug
.PHONY: candump
candump:
@pipenv run python -m tool.script.read_bus $(dev) $(id_rx) $(id_tx)
# HIGH LEVEL ###################################################################################################################################
# LOW LEVEL ###################################################################################################################################
ll_cmake_setup:
cmake -B lowlevel/cmake-build-debug lowlevel
.PHONY: ll_build_all
ll_build_all: ll_cmake_setup
cmake --build lowlevel/cmake-build-debug --target build_motor build_motor_g4 build_servo build_servo_nucleo -j$(NPROCS) $(CMAKE_FLAGS)
.PHONY: ll_flash
ll_flash:
ifndef BOARD_NAME
$(error BOARD_NAME is undefined. Should be either motor, motor_g4, servo or servo_nucleo.)
endif
ifeq ($(BOARD_NAME), $(filter $(BOARD_NAME),servo servo_nucleo sensor))
ifndef BOARD_ID
$(error BOARD_ID is undefined. BOARD_NAME servo/servo_nucleo/sensor require it.)
endif
@echo Trying to upload to board $(BOARD_NAME) with id $(BOARD_ID)...
cmake -B lowlevel/cmake-build-debug lowlevel -DBOARD_ID=$(BOARD_ID)
cmake --build lowlevel/cmake-build-debug --target flash_$(BOARD_NAME) $(CMAKE_FLAGS)
@echo Upload done.
else
@echo Trying to upload to board $(BOARD_NAME)...
cmake --build lowlevel/cmake-build-debug --target flash_$(BOARD_NAME) $(CMAKE_FLAGS)
@echo Upload done.
endif
.PHONY: ll_test
ll_test:
@echo -e "\nBuilding tests..."
cmake --build lowlevel/cmake-build-debug --target TestRunner
@echo -e "\nStarting TestRunner..."
lowlevel/cmake-build-debug/tests/TestRunner -c