diff options
-rw-r--r-- | ffi/examples/.gitignore | 2 | ||||
-rw-r--r-- | ffi/examples/Makefile | 12 | ||||
-rw-r--r-- | openpgp-ffi/examples/.gitignore | 7 | ||||
-rw-r--r-- | openpgp-ffi/examples/Makefile | 12 |
4 files changed, 22 insertions, 11 deletions
diff --git a/ffi/examples/.gitignore b/ffi/examples/.gitignore deleted file mode 100644 index e72a3164..00000000 --- a/ffi/examples/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -configure -keyserver diff --git a/ffi/examples/Makefile b/ffi/examples/Makefile index a8d2baa1..bce777b2 100644 --- a/ffi/examples/Makefile +++ b/ffi/examples/Makefile @@ -5,13 +5,23 @@ CARGO_TARGET_DIR ?= $(shell pwd)/../../target # We currently only support absolute paths. CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR)) -TARGETS = keyserver configure +# We are producing binaries here. +EXAMPLE_TARGET_DIR ?= $(CARGO_TARGET_DIR)/debug/c-examples/ffi + +EXAMPLES = keyserver configure CFLAGS = -I../include -I../../openpgp-ffi/include -O0 -g -Wall -Werror LDFLAGS = -L$(CARGO_TARGET_DIR)/debug -lsequoia_ffi +# Prefix our target directory. +TARGETS := $(foreach example,$(EXAMPLES),$(EXAMPLE_TARGET_DIR)/$(example)) + all: $(TARGETS) clean: rm -f $(TARGETS) $(TARGETS): ../include/sequoia.h + +$(EXAMPLE_TARGET_DIR)/%: %.c + mkdir -p $(EXAMPLE_TARGET_DIR) + $(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<" diff --git a/openpgp-ffi/examples/.gitignore b/openpgp-ffi/examples/.gitignore deleted file mode 100644 index 3370781f..00000000 --- a/openpgp-ffi/examples/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -armor -encrypt-for -example -parser -reader -type-safety-demo -use-after-free-demo diff --git a/openpgp-ffi/examples/Makefile b/openpgp-ffi/examples/Makefile index 3b659e50..7986d7d6 100644 --- a/openpgp-ffi/examples/Makefile +++ b/openpgp-ffi/examples/Makefile @@ -5,13 +5,23 @@ CARGO_TARGET_DIR ?= $(shell pwd)/../../target # We currently only support absolute paths. CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR)) -TARGETS = example reader parser encrypt-for armor type-safety-demo use-after-free-demo +# 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 "$@" "$<" |