blob: 35c4e9e8dc7729a4007169713967d3822afa1bc2 (
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
|
# 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 \
type-safety-demo use-after-free-demo immutable-reference-demo \
CFLAGS = -I../include -O0 -g -Wall -Werror
LDFLAGS = -L$(CARGO_TARGET_DIR)/debug -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 "$@" "$<"
|