-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (73 loc) · 2.01 KB
/
Makefile
File metadata and controls
90 lines (73 loc) · 2.01 KB
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
.PHONY: build clean lint test flash monitor all help check release debug
# Project name
PROJ_NAME := bitcoin-hardware-wallet
# Build configuration
release ?=
ifdef release
release_flag := --release
target := release
else
release_flag :=
target := debug
endif
# Default target
default: build
# Build everything
all: clean build
# Just check compilation without building
check:
cargo check
# Build the project
build:
cargo build $(release_flag)
# Clean build artifacts
clean:
cargo clean
rm -rf .pio/build/
rm -rf .embuild/
rm -rf target/
rm -rf build/
# Lint code
lint:
cargo clippy --fix --allow-staged --allow-dirty
cargo fmt
# Run tests with host system's default target
test:
# Use a shell script to unset CARGO_BUILD_TARGET and run tests
sh -c 'unset CARGO_BUILD_TARGET; cargo test --all-features --workspace'
# Convert images using PlatformIO script
images:
python platformio.convert_images.py
# Flash to ESP32
flash:
cargo espflash flash --monitor
# Monitor ESP32
monitor:
cargo espflash monitor
# Build and flash
deploy: build flash
# Build for release
release:
$(MAKE) build release=1
# Build for debug
debug:
$(MAKE) build
# Help information
help:
@echo "Makefile"
@echo "=================================="
@echo "Available targets:"
@echo " make - Build in debug mode"
@echo " make build - Build in debug mode"
@echo " make release - Build in release mode"
@echo " make debug - Build in debug mode (explicit)"
@echo " make clean - Clean build artifacts"
@echo " make check - Check compilation without building"
@echo " make lint - Lint code with clippy and format
@echo " make test - Run tests"
@echo " make images - Convert images using PlatformIO script"
@echo " make flash - Flash to ESP32"
@echo " make monitor - Monitor ESP32 serial output"
@echo " make deploy - Build and flash to ESP32"
@echo " make all - Clean, build, and test"
@echo " make help - Show this help message"