2021-06-28 20:33:08 +00:00
|
|
|
CC := clang
|
|
|
|
|
2021-06-30 04:44:18 +00:00
|
|
|
RUST_SOURCES := $(shell find .. -type f -name "*.rs")
|
2021-06-28 20:33:08 +00:00
|
|
|
SOURCES := $(shell find -type f -name "*.c")
|
2021-06-28 21:10:10 +00:00
|
|
|
OBJECTS := $(patsubst %.c, bin/%, $(SOURCES))
|
2021-06-30 04:44:18 +00:00
|
|
|
RSLD := $(shell pwd)/../target/debug/rsld
|
2021-06-28 20:33:08 +00:00
|
|
|
|
2021-06-30 04:44:18 +00:00
|
|
|
CFLAGS := -v -static -fuse-ld=$(RSLD)
|
2021-06-28 20:33:08 +00:00
|
|
|
|
|
|
|
all: $(OBJECTS)
|
|
|
|
|
2021-06-30 04:44:18 +00:00
|
|
|
$(RSLD): $(RUST_SOURCES)
|
|
|
|
cargo build
|
|
|
|
|
|
|
|
bin/%: %.c bin $(RSLD)
|
2021-06-28 20:33:08 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
bin:
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf bin
|
|
|
|
|
|
|
|
.PHONY: all clean
|