-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
52 lines (41 loc) · 1.46 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
# Force stub contract generation by setting this variable
FORCE_STUB?=""
# Override this location with env `NODES_DIR=../some/path`
NODES_DIR?=../nodes
NODES_ABS=$(realpath $(NODES_DIR))
.PHONY: build
build: .env install nodes
# Vercel builds require stubs, but if we generate them always it can prevent
# ganache deployment happening in dockerDev.sh
if [ ! -z "$(FORCE_STUB)" ]; then ./stubContract.sh; fi
.PHONY: standalone
standalone: .env clean install
# For clarity: depends on the "clean" target to wipe any local linking
# Stub contracts to allow building without them being deployed
./stubContract.sh
.PHONY: nodes
nodes:
$(MAKE) -C $(NODES_DIR) build
yarn link @desci-labs/desci-models
# Cleanup potential leftover actual directories from standalone build
rm -rf src/desci-contracts-*
# Link contract artifacts to this project.
# -s symlink
# -f overwrite (so we can re-build against a different contract repo version)
# -T treat target as a file (otherwise it will nest in an existing dir link)
ln -sT $(NODES_ABS)/desci-contracts/artifacts src/desci-contracts-artifacts
ln -sT $(NODES_ABS)/desci-contracts/.openzeppelin src/desci-contracts-config
.PHONY: install
install:
yarn
.PHONY: clean
clean:
rm -rf node_modules
rm -rf build
# Unlinking desci-models (may fail if not present, that's okay)
yarn unlink @desci-labs/desci-models || true
# Clean up symlinks
rm -rf src/desci-contracts-*
.PHONY: .env
.env:
cp --no-clobber .env.example .env || true