2024-05-26 11:40:52 +02:00
|
|
|
CC := gcc
|
2024-05-12 21:14:23 +02:00
|
|
|
|
2024-05-26 11:40:52 +02:00
|
|
|
THIS_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
2024-05-28 21:28:42 +02:00
|
|
|
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
|
2024-05-26 13:15:11 +02:00
|
|
|
mkdir -p out || true
|
2024-05-26 11:40:52 +02:00
|
|
|
${CC} src/main.c \
|
|
|
|
-I include \
|
|
|
|
-L $(REPO_ROOT)/target/release \
|
2024-05-26 13:15:11 +02:00
|
|
|
-Wl,-Bstatic -lservicepoint_binding_c \
|
2024-05-26 11:40:52 +02:00
|
|
|
-Wl,-Bdynamic -llzma \
|
2024-05-26 13:15:11 +02:00
|
|
|
-o out/lang_c
|
2024-05-26 11:40:52 +02:00
|
|
|
|
|
|
|
dependencies: FORCE
|
2024-05-26 13:15:11 +02:00
|
|
|
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 \
|
2024-05-26 13:15:11 +02:00
|
|
|
--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: ;
|