blob: 64f48235d0aa7f444b4fc97da7c1cf2628a0b43b (
plain)
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
|
# Makefile for Sequoia's bindings.
# Configuration.
PREFIX ?= /usr/local
DESTDIR ?=
CARGO ?= cargo
CARGO_TARGET_DIR ?= $(shell pwd)/../target
# We currently only support absolute paths.
CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR))
VERSION ?= $(shell grep '^version[[:space:]]*=[[:space:]]*' Cargo.toml | cut -d'"' -f2)
VERSION_MAJOR = $(shell echo $(VERSION) | cut -d'.' -f1)
# Tools.
INSTALL ?= install
# Make sure subprocesses pick these up.
export PREFIX
export DESTDIR
all: build
.PHONY: build
build:
$(MAKE) -Clang/python build
# Testing and examples.
.PHONY: test check
test check:
$(MAKE) -Clang/python test
.PHONY: examples
examples:
$(MAKE) -Cexamples
# Installation.
.PHONY: build-release
build-release:
$(MAKE) -Clang/python build-release
.PHONY: install
install:
$(INSTALL) -d $(DESTDIR)$(PREFIX)/share/pkgconfig
sed -e 's|VERSION|$(VERSION)|g' \
-e 's|PREFIX|$(PREFIX)|g' \
sequoia.pc.in \
> $(DESTDIR)$(PREFIX)/share/pkgconfig/sequoia.pc
$(INSTALL) -d $(DESTDIR)$(PREFIX)/include
$(INSTALL) -t $(DESTDIR)$(PREFIX)/include include/sequoia.h
$(INSTALL) -d $(DESTDIR)$(PREFIX)/include/sequoia
$(INSTALL) -t $(DESTDIR)$(PREFIX)/include/sequoia \
include/sequoia/*.h
$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib
$(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_ffi.so \
$(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so.$(VERSION)
ln -fs libsequoia_ffi.so.$(VERSION) \
$(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so.$(VERSION_MAJOR)
ln -fs libsequoia_ffi.so.$(VERSION) \
$(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.so
$(INSTALL) $(CARGO_TARGET_DIR)/release/libsequoia_ffi.a \
$(DESTDIR)$(PREFIX)/lib/libsequoia_ffi.a
# Now the bindings.
$(MAKE) -Clang/python install
# Housekeeping.
.PHONY: clean
clean:
rm -f sequoia.pc
$(MAKE) -Cexamples clean
$(MAKE) -Clang/python clean
|