-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (51 loc) · 1.64 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
ifdef ENVIRONMENT
ENV_FLAG := -e $(ENVIRONMENT)
endif
extra_files = lib/PWMSine/sinlut.h include/version.h
.PHONY: all
all: ## Compile firmware.
all: $(extra_files)
pio run $(ENV_FLAG)
.PHONY: upload
upload: $(extra_files)
upload: ## Upload firmware.
pio run $(ENV_FLAG) --target upload
.PHONY: bootloader
bootloader: $(extra_files)
bootloader: ## Burn fuses and bootloader.
pio run $(ENV_FLAG) --target bootloader
.PHONY: clean
clean: ## Clean project.
# Not cleaning extra_files, because they are currently tracked by git.
pio run $(ENV_FLAG) --target clean
-rm include/version.h
.PHONY: update
update: ## Update PlatformIO core and libraries.
pio update
.PHONY: help
help: ## Show this help.
@grep -F -h "##" $(MAKEFILE_LIST) | sed -e '/unique_BhwaDzu7C/d;s/\\$$//;s/##//'
.PHONY: docs
docs: ## Generate Doxygen documentation.
docs: $(extra_files)
doxygen
.PHONY: check
check: ## Run static code analysis.
check: $(extra_files)
pio check $(ENV_FLAG)
.PHONY: test
test: ## Run native tests.
test: $(extra_files)
pio test -e native
.PHONY: test_embedded
test_embedded: ## Run tests on the embedded device.
test_embedded: $(extra_files)
pio test $(ENV_FLAG)
lib/PWMSine/sinlut.h: lib/PWMSine/sinlut.py
cd lib/PWMSine && ./sinlut.py
# This needs to be regenerated on every run to be able to
# detect the -dirty state.
.PHONY: include/version.h
include/version.h:
echo "#define AlarmClock_version \"$(shell git describe --dirty --always --tags)\"" > include/version.h
echo "#define AlarmClock_build_time \"$(shell date --utc +"%Y%m%dT%H%M%SZ")\"" >> include/version.h