-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
209 lines (175 loc) · 7.28 KB
/
Makefile
File metadata and controls
209 lines (175 loc) · 7.28 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
ENV_CLEAN = LC_ALL=en_US.UTF-8 TZ=Z LANGUAGE=en
GIT_RESTORE_MTIME_FLAGS = restore-mtime --commit-time
GIT_DIFF_FLAGS = --no-pager diff --exit-code --name-only
MAKE_MANIFEST = tools/make_manifest.py
MAKE_SW = tools/make_sw.py
MANIFEST_FIREFOX_src = manifest-common.yaml manifest-part-firefox.yaml
MANIFEST_TEST_src = manifest-part-test.yaml
MANIFEST_FIREFOX_TEST_src = $(MANIFEST_FIREFOX_src) $(MANIFEST_TEST_src)
MANIFEST_CHROME_DEV_src = manifest-part-chrome-dev.yaml
MANIFEST_CHROME_src = manifest-common.yaml manifest-part-chrome.yaml
MANIFEST_CHROME_TEST_src = $(MANIFEST_CHROME_src)
MANIFEST_CHROME_TEST_src += $(MANIFEST_CHROME_DEV_src)
SW_JS = lr_sw.js
SW_DIST_JS = lr_sw_dist.js
SW_SRC += \
background/lr_force_sw_activate.js \
mwel/common/mwel_console.js \
background/lr_con.js \
common/bapi.js \
common/lr_common.js \
background/lr_util.js \
background/lr_multimap.js \
background/lr_iter.js \
background/lr_actionlock.js \
background/lr_executor.js \
background/lr_formatter.js \
background/lr_format_org.js \
background/lr_org_buffer.js \
background/lr_org_tree.js \
background/lr_schema_org.js \
background/lr_meta.js \
common/lr_org_protocol.js \
background/lr_rpc_store.js \
background/lr_addon_rpc.js \
background/lr_settings.js \
background/lr_export.js \
background/lr_abortable_ctx.js \
background/lr_offscreen.js \
background/lr_offscreen_clipboard.js \
background/lr_clipboard.js \
background/lr_native_connection.js \
background/lr_native_export.js \
background/lr_scripting.js \
background/lr_tabframe.js \
background/lr_notify.js \
background/lr_action.js \
background/lr_schema_org_product.js \
content_scripts/lrc_clipboard.js \
content_scripts/lrc_image.js \
content_scripts/lrc_link.js \
content_scripts/lrc_meta.js \
content_scripts/lrc_microdata.js \
content_scripts/lrc_relations.js \
content_scripts/lrc_selection.js
SW_TEST_JS = lr_sw_test.js
SW_TEST_SRC += \
test/js/lr_test.js \
test/js/lr_test_org.js \
test/js/lr_test_org_tree.js \
test/js/lr_test_json_ld.js \
test/js/lr_test_format_org.js \
test/js/lr_test_meta.js \
test/js/lr_test_microdata.js \
test/js/lr_test_schema_org_product.js \
test/js/lr_test_abortable_ctx.js
SW_INIT = background/init_linkremark.js
SW_MAIN = background/main_linkremark.js
HELP_PAGE = pages/lrp_help.html
PAGES_SRC = pages/lr_dom.js pages/lrp_irreducible.js pages/lrp_permissions.js
PAGES_SRC += pages/lrp_help.js pages/lrp_navigation.js
PAGES_SRC += pages/lrp_settings.html pages/lrp_settings.js
PAGES_SRC += pages/lrp_preview_model.js pages/lrp_mentions.js pages/lrp_preview.js
PAGES_SRC += pages/lr.css pages/lrp_preview.html
PAGES_SRC += pages/lr_browseraction.html pages/lr_browseraction.css pages/lr_browseraction.js
PAGES_SRC += $(HELP_PAGE)
ICONS_SRC += icons/lr-16.png icons/lr-32.png
ICONS_SRC += icons/lr-24.png icons/lr-48.png
ICONS_SRC += icons/lr-64.png icons/lr-128.png
OFFSCREEN_SRC += offscreen/lro_clipboard.html offscreen/lro_clipboard.js
EMACS = $(ENV_CLEAN) emacs
EMACS_FLAGS = --batch --no-init-file
ORG_RUBY = org-ruby
ORG_RUBY_FLAGS = -t html
ORG_RUBY_HEADER = printf '<!DOCTYPE html>\n<style>body { width: 66ex; margin: auto; }</style>'
# E.g. to redefine directory to load Org
# EMACS_FLAGS += --directory ~/src/org-mode/lisp
-include local.mk
# For development with almost no build step.
firefox: manifest-firefox.json $(HELP_PAGE)
ln -sf manifest-firefox.json manifest.json
firefox-test: manifest-firefox-test.json $(HELP_PAGE)
ln -sf manifest-firefox-test.json manifest.json
manifest-firefox.json: $(MANIFEST_FIREFOX_src)
$(MAKE_MANIFEST) --output $@ $(MANIFEST_FIREFOX_src)
manifest-firefox-test.json: $(MANIFEST_FIREFOX_TEST_src)
$(MAKE_MANIFEST) --output $@ $(MANIFEST_FIREFOX_TEST_src)
manifest-firefox.json manifest-firefox-test.json: $(MAKE_MANIFEST) Makefile
# For development with almost no build step.
# Not a real dependency-aware target
# extension id: mgmcoaemjnaehlliifkgljdnbpedihoe
chrome: $(SW_DIST_JS) manifest-chrome.json $(HELP_PAGE)
ln -sf manifest-chrome.json manifest.json
ln -sf $(SW_DIST_JS) $(SW_JS)
chrome-test: $(SW_TEST_JS) manifest-chrome-test.json $(HELP_PAGE)
ln -sf manifest-chrome-test.json manifest.json
ln -sf $(SW_TEST_JS) $(SW_JS)
manifest-chrome.json: $(MANIFEST_CHROME_src) $(MANIFEST_CHROME_DEV_src)
$(MAKE_MANIFEST) --output $@ $(MANIFEST_CHROME_src) $(MANIFEST_CHROME_DEV_src)
manifest-chrome-dist.json: $(MANIFEST_CHROME_src)
$(MAKE_MANIFEST) --output $@ $(MANIFEST_CHROME_src)
manifest-chrome-test.json: $(MANIFEST_CHROME_TEST_src)
$(MAKE_MANIFEST) --output $@ $(MANIFEST_CHROME_TEST_src)
manifest-chrome.json manifest-chrome-test.json manifest-chrome-dist.json: $(MAKE_MANIFEST) Makefile
$(HELP_PAGE): README.org tools/help.el
$(EMACS) $(EMACS_FLAGS) --load tools/help.el
test: test-json test-python-doctest test-debug-desktop
test-json: examples/backend-python/chrome/lr_example.json
test-json: examples/backend-python/firefox/lr_example.json
test-json: _locales/en/messages.json
tools/json_validate.py -v $^
test-python-doctest: examples/backend-python/lr_emacsclient.py
test-python-doctest: examples/backend-python/lr_example.py
test-python-doctest: examples/linux-desktop/org_protocol_debug.py
python3 -m doctest $^
test-debug-desktop:
examples/linux-desktop/test_org_protocol_debug_desktop.sh
clean:
$(RM) manifest.json
$(RM) README.html
firefox-dist: manifest-firefox.json
git $(GIT_DIFF_FLAGS)
git $(GIT_RESTORE_MTIME_FLAGS)
ln -sf manifest-firefox.json manifest.json
set -e ; \
out="`cat manifest-firefox.json | \
python3 -c "import json, sys; print(json.load(sys.stdin)['version'])"`" ; \
background="`python3 -c 'import sys,json; print(" ".join(json.load(sys.stdin)["background"]["scripts"]))' < manifest.json`" ; \
file="linkremark-$${out}-unsigned.xpi" ; \
$(RM) "$$file" ; \
$(ENV_CLEAN) zip --must-match "$$file" manifest.json $$background \
$(PAGES_SRC) $(CONTENT_SRC) $(ICONS_SRC) \
"_locales/en/messages.json" ; \
echo "Created $$file"
# manifest-chrome-dist.json is not committed to git,
# so use manifest-chrome.json timestamp
chrome-dist: manifest-chrome-dist.json $(SW_DIST_JS)
git $(GIT_DIFF_FLAGS)
git $(GIT_RESTORE_MTIME_FLAGS)
ln -sf manifest-chrome-dist.json manifest.json
touch -r manifest-chrome.json manifest-chrome-dist.json
ln -sf $(SW_DIST_JS) $(SW_JS)
set -e ; \
version="`python3 -c 'import json, sys; print(json.load(sys.stdin)["version"])' <manifest-chrome.json`" ; \
file="linkremark-$${version}.zip" ; \
$(RM) "$$file" ; \
$(ENV_CLEAN) zip --must-match "$$file" manifest.json \
$(SW_JS) $(SW_INIT) $(SW_SRC) $(SW_MAIN) \
$(PAGES_SRC) $(CONTENT_SRC) $(ICONS_SRC) $(OFFSCREEN_SRC) \
"_locales/en/messages.json" ; \
echo "Created $$file"
$(SW_DIST_JS): $(MAKE_SW) Makefile
$(MAKE_SW) --output $@ \
--init $(SW_INIT) --main $(SW_MAIN) $(SW_SRC)
$(SW_TEST_JS): $(MAKE_SW) Makefile
$(MAKE_SW) --output $@ \
--init $(SW_INIT) --main $(SW_MAIN) $(SW_SRC) $(SW_TEST_SRC)
# Writing to a build directory causes an issue with the image
# included from `doc/`. `<base href="../">` makes `<a href"#...">`
# links invalid. An alternative is a symlink to `doc` from
# the build directory.
test-readme:
$(ORG_RUBY_HEADER) >README.html
$(ORG_RUBY) $(ORG_RUBY_FLAGS) README.org >>README.html
.PHONY: clean chrome firefox firefox-dist firefox-test chrome-test chrome-dist test-readme
.PHONY: test test-json test-python-doctest test-debug-desktop