CC ?= gcc CFLAGS = -Wall -Wextra -O2 -I../../../target # Platform-specific library extension UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) LIB_EXT = dylib LDFLAGS = -L../../../target/release -lentropyk_ffi else ifeq ($(UNAME_S),Linux) LIB_EXT = so LDFLAGS = -L../../../target/release -lentropyk_ffi -Wl,-rpath,'$$ORIGIN/../../../target/release' else LIB_EXT = dll LDFLAGS = -L../../../target/release -lentropyk_ffi endif .PHONY: all clean run all: example example: example.c ../../../target/entropyk.h ../../../target/release/libentropyk.$(LIB_EXT) $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) ../../../target/entropyk.h ../../../target/release/libentropyk.$(LIB_EXT): cd ../../.. && cargo build --release -p entropyk-c run: example ./example clean: rm -f example