-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
105 lines (85 loc) · 2.91 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
#
# vim: noexpandtab
#
# RFQuack is a versatile RF-hacking tool that allows you to sniff, analyze, and
# transmit data over the air. Consider it as the modular version of the great
#
# Copyright (C) 2019 Trend Micro Incorporated
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Note: make sure that client/ points to the root of https://github.com/rfquack/RFQuack-cli
# Thanks to: https://gist.github.com/mpneuried/0594963ad38e68917ef189b4e6a269db
# HELP
# This will output the help for each task
#
# Thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
.DEFAULT_GOAL := help
APP_PREFIX := rfquack
APP_NAME := rfquack
APP := $(APP_PREFIX)/$(APP_NAME)
RFQ_VOLUME := /tmp/RFQuack
SHELL := /bin/bash
example_src := examples/RFQuack-esp32-CC1101-serial
tmp_build_dir := /tmp/build
pio_env := ESP32
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
clean: ## Clean build environment
rm -f src/rfquack.pb.{h,c} src/main.cpp
rm -rf .pio
docker-build-image: ## Build the container
docker build \
--progress plain \
-t $(APP) .
docker-build-image-nc: ## Build the container without caching
docker build \
--progress plain \
--no-cache \
-t $(APP) .
docker-stop-container: ## Stop and remove a running container
docker stop $(APP_NAME)
docker rm $(APP_NAME)
build-in-docker: ## Spawn a shell in Docker container
docker run \
--rm -it \
--volume ${PWD}:$(RFQ_VOLUME) $(APP) \
make build
flash-via-docker: ## Flash firmware image to $PORT
docker run \
--rm -it \
--volume ${PWD}:$(RFQ_VOLUME) \
--device=${PORT}:/board $(APP) \
make flash
build: ## Build firmware image via PlatformIO
pio run
flash: ## Flash firmware
pio run -t upload
console: ## Serial console
pio device monitor
proto-dev: ## Compile protobuf types (for dev purposes only, makes lots of assumptions)
pio pkg install \
-f -l \
nanopb/Nanopb
protoc \
-I . \
--plugin=protoc-gen-nanopb=.pio/libdeps/$(pio_env)/Nanopb/generator/protoc-gen-nanopb \
--nanopb_out=. \
--python_out=client/rfquack \
src/rfquack.proto
lsd: ## Print list of serial USB devices connected
pio device list
gen-requirements: ## Generates requirements.pip
poetry export > requirements.pip