forked from holochain/holochain-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (52 loc) · 2.15 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
# holochain-rust Makefile
# currently only supports 'debug' builds
# run `make` to build all the libraries and binaries
# run `make test` to execute all the tests
# run `make clean` to clean up the build environment
all: main
CARGO = cargo $(CARGO_ARGS)
# list all the "C" binding tests that have been written
C_BINDING_DIRS = $(sort $(dir $(wildcard c_binding_tests/*/)))
# list all the "C" binding test executables that should be produced
C_BINDING_TESTS = $(foreach dir,$(C_BINDING_DIRS),target/debug/c_binding_tests/$(shell basename $(dir))/test_executable)
# list all the extraneous files that will be generated when running tests
C_BINDING_CLEAN = $(foreach dir,$(C_BINDING_DIRS),$(dir)Makefile $(dir).qmake.stash)
# build artifact / dependency checking is handled by our sub-tools
# we can just try to build everything every time, it should be efficient
.PHONY: main \
c_binding_tests ${C_BINDING_DIRS} \
test ${C_BINDING_TESTS} \
test_non_c \
clean ${C_BINDING_CLEAN}
# apply formatting / style guidelines, and build the rust project
main:
$(CARGO) +$(TOOLS_NIGHTLY) fmt -- --check
$(CARGO) +$(TOOLS_NIGHTLY) clippy -- -A needless_return
$(CARGO) build --all
# list all our found "C" binding tests
c_binding_tests: ${C_BINDING_DIRS}
# build all our found "C" binding tests
${C_BINDING_DIRS}:
qmake -o $@Makefile [email protected]
cd $@; $(MAKE)
# execute all tests, both rust and "C" bindings
test: test_non_c c_binding_tests ${C_BINDING_TESTS}
test_non_c: main wasm-build
RUSTFLAGS="-D warnings" $(CARGO) test
wasm-build:
cd core/src/nucleus/wasm-test && $(CARGO) +$(WASM_NIGHTLY) build --target wasm32-unknown-unknown
cd core_api/wasm-test/round_trip && $(CARGO) +$(WASM_NIGHTLY) build --target wasm32-unknown-unknown
cd core_api/wasm-test/commit && $(CARGO) +$(WASM_NIGHTLY) build --target wasm32-unknown-unknown
cov:
$(CARGO) tarpaulin --all --out Xml
fmt:
$(CARGO) +$(TOOLS_NIGHTLY) fmt
# execute all the found "C" binding tests
${C_BINDING_TESTS}:
$@
# clean up the target directory and all extraneous "C" binding test files
clean: ${C_BINDING_CLEAN}
-@$(RM) -rf target
# clean up the extraneous "C" binding test files
${C_BINDING_CLEAN}:
-@$(RM) $@