-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
59 lines (49 loc) · 1.49 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
.PHONY: help compile flash clean docker docs
MAKEFLAGS += --no-print-directory
compile: #/ [kb=keyboard] [features="list of features"]
ifeq ($(kb),)
@make help -B
@exit 1
endif
@make pre_compile -B args="$(kb) $(features)" || { \
echo "pre_compile failed, aborting."; \
exit 1; \
}
ifeq ($(kb),_emulator)
@echo -e "\x1b[34mEmulator detected, starting...\x1b[0m"
@cd build && cargo run --release
else
@cd build && cargo build --release
# @cd build && cargo objcopy --release -- -O binary ../firmware.bin
# @cd build && cargo objcopy --release -- -O ihex ../firmware.hex
endif
flash: #/ flashes the firmware [features="list of features"]
@make pre_compile -B args="$(kb) $(features)" || { \
echo "pre_compile failed, aborting."; \
exit 1; \
}
ifeq ($(debug),true)
ifneq ($(features),)
cd build && cargo embed --features $(features)
else
cd build && cargo embed
endif
else
cd build && cargo embed
endif
clean: #/ cleans build files
@rm -rf build
@rm -rf firmware.bin
@rm -rf firmware.hex
docker: #/ runs the dev container
@cd docker && docker-compose up -d && docker exec -it orbit bash
docs: #/ starts the docs server
@cd docs && npm install && npm run docs:dev
help:
@grep -E '^[a-zA-Z_-]+:.*?#/ .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?#/ "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
pre_compile:
@rustup default stable 2>/dev/null
@if ! cargo install --list | grep -q cargo-play; then \
cargo install cargo-play; \
fi
@cargo play ./orbit/build.rs -- $(args)