forked from abstiles/deluminate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (26 loc) · 992 Bytes
/
Copy pathMakefile
File metadata and controls
34 lines (26 loc) · 992 Bytes
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
.PHONY: clean package
SHELL := /bin/bash
MANIFEST := background.js common.js deluminate-*.png deluminate.css \
deluminate.js manifest.json options.html options.js popup.html popup.js
BUILD_DIR := build
LAST_VERSION_COMMIT := $(shell git blame manifest.json | grep \\bversion \
| cut -d' ' -f1)
BUILD_NUM := $(shell git log $(LAST_VERSION_COMMIT)..HEAD --oneline \
| wc -l | tr -d ' ')
PKG_SUFFIX := $(shell git symbolic-ref --short HEAD \
| sed '/^master$$/d;s/^/-/')
package: deluminate$(PKG_SUFFIX).zip
deluminate.zip: $(MANIFEST)
zip "$@" $(MANIFEST)
deluminate%.zip: $(MANIFEST) | $(BUILD_DIR)
rm -f $(BUILD_DIR)/*
cp $(MANIFEST) $(BUILD_DIR)/
cp $(BUILD_DIR)/manifest.json $(BUILD_DIR)/manifest.json.orig
sed -e '/"version"/s/"[^"]*$$/.$(BUILD_NUM)&/' \
-e 's/"Deluminate"/"Deluminate$(PKG_SUFFIX)"/' \
"$(BUILD_DIR)/manifest.json.orig" > "$(BUILD_DIR)/manifest.json"
cd $(BUILD_DIR) && zip "../$@" $(MANIFEST)
$(BUILD_DIR):
mkdir $@
clean:
rm -f deluminate*.zip