-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextensions.mk
30 lines (23 loc) · 851 Bytes
/
extensions.mk
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
src := $(shell find src -type f | grep -v '\.jsonnet')
dest := $(patsubst src/%, $(out)/ext/%, $(src)) $(out)/ext/manifest.json
jsonnet := jsonnet --tla-code 'browser="$(browser)"'
pkg := $(out)/$(shell $(jsonnet) src/manifest.jsonnet | jq -r '.name+"-"+.version')
$(out)/ext/%: src/%
@mkdir -p $(dir $@)
cp $< $@
$(out)/ext/%.json: src/%.jsonnet
@mkdir -p $(dir $@)
$(jsonnet) $< -o $@
_out/private.pem:
@mkdir -p $(dir $@)
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out $@
-include npm.mk
zip: $(pkg).zip
$(pkg).zip: $(dest)
cd $(dir $<) && zip -qr $(CURDIR)/$@ *
crx: $(pkg).crx
$(pkg).crx: _out/private.pem $(dest)
google-chrome --pack-extension=$(out)/ext --pack-extension-key=$<
mv $(out)/ext.crx $(pkg).crx
upload: $(pkg).crx
scp $< gromnitsky@web.sourceforge.net:/home/user-web/gromnitsky/htdocs/js/chrome/