File: Makefile

package info (click to toggle)
browserpass 3.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 4,836 kB
  • sloc: javascript: 80,027; makefile: 544
file content (94 lines) | stat: -rw-r--r-- 2,801 bytes parent folder | download
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
VERSION ?= $(shell cat .version)

CLEAN_FILES := chromium firefox dist dist-webstore
CHROME := $(shell which chromium 2>/dev/null || which chromium-browser 2>/dev/null || which chrome 2>/dev/null || which google-chrome 2>/dev/null || which google-chrome-stable 2>/dev/null)

#######################
# For local development

.PHONY: all
all: extension chromium firefox

.PHONY: extension
extension:
	$(MAKE) -C src LESSC=/usr/bin/lessc css/popup.dist.css css/options.dist.css

EXTENSION_FILES := \
	src/*.png \
	src/*.svg \
	src/fonts/* \
	src/popup/*.html \
	src/popup/*.svg \
	src/options/*.html
EXTENSION_FILES := \
    $(wildcard $(EXTENSION_FILES)) \
	src/css/popup.dist.css \
	src/css/options.dist.css 
CHROMIUM_FILES := $(patsubst src/%,chromium/%, $(EXTENSION_FILES))
FIREFOX_FILES  := $(patsubst src/%,firefox/%,  $(EXTENSION_FILES))

.PHONY: chromium
chromium: extension $(CHROMIUM_FILES) chromium/manifest.json

$(CHROMIUM_FILES) : chromium/% : src/%
	[ -d $(dir $@) ] || mkdir -p $(dir $@)
	cp $< $@

chromium/manifest.json : src/manifest-chromium.json
	[ -d $(dir $@) ] || mkdir -p $(dir $@)
	cp $< $@

.PHONY: firefox
firefox: extension $(FIREFOX_FILES) firefox/manifest.json

$(FIREFOX_FILES) : firefox/% : src/%
	[ -d $(dir $@) ] || mkdir -p $(dir $@)
	cp $< $@

firefox/manifest.json : src/manifest-firefox.json
	[ -d $(dir $@) ] || mkdir -p $(dir $@)
	cp $< $@

#######################
# For official releases

.PHONY: clean
clean:
	rm -rf $(CLEAN_FILES)
	$(MAKE) -C src clean CLEAN_FILES=css

.PHONY: crx-webstore
crx-webstore:
	"$(CHROME)" --disable-gpu --pack-extension=./chromium --pack-extension-key=webstore.pem
	mv chromium.crx browserpass-webstore.crx

.PHONY: crx-github
crx-github:
	"$(CHROME)" --disable-gpu --pack-extension=./chromium --pack-extension-key=github.pem
	mv chromium.crx browserpass-github.crx

.PHONY: dist
dist: clean extension chromium firefox crx-webstore crx-github
	mkdir -p dist

	git archive -o dist/browserpass-extension-$(VERSION).tar.gz --format tar.gz --prefix=browserpass-extension-$(VERSION)/ $(VERSION)

	(cd chromium && zip -r ../dist/browserpass-chromium-$(VERSION).zip *)
	(cd firefox  && zip -r ../dist/browserpass-firefox-$(VERSION).zip  *)

	mv browserpass-webstore.crx dist/browserpass-webstore-$(VERSION).crx
	mv browserpass-github.crx dist/browserpass-github-$(VERSION).crx

	for file in dist/*; do \
	    gpg --detach-sign --armor "$$file"; \
	done

	mkdir -p dist-webstore

	cp dist/browserpass-firefox-$(VERSION).zip dist-webstore/firefox-$(VERSION).zip
	mv dist/browserpass-extension-$(VERSION).tar.gz dist-webstore/firefox-$(VERSION)-src.tar.gz

	cp -a chromium dist-webstore/
	sed -i '/"key"/d' dist-webstore/chromium/manifest.json
	(cd dist-webstore/chromium && zip -r ../chrome-$(VERSION).zip *)
	rm -rf dist-webstore/chromium