-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (92 loc) · 3.13 KB
/
Copy pathMakefile
File metadata and controls
108 lines (92 loc) · 3.13 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
js := \
content_scripts/location.js \
background/*.js \
browser_action/*.js \
settings/*.js \
common/*.js
locale_files := $(shell find _locales -type f)
common_files := \
$(locale_files) \
l10n/* \
manifest.json \
background/* \
browser_action/* \
content_scripts/* \
settings/* \
common/* \
LICENSE
firefox_files := \
$(common_files) \
firefox/*.svg
chromium_files := \
$(common_files) \
chromium/mark_location*.png
# Change this to point to a Firefox binary or remove the line from run target
# to use the default Firefox in your path.
firefox-bin := ~/programs/firefox_dev/firefox
firefox-profile := dev-edition-default
android-device := $(shell adb devices | head -2 | tail -1 | cut -f 1)
version_suffix := $(shell grep -oP '[0-9]\.[0-9](\.[0-9])?' manifest.json | head -1 | sed 's/\./_/g')
.PHONY: run firefox chromium clean change_to_firefox \
change_to_chromium lint doc compare_install_and_source supported_versions \
install_dependencies run-firefox-android show_doc supported_versions
run-firefox-android:
web-ext run \
--target=firefox-android \
--android-device=$(android-device) \
--firefox-apk=org.mozilla.fenix \
--firefox-apk-component=HomeActivity
run:
web-ext run \
--firefox-binary $(firefox-bin) \
--firefox-profile $(firefox-profile) \
--pref=intl.locale.requested=en \
--devtools \
-u about:debugging \
-u about:addons \
-u https://en.wikipedia.org/wiki/Main_Page
firefox: change_to_firefox
# Default screenshot size 100%.
sed -i 's/captured_tab_size:\([^0-9]*\)\([0-9]*\)%/captured_tab_size:\1100%/' \
background/background.js
zip -r mark_location_firefox-$(version_suffix).xpi $(firefox_files)
chromium: change_to_chromium
# Default screenshot size 30%.
sed -i 's/captured_tab_size:\([^0-9]*\)\([0-9]*\)%/captured_tab_size:\130%/' \
background/background.js
zip mark_location_chromium-$(version_suffix).zip $(chromium_files)
change_to_firefox:
cp firefox/manifest.json .
change_to_chromium:
cp chromium/manifest.json .
install_dependencies:
npm install
# web-ext lint finds errors if manifest.json isn't the Firefox version.
lint: change_to_firefox
# Check JSON syntax.
$(foreach file,$(locale_files),python -m json.tool < $(file) 1>/dev/null || exit;)
-web-ext lint --ignore-files=doc/* common/browser-polyfill.js l10n/l10n.js common/idb.js
eslint $(js)
doc:
jsdoc -c conf.json -d doc $(js)
show_doc:
$(shell firefox file://$(shell readlink -f doc/index.html))
clean:
rm *.xpi *.zip manifest.json
supported_versions:
# Set verbosity on command line: verbosity='-v{1,2}'
min_ext_ver.pl -b firefox,chrome,andr $(verbosity) $(js)
# usage: make compare_install_and_source install=PATH1 source=PATH2
# where PATH1 is path to the installed addon in
# ~/.mozilla/firefox/PROFILE/extensions/redirectlink@fluks.xpi and PATH2 is
# path to the generated xpi you can create with make firefox.
tmp_install := /tmp/_install
tmp_source := /tmp/_source
compare_install_and_source:
@mkdir $(tmp_install)
@unzip -qqd $(tmp_install) $(install)
@rm -rf $(tmp_install)/META-INF
@mkdir $(tmp_source)
@unzip -qqd $(tmp_source) $(source)
diff -r $(tmp_install) $(tmp_source)
@rm -rf $(tmp_install) $(tmp_source)