servicepoint/examples/lang_c/Makefile

34 lines
706 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 -p out || true
2024-05-26 11:40:52 +02:00
${CC} src/main.c \
-I include \
-L $(REPO_ROOT)/target/release \
-Wl,-Bstatic -lservicepoint_binding_c \
2024-05-26 11:40:52 +02:00
-Wl,-Bdynamic -llzma \
-o out/lang_c
2024-05-26 11:40:52 +02:00
dependencies: FORCE
mkdir -p include || true
# generate servicepoint header and binary to link against
2024-05-26 11:40:52 +02:00
SERVICEPOINT_HEADER_OUT=$(THIS_DIR)/include cargo build \
--manifest-path=$(REPO_ROOT)/crates/servicepoint_binding_c/Cargo.toml \
--release
2024-05-12 21:33:47 +02:00
2024-05-26 11:40:52 +02:00
FORCE: ;