-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile.pkg-config
65 lines (50 loc) · 1.75 KB
/
Makefile.pkg-config
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
# Makefile for building & testing the client/server examples using pkg-config
# and dynamically linking. For static linking see the default 'Makefile'.
# This Makefile is for testing only. For install instructions, see the README.
#
# Example usage:
# PREFIX=/tmp/librustls
# make --file Makefile.pkg-config install PREFIX=$PREFIX
# PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig/ make --file Makefile.pkg-config
# LD_LIBRARY_PATH=$PREFIX/lib make --file Makefile.pkg-config integration
CARGO ?= cargo
CARGOFLAGS += --locked
CFLAGS := -Werror -Wall -Wextra -Wpedantic -g -I src/
PROFILE := release
CRYPTO_PROVIDER := aws-lc-rs
CERT_COMPRESSION := false
PREFIX=/usr/local
ifeq ($(PROFILE), debug)
CFLAGS += -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address -fsanitize=undefined
endif
ifeq ($(PROFILE), release)
CFLAGS += -O3
CARGOFLAGS += --release
endif
ifeq ($(CRYPTO_PROVIDER), aws-lc-rs)
CFLAGS += -D DEFINE_AWS_LC_RS
CARGOFLAGS += --no-default-features --features aws-lc-rs
else ifeq ($(CRYPTO_PROVIDER), ring)
CFLAGS += -D DEFINE_RING
CARGOFLAGS += --no-default-features --features ring
endif
ifeq ($(CERT_COMPRESSION), true)
CARGOFLAGS += --features cert_compression
endif
all: target/client target/server
integration: all
${CARGO} test --locked --test client_server -- --ignored
target:
mkdir -p $@
install:
cargo cinstall $(CARGOFLAGS) --prefix=$(PREFIX)
target/%.o: tests/%.c tests/common.h | target
$(CC) -o $@ -c $< $(CFLAGS) $(shell pkg-config --cflags rustls)
target/client: target/client.o target/common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs rustls)
target/server: target/server.o target/common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs rustls)
clean:
rm -rf target
.PHONY: all install clean integration