servicepoint/examples/lang_c/Makefile

37 lines
813 B
Makefile
Raw Normal View History

2024-05-26 11:40:52 +02:00
CC := gcc
2024-05-26 11:40:52 +02:00
THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPO_ROOT := $(THIS_DIR)/../..
2024-05-12 20:25:06 +02:00
2024-05-26 11:40:52 +02:00
build: out/lang_c
2024-05-12 21:33:47 +02:00
2024-05-26 11:40:52 +02:00
clean:
rm -r out
rm include/servicepoint.h
2024-05-12 20:25:06 +02:00
2024-05-26 11:40:52 +02:00
run: out/lang_c
2024-05-12 20:25:06 +02:00
out/lang_c
2024-05-26 11:40:52 +02:00
PHONY: build clean dependencies run
out/lang_c: dependencies src/main.c
mkdir out || true
${CC} src/main.c \
-I include \
-L $(REPO_ROOT)/target/release \
-Wl,-Bstatic -lservicepoint \
-Wl,-Bdynamic -llzma \
-o out/lang_c \
dependencies: FORCE
mkdir include || true
# generate servicepoint header
SERVICEPOINT_HEADER_OUT=$(THIS_DIR)/include cargo build \
--manifest-path=$(REPO_ROOT)/crates/servicepoint_binding_c/Cargo.toml
# build release binary to link against
cargo build --manifest-path=$(REPO_ROOT)/crates/servicepoint/Cargo.toml --release \
--features c_api,all_compressions
2024-05-12 21:33:47 +02:00
2024-05-26 11:40:52 +02:00
FORCE: ;