-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (39 loc) · 1.47 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
55
56
src_files = src/**
webpack_output = dist/app.js dist/background.js dist/tabmanager.css
zip = TabManager.zip
# Files that Make needs to copy over
make_copy_files = dist/launching/popup.html dist/launching/popout.html dist/manifest.json
build_mode = production
########################################################################
# COMMANDS #
########################################################################
webpack: $(webpack_output)
release: $(zip)
debug: build_mode = development
debug: debug.zip
debugd: build_mode = development
debugd: debug
npx webpack watch --mode $(build_mode)
build: dist
########################################################################
# REAL TARGETS #
########################################################################
$(zip): dist
cp icons/icon.png dist/icon.png
cd dist && zip -r ../$(zip) .
debug.zip: dist
cp icons/icon_debug.png dist/icon.png
cd dist && zip -r ../debug.zip .
dist: $(webpack_output) $(make_copy_files)
$(webpack_output) &: $(src_files) ./node_modules/.bin/webpack
./node_modules/.bin/webpack --mode $(build_mode)
# TODO have webpack copy html instead, so that webpack watch works on it too
$(make_copy_files): dist/%: src/%
cp src/$* dist/
./node_modules/.bin/webpack:
npm install
clean:
rm -rf \
dist/* \
*.zip
.PHONY: release debug debugd debug-daemon clean test all webpack build