-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
68 lines (52 loc) · 1.8 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
COMPILER=./bin/aesophia_cli
SOURCEDIR = contracts
SOURCES=$(wildcard $(SOURCEDIR)/*.aes)
BYTECODES=$(SOURCES:.aes=.aeb)
JSON_ACIS=$(SOURCES:.aes=.json)
ADDRESSES=$(SOURCES:.aes=.addr)
BUILDDIR = build
INTEGRATION_TESTS=./tests/integration/*.sh
BENCHMARK_TESTS=./tests/benchmark/*.js
all: $(BUILDDIR)/$(BYTECODES) $(BUILDDIR)/$(JSON_ACIS)
$(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/$(SOURCEDIR): | $(BUILDDIR)
mkdir -p $@
$(BUILDDIR)/$(BYTECODES): $(SOURCES) | $(BUILDDIR)/$(SOURCEDIR)
$(COMPILER) $< -o $@
# Note on jq default filter: https://github.com/stedolan/jq/issues/1110
$(BUILDDIR)/$(JSON_ACIS): $(SOURCES) | $(BUILDDIR)/$(SOURCEDIR)
$(COMPILER) --create_json_aci $< | jq . > $@
watch:
@echo Watching for file changes in current directory ...
@while true; do $(MAKE) -q || $(MAKE); sleep 1; done
node_modules: package-lock.json
npm install && touch $@
tests: node_modules $(BUILDDIR)/$(JSON_ACIS) $(BUILDDIR)/$(BYTECODES)
npm test
$(BUILDDIR)/js: | $(BUILDDIR)
mkdir -p $@
$(BUILDDIR)/js/tests.js: node_modules $(BUILDDIR)/$(JSON_ACIS) $(BUILDDIR)/js
npm run browser-test-bundle
browser-tests: $(BUILDDIR)/js/tests.js
ifneq ($(shell which open),)
@open tests/browser/index.html
else
@echo Open "tests/browser/index.html" in your browser.
endif
integration-tests: $(INTEGRATION_TESTS) | node_modules $(BUILDDIR)/$(JSON_ACIS)
@for file in $^; do bash $${file}; done
benchmark-tests: $(BENCHMARK_TESTS) | node_modules $(BUILDDIR)/$(JSON_ACIS)
@for file in $^; do node $${file}; done
coverage: node_modules $(BUILDDIR)/$(JSON_ACIS) $(BUILDDIR)/$(BYTECODES)
npm run coverage
lint: node_modules
npm run lint
clean:
rm -f $(BUILDDIR)/$(BYTECODES)
rm -f $(BUILDDIR)/$(JSON_ACIS)
rm -f $(BUILDDIR)/$(ADDRESSES)
rm -rf $(BUILDDIR)/wallet
rm -rf $(BUILDDIR)/js
rm -rf $(BUILDDIR)/.nyc_output
rm -rf node_modules