-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
56 lines (42 loc) · 1.28 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
#
# platform-io handles all dependencies for us.
# This makefile is only a shortcut so that common idioms like the
# following work:
#
# $ make
# $ make test
# $ make install
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
.PHONY: all build test install upload flash clean clean-pio3 clean-pio4 release
all: build
ifeq ($(V),1)
VERBOSE = --verbose
endif
ifeq ($(RELEASE),)
PLATFORMIO_BUILD_FLAGS= -DVOICEMASK_DEBUG
endif
PIO= PLATFORMIO_BUILD_FLAGS="$(PLATFORMIO_BUILD_FLAGS)" platformio
TARGET := $(shell pio run -t default_envs | grep "default_envs=" | cut -d'=' -f 2)
build:
$(PIO) run $(addprefix -e ,$(TARGET)) $(VERBOSE)
test:
$(PIO) platform install native
$(PIO) test -e native $(VERBOSE)
release: version=$(shell git describe --tags --always --candidates=1 --dirty --broken)
release: test
$(MAKE) $(MAKE_OPTIONS) RELEASE=true build
@for t in $(TARGET) ; do \
cp .pio/build/$${t}/firmware.bin zevoicemask_$${t}_$(version).bin ; \
tput setaf 2 2>/dev/null || true ; \
echo ">>> zevoicemask_$${t}_$(version).bin" ; \
tput sgr0 2>/dev/null || true ; \
done
install upload flash:
[ $(words $(TARGET)) -eq 1 ] || exit 1
$(PIO) run $(addprefix -e ,$(TARGET)) --target upload $(VERBOSE)
clean-pio3:
rm -rf .pioenvs/ .piolibdeps/
clean-pio4:
rm -rf .pio/
clean: clean-pio3 clean-pio4