-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
96 lines (80 loc) · 2.57 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
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
js := \
background/*.js \
options/*.js \
common/*.js \
browser_action/*.js
locale_files := $(shell find _locales -type f)
common_files := \
$(locale_files) \
manifest.json \
background/* \
options/* \
browser_action/* \
common/* \
data/original_image.txt \
LICENSE
firefox_files := \
$(common_files) \
data/*.svg
chromium_files := \
$(common_files) \
data/*.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 := ~/Downloads/firefox_dev/firefox
# Change this to your profile or remove the line from run target to use a
# temporary profile.
ff-profile := dev-edition-default
version_suffix := $(shell grep -o '[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 show_doc supported_versions compare_install_and_source \
install_dependencies test
run:
web-ext run \
--firefox-binary $(firefox-bin) \
--firefox-profile $(ff-profile) \
--pref intl.locale.requested=en \
-u https://en.wikipedia.org/wiki/Main_Page \
-u about:debugging \
-u about:addons
firefox: change_to_firefox
zip -r redirect_link-$(version_suffix).xpi $(firefox_files)
chromium: change_to_chromium
zip redirect_link-$(version_suffix).zip $(chromium_files)
change_to_firefox:
cp firefox/manifest.json .
change_to_chromium:
cp chromium/manifest.json .
# 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/*
eslint $(js)
install_dependencies:
npm install --only=dev
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/[email protected] 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)
doc:
jsdoc -c conf.json -d doc $(js)
show_doc:
$(shell firefox file://$(shell readlink -f doc/index.html))
clean:
rm manifest.json
test:
$(firefox-bin) -P $(ff-profile) test/main.html