This repository has been archived by the owner on Aug 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (42 loc) · 1.5 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
52
53
54
OUT_NAME := extension
BUILDDIR := build
SRC_DIR := src
BIN_DIR := bin
ZIP_FILE := $(BUILDDIR)/$(OUT_NAME).zip
CRX_FILE := $(BUILDDIR)/$(OUT_NAME).crx
EXT_DIR := $(BUILDDIR)/$(OUT_NAME)
TYPESCPS := $(wildcard $(SRC_DIR)/ts/*.ts)
TS_SPECS := $(wildcard $(SRC_DIR)/ts/*.spec.ts)
BUILT_JS := $(BUILDDIR)/js
JAVASCPS := $(BUILT_JS)/index.js
PACKEDJS := $(BUILDDIR)/bundle.js
$(ZIP_FILE): $(SRC_DIR)/manifest.json $(PACKEDJS) $(SRC_DIR)/index.css $(BUILDDIR)/icon.png
$(shell mkdir -p $(EXT_DIR))
$(shell $(BIN_DIR)/cptag $(EXT_DIR) $^)
cd $(BUILDDIR) && ../$(BIN_DIR)/buildcrx $(OUT_NAME)
# requires of buildcrx in $PATH; see:
# https://github.com/jzacsh/bin/blob/65a3a4ee7902/share/buildcrx
$(CRX_FILE): $(ZIP_FILE)
cd $(BUILDDIR) && ../$(BIN_DIR)/buildcrx $(OUT_NAME) $(PRIVATEK)
$(PACKEDJS): $(JAVASCPS)
$(BIN_DIR)/webpack --config webpack.config.js
$(JAVASCPS): $(TYPESCPS)
$(BIN_DIR)/tsc --outDir $(BUILT_JS)
$(BUILDDIR)/icon.png: $(SRC_DIR)/icon.svg
mogrify -resize 128x128 -background none -format png $<
mv $(SRC_DIR)/icon.png $@
# why the F*#j is imagemagick's output path option so complicated?
$(BUILDDIR):
$(shell mkdir -p $@)
test: $(JAVASCPS) $(TS_SPECS)
$(BIN_DIR)/karma start karma.conf.js --single-run
$(MAKE) coverage
tdd: $(JAVASCPS) $(TS_SPECS)
$(BIN_DIR)/karma start
coverage: SHELL:=/bin/bash
coverage:
w3m -dump -T text/html < $(BUILDDIR)/coverage/*/lcov-report/index.html
all: clean $(ZIP_FILE) test
clean:
$(RM) -rf $(BUILDDIR)
.PHONY: clean all tdd test coverage