blob: fa3c9a4c618020d19ccbf62fdabe48a3cfab125b (
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
|
# Makefile for examples written in C.
CARGO ?= cargo
CARGO_TARGET_DIR ?= $(shell pwd)/../../target
# We currently only support absolute paths.
CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR))
# We are producing binaries here.
EXAMPLE_TARGET_DIR ?= $(CARGO_TARGET_DIR)/debug/c-examples/openpgp-ffi
EXAMPLES = \
example reader parser encrypt-for armor \
sign \
decrypt-with \
generate-key \
type-safety-demo use-after-free-demo immutable-reference-demo \
writer-cookie \
reader-cookie \
CFLAGS = -I../include -O0 -g -Wall -Werror
LDFLAGS = -L$(CARGO_TARGET_DIR)/debug
LDLIBS = -lsequoia_openpgp_ffi
# Prefix our target directory.
TARGETS := $(foreach example,$(EXAMPLES),$(EXAMPLE_TARGET_DIR)/$(example))
all: $(TARGETS)
clean:
rm -f $(TARGETS)
$(TARGETS): ../include/sequoia/openpgp.h
$(EXAMPLE_TARGET_DIR)/%: %.c
mkdir -p $(EXAMPLE_TARGET_DIR)
$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<" $(LDLIBS)
|