-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
79 lines (65 loc) · 2.06 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
72
73
74
75
76
77
78
79
PREFIX = /usr
INCLUDEDIR = $(PREFIX)/include
LIBDIR = $(PREFIX)/lib
LA_INCDIR = ./include
LA_LIBDIR = ./target/release
DOC_PATH = ./target/doc
CARGO_CNF = Cargo.toml
NAME = $(shell grep name $(CARGO_CNF) | head -n1 | cut -d '"' -f2)
VERSION = $(shell grep version $(CARGO_CNF) | head -n1 | cut -d '"' -f2)
TAG_NAME = v$(VERSION)
all: $(NAME)
$(NAME):
@cargo build --release --all-features
audit:
@cargo outdated --exit-code 1
@cargo audit
@cargo deny check
install:
@install -D --mode=0644 $(LA_INCDIR)/$(NAME).h $(DESTDIR)$(INCLUDEDIR)/$(NAME).h
@install -D --mode=0755 $(LA_LIBDIR)/lib$(NAME).a $(DESTDIR)$(LIBDIR)/lib$(NAME).a
@install -D --mode=0755 $(LA_LIBDIR)/lib$(NAME).so $(DESTDIR)$(LIBDIR)/lib$(NAME).so
debug:
@cargo build --all-features
test: debug
@cargo test --all-features
@make -C tests clean test
@echo
@echo "All tests completed successfully."
tests: test
test_nightly:
@cargo +nightly build --all-features
@cargo +nightly test --all-features
@make -C tests clean test
@echo
@echo "All tests completed successfully."
test_valgrind: debug
@cargo test --all-features
@make -C tests clean test_valgrind
@echo
@echo "All tests completed successfully."
clean:
@cargo clean
@make -C tests clean
doc:
@rm -rf $(DOC_PATH)
@cargo doc --no-deps --all-features
help:
@echo "Default target: $(NAME)"
@echo
@echo "Available targets:"
@echo " $(NAME) create a release build"
@echo " audit audit dependencies"
@echo " install install $(NAME)"
@echo " uninstall uninstall $(NAME)"
@echo " debug create a debug build"
@echo " test run the tests"
@echo " tests alias for 'test'"
@echo " test_nightly run the tests against rust nightly"
@echo " clean remove compiled files"
@echo " doc generate the local documentation"
@echo " help print this message"
@echo
@echo "Options:"
@echo " prefix=<path> set the installation prefix (default: /usr)"
.PHONY: $(NAME) all audit install debug test tests test_nightly clean doc help