-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
191 lines (152 loc) · 6.63 KB
/
Copy pathMakefile
File metadata and controls
191 lines (152 loc) · 6.63 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
-include .graphite_config
ifndef DEFAULT_PLATFORM
$(error DEFAULT_PLATFORM is not set. Did you run ./configure?)
endif
GRAPHITE_CONFIG=""
GRAPHITE_FILE="out"
GRAPHITE_PHONE_IP="10.0.0.5"
GOOGLE_DRIVE ?= $(HOME)/Library/CloudStorage/GoogleDrive-stefanheule@gmail.com/My Drive
GOOGLE_DRIVE_PEBBLE_DIR ?= $(GOOGLE_DRIVE)/Pebble
GOOGLE_DRIVE_PBW ?= $(GOOGLE_DRIVE_PEBBLE_DIR)/graphite.pbw
# platform
P=$(DEFAULT_PLATFORM)
VERSION=$(shell python3 -c 'import json; print(json.load(open("package.json"))["version"].rsplit(".", 1)[0])' 2>/dev/null)
all: build install_emulator
release:
@status=$$(git status --porcelain --untracked-files=all); \
if test "x$${status}" = x; then \
echo "Building a release from the clean working tree."; \
else \
echo Working directory is dirty! Commit all changes first; \
exit 1; \
fi
@$(MAKE) build_release
@set -e; \
version=$$(python3 -c 'import json; print(json.load(open("package.json"))["version"].rsplit(".", 1)[0]'); \
test -n "$${version}"; \
rm -rf "releases/$${version}"; \
mkdir -p "releases/$${version}"; \
cp build/graphite.pbw "releases/$${version}/graphite-$${version}.pbw"; \
echo "git-version: $$(git rev-parse HEAD)" >> "releases/$${version}/graphite-$${version}.meta.txt"; \
echo "date: $$(date +%Y-%m-%d) $$(date +%H:%M:%S)" >> "releases/$${version}/graphite-$${version}.meta.txt"; \
echo "Done, releases/$${version}/graphite-$${version}.pbw is ready for upload."
build_release:
@set -e; \
restore_debug() { \
./configure > /dev/null; \
scripts/initialize.py > /dev/null; \
}; \
trap restore_debug EXIT HUP INT TERM; \
./configure --release > /dev/null; \
scripts/initialize.py > /dev/null; \
$(MAKE) clean > /dev/null; \
$(MAKE) build_quiet > /dev/null
build: initialize
# copy fonts
cp resources/fonts/nupe2.ttf config/fonts/nupe2.ttf
cp resources/fonts/fasubset.ttf config/fonts/fasubset.ttf
pebble build
initialize:
scripts/initialize.py
build_quiet:
@scripts/build_quiet.sh
config:
pebble emu-app-config --emulator $(P)
config_new_version:
@read -p "New version number:" v; \
git checkout -b config-$$v; \
git push --set-upstream origin config-$$v; \
git checkout master
update_timezones:
wget -O tz.zip https://timezonedb.com/files/timezonedb.csv.zip
rm -rf tz-data
unzip tz.zip -d tz-data
rm -rf tz.zip
scripts/process_tz_data.py > tz-data/tz-select.html
echo "Update the GRAPHITE_TZ_DATA_VERSION in src/graphite.h"
log:
pebble logs --emulator $(P)
install_emulator:
pebble install --emulator $(P)
deploy: install-phone
install-phone: build
pebble install --phone $(GRAPHITE_PHONE_IP)
google-drive-copy: build
@mkdir -p "$(GOOGLE_DRIVE_PEBBLE_DIR)"
cp -f build/graphite.pbw "$(GOOGLE_DRIVE_PBW)"
@echo "Copied build/graphite.pbw -> $(GOOGLE_DRIVE_PBW)"
phone_log:
pebble logs --phone $(GRAPHITE_PHONE_IP)
menu_icon:
$(MAKE) write_header GRAPHITE_CONFIG="SCREENSHOT_MENU_ICON"
$(MAKE) build
$(MAKE) install_emulator
$(MAKE) clean_header
resources:
SUPPORTED_PLATFORMS=$(SUPPORTED_PLATFORMS) scripts/assemble_screenshots.sh
screenshots:
scripts/screenshot_from_config.py
SUPPORTED_PLATFORMS=$(SUPPORTED_PLATFORMS) scripts/assemble_screenshots.sh
single_screenshot: write_header build_quiet
SUPPORTED_PLATFORMS=$(SUPPORTED_PLATFORMS) scripts/screenshot_from_emulator.sh "$(GRAPHITE_FILE)"
write_header:
@echo "#define $(GRAPHITE_CONFIG)" > src/config.h
clean: clean_header
pebble clean 2> /dev/null
clean_header:
echo "" > src/config.h
# SSH to server and delete the baked config/version dir so the next request re-pulls.
clear_remote_config_cache:
scripts/updated_config.sh
# Push current branch + fast-forward/push config-N (N from index.js), then
# invalidate the server's baked config/version directory (SSH rm, same script as
# clear_remote_config_cache). For config-only web updates without a new .pbw.
deploy_config_online:
@scripts/push_config.sh
@$(MAKE) clear_remote_config_cache
@echo "Done. Server cache cleared; users pick up HTML/JS on next settings open."
encrypt_apikey:
@scripts/encrypt_apikey.py
analyze_size_details:
arm-none-eabi-nm --print-size --size-sort --radix=d build/basalt/pebble-app.elf
analyze_size:
@#make clean build_release
@echo "Full size:"
@arm-none-eabi-nm --print-size --size-sort --radix=d build/basalt/pebble-app.elf | sed "s/.* \([0-9]*\) .*/\1/" | paste -sd+ | bc
@echo "Config variables:"
@arm-none-eabi-nm --print-size --size-sort --radix=d build/basalt/pebble-app.elf | grep " config_" | sed "s/.* \([0-9]*\) .*/\1/" | paste -sd+ | bc
@echo "Widget drawing:"
@arm-none-eabi-nm --print-size --size-sort --radix=d build/basalt/pebble-app.elf | grep " widget_" | sed "s/.* \([0-9]*\) .*/\1/" | paste -sd+ | bc
stats:
@echo "Number of unique watches:"
ssh linode "cat /home/stefan/www/pages/common/data/graphite/analytics.json | sed "s/,/\\\\n/g" | grep wtoken | sort | uniq | wc -l"
font_dl:
@scripts/font_dl.sh
font_build:
node_modules/pebble-fctx-compiler/fctx-compiler.js -r "[ABabdfghij]" resources/fonts/nupe2.svg
node_modules/pebble-fctx-compiler/fctx-compiler.js -r "[0-9a-zA-Z.:\-/° ,%]" resources/fonts/OpenSans-CondensedBold.svg
node_modules/pebble-fctx-compiler/fctx-compiler.js -r "." resources/fonts/fasubset.svg
# Note: the 10-year-range bundle only contains timezone data for roughly the
# current year +/- 5 years, so this needs to be re-run (and
# GRAPHITE_TZ_DATA_VERSION bumped) every few years to keep offsets correct.
library_dl:
wget https://momentjs.com/downloads/moment.min.js -O src/pkjs/moment.js
wget https://momentjs.com/downloads/moment-timezone-with-data-10-year-range.min.js -O src/pkjs/moment-timezone.js
sed -i -e 's/require("moment")/require(".\/moment")/g' src/pkjs/moment-timezone.js
sed -i -e 's/define(\["moment"\]/define([".\/moment"]/g' src/pkjs/moment-timezone.js
cp src/pkjs/moment-timezone.js config/js/moment-timezone.js
coverity_scan:
make clean
~/software/cov-analysis-linux64-8.7.0/bin/cov-configure --comptype gcc --compiler arm-none-eabi-gcc --template
~/software/cov-analysis-linux64-8.7.0/bin/cov-build --dir cov-int make build
rm -f graphite-coverity.tgz
tar czf graphite-coverity.tgz cov-int
rm -rf cov-int
curl --form token=_-37pwMfnnG1HrgX1_KnYg \
--form email=stefanheule@gmail.com \
--form file=@graphite-coverity.tgz \
--form version="git hash `git rev-parse HEAD`" \
--form description="Automatic submission from Makefile" \
https://scan.coverity.com/builds?project=stefanheule%2Fgraphite
rm -f graphite-coverity.tgz
.PHONY: all deploy build build_quiet config log resources install_emulator install-phone google-drive-copy menu_icon screenshots screenshot screenshot_config write_header clean clean_header encrypt_apikey deploy_config_online clear_remote_config_cache