-
Notifications
You must be signed in to change notification settings - Fork 8
/
extension.mk
46 lines (36 loc) · 1.26 KB
/
extension.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# https://stackoverflow.com/a/47008498/2220110
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
.PHONY: extension/core
# Copy core/src directory to extension/core directory.
extension/core: core/src
@rm -rf extension/core
@cp -r $< $@
chrome: clean
@jsonnet -J core manifest.jsonnet --ext-str browser=chrome -o extension/manifest.json
edge: clean
@jsonnet -J core manifest.jsonnet --ext-str browser=edge -o extension/manifest.json
firefox: clean
@jsonnet -J core manifest.jsonnet --ext-str browser=firefox -o extension/manifest.json
# Usage: make pack [browser] to build the target package for corresponding browser.
# Example:`make pack chrome`, `make pack firefox`, `make pack edge`.
pack: assert
@make $(call args,chrome)
@web-ext build -s extension -n $(call args,chrome)-$(notdir $(shell pwd))-{version}.zip -o
pack-all:
@make pack chrome
@make pack firefox
@make pack edge
clean: extension/core
@rm -rf extension/manifest.json
# The default assert target
assert-default:
@echo "No asserting, ignored..."
# Overrides target without warning.
#
# https://stackoverflow.com/a/49804748
%: %-default
@ true
# This allows us to accept extra arguments (by doing nothing
# when we get a job that doesn't match, rather than throwing an error).
%:
@: