blob: 7986d7d6856c34332339388bf1d705950f205441 (
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
|
# 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
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 "$@" "$<"
|