forked from zopieux/images-under-cursor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (40 loc) · 1.36 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
EXTNAME := images-under-cursor
KEYFILE := $(EXTNAME).pem
ZIPNAME := $(EXTNAME).zip
SHELL := /usr/bin/env bash
CHROME := chromium
CHROMEBIN := $(CHROME) -n --args
OUTDIR := build
SASS := sass --style=compressed
SVGRASTER := inkscape --export-area-page
SVGRASTERDRAWING := inkscape --export-area-drawing
PNGOPTIMIZE := optipng -quiet -clobber -preserve
OBJS := src/css/content.css $(addprefix src/img/icon-,$(addsuffix .png,48 128)) src/img/icon-nope-26.png
LOCALES := $(wildcard src/_locales/*/messages.json)
COPIED := src/manifest.json $(wildcard src/js/*.js) $(LOCALES) src/img/menu-icon.png
all: build
%.css: %.scss
$(SASS) $<:$@
src/img/icon-%.png: src/img/icon.svg
$(SVGRASTER) -w $* --export-png $@ $<
$(PNGOPTIMIZE) $@
package-icon.png: src/img/icon.svg
$(SVGRASTER) -w 96 --export-png nb-$@ $<
convert nb-$@ -bordercolor transparent -border 16 $@
$(RM) nb-$@
$(PNGOPTIMIZE) $@
src/img/icon-nope-%.png: src/img/icon-nope.svg
$(SVGRASTERDRAWING) -w $* --export-png $@ $<
$(PNGOPTIMIZE) $@
build: $(OBJS) $(COPIED)
mkdir -p $(OUTDIR)
tar -cf - $^ | tar -xv --strip-components=1 -C $(OUTDIR)
zip: build
$(RM) $(ZIPNAME)
cd $(OUTDIR) && zip -r ../$(ZIPNAME) .
crx: build
$(CHROMEBIN) --pack-extension=$(OUTDIR) --pack-extension-key=$(KEYFILE)
mv $(basename $(OUTDIR)).crx $(EXTNAME)-latest.crx
clean:
$(RM) -r *.crx $(OUTDIR) $(OBJS) $(ZIPNAME)
.PHONY: clean