diff options
author | Ren Kararou <[email protected]> | 2025-01-31 13:20:50 -0600 |
---|---|---|
committer | Ren Kararou <[email protected]> | 2025-01-31 13:20:50 -0600 |
commit | f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de (patch) | |
tree | 0473b4af0eb037bc25abea0152aac2707dd0566e /makefile | |
parent | ae54c5df759e69f7d70dc19476359ceb1796fec7 (diff) | |
download | libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.tar.gz libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.tar.bz2 libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.zip |
add rust build integration
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/makefile b/makefile index 9eb0e07..3c456a1 100644 --- a/makefile +++ b/makefile @@ -1,18 +1,20 @@ CC:=clang +RUSTC:=rustc AR:=llvm-ar -CFLAGS:=-march=native -O3 -funroll-loops -Wall -Wextra -Werror -fPIC +CFLAGS:=-march=native -O3 -funroll-loops -Wall -Wextra -Werror -fPIC -fstack-protector-all LDFLAGS:=-flto=thin +RSFLAGS:=--edition 2021 --crate-name libspicy -Copt-level=3 -Cpanic=abort --deny warnings ifeq ($(shell uname),SunOS) CC = gcc CFLAGS += -std=gnu11 else -CFLAGS += -std=c11 +CFLAGS += -std=c11 -fsanitize=safe-stack -fcf-protection=[full] endif INCLUDES=-Iinc/ -OBJECTS=obj/salloc.o obj/arena.o obj/resarr.o +OBJECTS=obj/salloc.c.o obj/arena.c.o obj/resarr.c.o .PHONY: all all: build/lib/libspicy.so build/lib/static/libspicy.a includes @@ -41,10 +43,14 @@ build/lib/static/%.a: $(OBJECTS) @if [ ! -d "build/lib/static" ]; then mkdir -p build/lib/static; fi $(AR) rcs $@ $^ -obj/%.o: src/%.c inc/%.h +obj/%.c.o: src/%.c inc/%.h @if [ ! -d "obj" ]; then mkdir -p obj; fi $(CC) -g -c $(INCLUDES) $(CFLAGS) -o $@ $< +obj/%.rs.o: src/%.rs inc/%.h + @if [ ! -d "obj" ]; then mkdir -p obj; fi + $(RUSTC) -g --emit obj --crate-type lib $(RSFLAGS) -o $@ $< + .PHONY: clean clean: @rm -rf obj |