This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
71 lines (63 loc) · 1.83 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
# You can always use Cargo directly. But this makefile helps by:
# 1) doing the operation on both the main project and the 'app_tests' sub-project
# 2) including examples in build and check operations
# 3) sym-linking binaries into bin/
EXAMPLES = hello pippincmd
APP_EXAMPLES = sequences
C_B = cargo build
C_B_EX = $(C_B) --example $$ex
C_C = cargo check
C_C_EX = $(C_C) --example $$ex
C_T = cargo test
.PHONY: build check test clean links
build: links
@echo "——— main project ———" && \
echo "→ $(C_B)" ; $(C_B) && \
for ex in $(EXAMPLES); do \
echo "→ $(C_B_EX)" && \
$(C_B_EX) ; \
done && \
echo "——— app_tests ———" && \
cd app_tests && \
echo "→ $(C_B)" && $(C_B) && \
for ex in $(APP_EXAMPLES); do \
echo "→ $(C_B_EX)" && \
$(C_B_EX) ; \
done
check:
@echo "——— main project ———" && \
echo "→ $(C_C)" && $(C_C) && \
for ex in $(EXAMPLES); do \
echo "→ $(C_C_EX)" && \
$(C_C_EX) ; \
done && \
echo "——— app_tests ———" && \
cd app_tests && \
echo "→ $(C_C)" && $(C_C) && \
for ex in $(APP_EXAMPLES); do \
echo "→ $(C_C_EX)" && \
$(C_C_EX) ; \
done
test: links
@echo "——— main project ———" && \
echo "→ $(C_T)" && $(C_T) && \
echo "——— app_tests ———" && \
cd app_tests && \
echo "→ $(C_T)" && $(C_T)
clean:
cargo clean && \
cd app_tests && cargo clean
links:
@mkdir -p bin
@for ex in $(EXAMPLES); do \
test -L bin/$$ex && (test -e bin/$$ex || rm bin/$$ex) ; \
test -L bin/$$ex || ( \
echo "Creating symlink bin/$$ex" && \
ln -s ../target/debug/examples/$$ex bin/$$ex ) ; \
done
@for ex in $(APP_EXAMPLES); do \
test -L bin/$$ex && (test -e bin/$$ex || rm bin/$$ex) ; \
test -L bin/$$ex || ( \
echo "Creating symlink bin/$$ex" && \
ln -s ../app_tests/target/debug/examples/$$ex bin/$$ex ) ; \
done