This repository has been archived by the owner on May 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Makefile
108 lines (89 loc) · 3.99 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
97
98
99
100
101
102
103
104
105
106
107
108
SHELL := /usr/bin/env bash
CHROME := $(shell which google-chrome 2>/dev/null || which google-chrome-stable 2>/dev/null || which chromium 2>/dev/null || which chromium-browser 2>/dev/null || which chrome 2>/dev/null)
PEM := $(shell find . -maxdepth 1 -name "*.pem")
JS_OUTPUT := chrome/background.js chrome/script.js chrome/options.js chrome/inject.js chrome/inject_otp.js
BROWSERIFY := node_modules/.bin/browserify
PRETTIER := node_modules/.bin/prettier
PRETTIER_SOURCES := $(shell find chrome -maxdepth 1 -name "*.js" -o -name "*.css")
all: deps prettier js browserpass test
.PHONY: crx
crx:
ifneq ($(PEM),)
"$(CHROME)" --disable-gpu --pack-extension=./chrome --pack-extension-key=$(PEM)
else
"$(CHROME)" --disable-gpu --pack-extension=./chrome
rm ./chrome.pem
endif
mv chrome.crx chrome-browserpass.crx
.PHONY: prettier
prettier:
$(PRETTIER) --write $(PRETTIER_SOURCES)
.PHONY: js
js: $(JS_OUTPUT)
cp chrome/host.json chrome-host.json
cp firefox/host.json firefox-host.json
cp chrome/policy.json chrome-policy.json
cp chrome/{*.html,*.css,*.js,*.png,*.svg} firefox/
chrome/background.js: chrome/background.browserify.js
$(BROWSERIFY) chrome/background.browserify.js -o chrome/background.js
chrome/script.js: chrome/script.browserify.js
$(BROWSERIFY) chrome/script.browserify.js -o chrome/script.js
chrome/options.js: chrome/options.browserify.js
$(BROWSERIFY) chrome/options.browserify.js -o chrome/options.js
browserpass: cmd/browserpass/ pass/ browserpass.go
go build -o $@ ./cmd/browserpass
browserpass-linux64: cmd/browserpass/ pass/ browserpass.go
env GOOS=linux GOARCH=amd64 go build -o $@ ./cmd/browserpass
browserpass-windows64: cmd/browserpass/ pass/ browserpass.go
env GOOS=windows GOARCH=amd64 go build -o [email protected] ./cmd/browserpass
browserpass-darwinx64: cmd/browserpass/ pass/ browserpass.go
env GOOS=darwin GOARCH=amd64 go build -o $@ ./cmd/browserpass
browserpass-openbsd64: cmd/browserpass/ pass/ browserpass.go
env GOOS=openbsd GOARCH=amd64 go build -o $@ ./cmd/browserpass
browserpass-freebsd64: cmd/browserpass/ pass/ browserpass.go
env GOOS=freebsd GOARCH=amd64 go build -o $@ ./cmd/browserpass
.PHONY: test
test:
go test
go test ./pass
clean:
rm -f browserpass
rm -f browserpass-*
rm -rf release
rm -rf private-release
git clean -fdx chrome/
git clean -fdx firefox/
rm -f *.crx
rm -f *-host.json
rm -f chrome-policy.json
sign: release
for file in release/*; do \
gpg --detach-sign "$$file"; \
done
deps:
yarn
dep ensure -vendor-only
tarball: clean deps js
rm -rf /tmp/browserpass /tmp/browserpass-src.tar.gz
cp -r ../browserpass /tmp/browserpass
rm -rf /tmp/browserpass/.git
find /tmp/browserpass -name "*.pem" -type f -delete
(cd /tmp && tar -czf /tmp/browserpass-src.tar.gz browserpass)
mkdir -p release
cp /tmp/browserpass-src.tar.gz release/
.PHONY: release js crx
release: clean deps js tarball crx browserpass-linux64 browserpass-darwinx64 browserpass-openbsd64 browserpass-freebsd64 browserpass-windows64
mkdir -p private-release
cp -r chrome private-release
sed -i '/"key"/d' private-release/chrome/manifest.json
zip -jFS private-release/chrome private-release/chrome/* key.pem
rm -rf private-release/chrome
mkdir -p release
cp chrome-browserpass.crx release/
zip -jFS release/chrome chrome/* chrome-browserpass.crx
zip -jFS release/firefox firefox/*
zip -FS release/browserpass-linux64 browserpass-linux64 *-host.json chrome-policy.json chrome-browserpass.crx install.sh README.md LICENSE
zip -FS release/browserpass-darwinx64 browserpass-darwinx64 *-host.json chrome-policy.json chrome-browserpass.crx install.sh README.md LICENSE
zip -FS release/browserpass-openbsd64 browserpass-openbsd64 *-host.json chrome-policy.json chrome-browserpass.crx install.sh README.md LICENSE
zip -FS release/browserpass-freebsd64 browserpass-freebsd64 *-host.json chrome-policy.json chrome-browserpass.crx install.sh README.md LICENSE
zip -FS release/browserpass-windows64 browserpass-windows64.exe *-host.json chrome-policy.json chrome-browserpass.crx *.ps1 README.md LICENSE