blob: 669e9cc3796143e88a165cf0dcafa3a5da4aa6b2 (
plain) (
blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
.POSIX:
NAME = webapp
PREFIX = /usr
SRCDIR = $(PREFIX)/src/$(NAME)
SHAREDIR = $(PREFIX)/share
# DOCDIR? JavaScript goes to DOCDIR? Really?
DOCDIR = $(SHAREDIR)/doc/$(NAME)
.SUFFIXES:
.SUFFIXES: .js
all:
include deps.mk
static-contents = \
src/content/papo.js \
src/content/style.css \
src/content/index.html \
contents = \
src/content/service-worker.js \
$(img.svg) \
derived-assets = \
src/content/papo.exported.js \
src/content/sw.exported.js \
src/content/service-worker.js \
all: $(derived-assets)
## The use of static `import` statements inside service workers
## isn't supported. So in order to have tests for the code in
## it, a "main()" function is included in the generated file
## so that is can be ran as a standalone file.
src/content/service-worker.js: src/content/sw.js src/sw-main.js Makefile
cat src/content/sw.js src/sw-main.js > $@
src/content/papo.exported.js src/content/sw.exported.js: \
Makefile src/exported.sh
src/content/papo.exported.js: src/content/papo.js
src/content/sw.exported.js: src/content/sw.js
src/content/papo.exported.js src/content/sw.exported.js:
sh src/exported.sh $(@D)/`basename $@ .exported.js`.js > $@
.SUFFIXES: .js-check
tests/papo.js-check: src/content/papo.exported.js
tests/sw.js-check: src/content/sw.exported.js
tests/papo.js-check tests/sw.js-check:
node tests/node-driver.js $*.js
check-unit: tests/papo.js-check tests/sw.js-check
check-integration:
check: check-unit check-integration
clean:
rm -rf $(derived-assets) $(side-assets)
install: all
mkdir -p \
'$(DESTDIR)$(SRCDIR)' \
for f in $(contents) $(static-contents); do \
dir='$(DESTDIR)$(DOCDIR)'/"`dirname "$${f#src/content/}"`"; \
mkdir -p "$$dir"; \
cp -P "$$f" "$$dir"; \
done
uninstall:
rm -rf \
'$(DESTDIR)$(SRCDIR)' \
'$(DESTDIR)$(DOCDIR)' \
PORT = 3334
## Run file server for local static files
run:
serve -n -p $(PORT) -d '$(DESTDIR)$(DOCDIR)'
ALWAYS:
|