This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
84 lines (62 loc) · 1.93 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
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
include ../ooz/config.make
dist_dir := dist
src_dir := src
demo_dir := demo
atlas_in_files := $(wildcard $(demo_dir)/*.aseprite)
asset_files := \
$(demo_dir)/atlas.json \
$(demo_dir)/atlas.png \
$(demo_dir)/index.html
dist_files := $(asset_files:$(demo_dir)/%=$(dist_dir)/%)
bundle_args ?=
fmt_args ?=
test_unit_args ?=
.PHONY: build
build: bundle build-dist
.PHONY: build-dist
build-dist: $(dist_files)
.PHONY: watch-build
watch-build:; watchexec --ignore='*/$(dist_dir)/*' '$(make) build-dist'
.PHONY: watch
watch: watch-build watch-bundle serve
.PHONY: serve
serve: | $(dist_dir)/; $(live-server) '$(dist_dir)'
.PHONY: bundle
bundle: $(demo_dir)/atlas.json | $(dist_dir)/
$(deno) bundle --config='$(deno_config)' mod.ts '$(dist_dir)/atlas-pack.js'
$(deno) bundle --config='$(deno_config)' '$(demo_dir)/index.ts' '$(dist_dir)/index.js' $(bundle_args)
.PHONY: watch-bundle
watch-bundle: bundle_args += --watch
watch-bundle: bundle
.PHONY: test
test: test-fmt test-lint build test-unit
.PHONY: test-fmt
test-fmt: fmt_args += --check
.PHONY: fmt
fmt:; $(deno) fmt --config='$(deno_config)' $(fmt_args)
.PHONY: test-lint
test-lint:; $(deno) lint --config='$(deno_config)' $(if $(value v),,--quiet)
.PHONY: test-unit
test-unit: build; $(deno) test --allow-read=. --config='$(deno_config)' $(test_unit_args)
.PHONY: test-unit-update
test-unit-update: test_unit_args += --allow-write=. -- --update
test-unit-update: test-unit
$(dist_dir)/%: $(demo_dir)/% | $(dist_dir)/; $(cp) '$<' '$@'
$(demo_dir)/atlas.json $(demo_dir)/atlas.png&: $(atlas_in_files)
bin/aseprite-batch \
--merge-duplicates \
--sheet='$(demo_dir)/atlas.png' \
$^ \
--color-mode=indexed|
bin/atlas-pack > '$(demo_dir)/atlas.json'
$(dist_dir)/:; $(mkdir) '$@'
.PHONY: clean
clean:; $(rm) '$(dist_dir)/' '$(demo_dir)/atlas.json' '$(demo_dir)/atlas.png'
.PHONY: rebuild
rebuild:
$(make) clean
$(make) build
.PHONY: retest
retest:
$(make) clean
$(make) test