-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
51 lines (37 loc) · 1.17 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
PREFIX ?= /usr
DESTDIR ?=
# Set MODE to debug to build in debug mode
MODE ?= release
PKGNAME = etebase
BUILDDIR = ./target
DST_LIBRARY_DIR = $(DESTDIR)$(PREFIX)/lib
DST_PKGCONFIG_DIR = $(DST_LIBRARY_DIR)/pkgconfig
DST_CMAKECONFIG_DIR = $(DST_LIBRARY_DIR)/cmake/Etebase
DST_INCLUDE_DIR = $(DESTDIR)$(PREFIX)/include/$(PKGNAME)
LIBRARY_FILE = $(BUILDDIR)/$(MODE)/lib$(PKGNAME).so
HEADER_FILE = $(BUILDDIR)/$(PKGNAME).h
PKGCONFIG_FILE = $(BUILDDIR)/$(PKGNAME).pc
CMAKECONFIG_FILE = EtebaseConfig.cmake
.PHONY: default all clean
all: build
pkgconfig: $(PKGCONFIG_FILE)
$(PKGCONFIG_FILE): $(PKGNAME).pc.in
mkdir -p "$(BUILDDIR)"
sed "s#@prefix@#$(PREFIX)#g" $< > "$(BUILDDIR)/$(PKGNAME).pc"
build-release: pkgconfig
cargo build --release
build-debug: pkgconfig
cargo build
build: build-$(MODE)
install:
install -Dm644 "$(PKGCONFIG_FILE)" -t "$(DST_PKGCONFIG_DIR)"
install -Dm644 "$(CMAKECONFIG_FILE)" -t "$(DST_CMAKECONFIG_DIR)"
install -Dm644 "$(HEADER_FILE)" -t "$(DST_INCLUDE_DIR)"
install -Dm755 "$(LIBRARY_FILE)" -t "$(DST_LIBRARY_DIR)"
check: build
cargo check
cd c_tests && $(MAKE) check
clean:
cargo clean
cd c_tests && $(MAKE) clean
rm -f "$(BUILDDIR)/$(PKGNAME).p"c