4 all: whatdoesitdo tests
8 @
# generate the README "What does it do?" section
11 # To decrease tests verbosity, comment out unneeded targets
13 tests
: sourceprefs.js checkdeprecated stats acorn bash_syntax shellcheck
17 acorn
--silent user.js
19 locked_user.js
: user.js
20 sed
's/^user_pref/lockPref/' $< >|
$@
22 systemwide_user.js
: user.js
23 sed
's/^user_pref/pref/' $< >|
$@
27 $(foreach i
,$(wildcard *.sh
),bash
-n
$(i
);)
33 # download and sort all known preferences files from Firefox (mozilla-central) source
34 # specify wanted Firefox version/revision below (eg. "tip", "FIREFOX_AURORA_45_BASE", "9577ddeaafd85554c2a855f385a87472a089d5c0"). See https://hg.mozilla.org/mozilla-central/tags
36 FIREFOX_SOURCE_PREFS
= \
37 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/datareporting-prefs.js \
38 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/healthreport-prefs.js \
39 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/security
/manager
/ssl
/security-prefs.js \
40 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/modules
/libpref
/init
/all.js \
41 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/testing
/profiles
/prefs_general.js \
42 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/layout
/tools
/reftest
/reftest-preferences.js \
43 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/js
/src
/tests
/user.js \
44 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/browser
/app
/profile
/firefox.js \
45 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/debugger.js \
46 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/devtools.js \
47 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/unofficial
/pref
/firefox-branding.js \
48 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/official
/pref
/firefox-branding.js \
49 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/nightly
/pref
/firefox-branding.js \
50 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/aurora
/pref
/firefox-branding.js \
51 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/locales
/en-US
/firefox-l10n.js \
52 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/webide
/webide-prefs.js \
53 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/app
/profile
/channel-prefs.js
55 @for SOURCEFILE in
$(FIREFOX_SOURCE_PREFS
); do wget
-nv
"$$SOURCEFILE" -O
- ; done | egrep
"(^pref|^user_pref)" |
sort --unique
>|
$@
57 TBBBRANCH
=tor-browser-52.6
.2esr-7.5
-2
59 wget
-nv
"https://gitweb.torproject.org/tor-browser.git/plain/browser/app/profile/$@?h=$(TBBBRANCH)" -O
$@
61 regex
= ^\
(user_\
)\?pref
/s
/^.
*pref
("\([^"]\
+\
)",\s*\([^)]\+\).*$$
63 tbb-diff: 000-tor-browser.js
64 diff <(sed -n '/$(regex)/\1 = \2/p' user.js | sort) <(sed -n '/$(regex)/\1 = \2/p' $< | sort)
67 tbb-diff-2: 000-tor-browser.js
68 for setting in $$( comm -12 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)); do diff <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" user.js | sed -n '/$(regex)/\1 = \2/p' | sort) <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" $< | sed -n '/$(regex)/\1 = \2/p' | sort); done
70 .PHONY: tbb-missing-from-user.js
71 tbb-missing-from-user.js: 000-tor-browser.js
72 comm -13 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)
74 ######################
76 .PHONY: checknotcovered
77 checknotcovered: sourceprefs.js
78 @# check for preferences present in firefox source but not covered by user.js
79 @# configure ignored preferences in ignore.list
80 @SOURCE_PREFS=$$(egrep '(^pref|^user_pref)' $< | awk -F'"' '{print $$2}'); \
81 for SOURCE_PREF in $$SOURCE_PREFS; do \
82 grep "\"$$SOURCE_PREF\"" user.js ignore.list >/dev/null || echo "Not covered by user.js : $$SOURCE_PREF"; \
85 .PHONY: checkdeprecated
86 checkdeprecated: sourceprefs.js
87 @# check for preferences in hardened user.js that are no longer present in firefox source
88 @HARDENED_PREFS=$$(egrep "^user_pref" user.js | cut -d'"' -f2); \
89 for HARDENED_PREF in $$HARDENED_PREFS; do \
90 grep "\"$$HARDENED_PREF\"" $< >/dev/null || echo "Deprecated
: $$HARDENED_PREF"; \
95 @# count preferences number, various stats
96 @echo "$$(egrep
"^user_pref" user.js | wc
-l | cut
-f1
) preferences in user.js
"
97 @echo "$$(wc
-l
$< | cut
-d
" " -f1
) preferences in Firefox source
"
101 @# remove temporary files
102 @# please comment this out when not needed, to minimize load on Mozilla servers
103 @rm -f sourceprefs.js AUTHORS
106 @# generate an AUTHORS file, ordered by number of commits
107 @# to add extra authors/credits, git commit --allow-empty --author="A U Thor
<author@example.com
>"
108 @git shortlog -sne | cut -f1 --complement >| $@
112 @l2headers=$$(egrep "^
## " README.md |cut -d" " -f1 --complement ); \
113 echo
"$$l2headers" | while read line
; do \
114 anchor
=$$(echo
"$$line" | tr
'[:upper:]' '[:lower:]' | sed
's/ /-/g' | sed
's/\?//g'); \
115 echo
"* [$$line](#$$anchor)"; \