-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
54 lines (41 loc) · 1.14 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
#!/usr/bin/make -f
# Default target is build
default: build
# Define variables
CARGO=cargo
CRATES_FOLDER=crates
CONTRACTS_PATH=./contracts
BINDINGS_FOLDER=bindings
BINDINGS_CRATES_FOLDER=$(CRATES_FOLDER)/$(BINDINGS_FOLDER)
BINDINGS_OUT_PATH=$(CONTRACTS_PATH)/out/$(BINDINGS_FOLDER)
# Target for generating bindings
bindings:
rm -rf $(BINDINGS_CRATES_FOLDER)
rm -rf $(BINDINGS_OUT_PATH)
# Generate new bindings
@forge bind --root $(CONTRACTS_PATH) --crate-name $(BINDINGS_FOLDER)
# Move bindings to the correct location
@mv -f $(BINDINGS_OUT_PATH) $(CRATES_FOLDER)
# Target for building the project
build: bindings
@$(CARGO) build
# Target for building the project in release mode
build-release: bindings
@$(CARGO) build --release
# Target for cleaning the project
clean:
@forge clean --root $(CONTRACTS_PATH)
@$(CARGO) clean
# Target for formatting the code
fmt:
@forge fmt --check --root $(CONTRACTS_PATH)
@$(CARGO) fmt
# Target for running tests
test:
@forge test --root $(CONTRACTS_PATH)
@$(CARGO) test
# Target for installing forge dependencies
setup:
@forge install
# Declare phony targets
.PHONY: build build-release clean fmt bindings