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 | |
parent | ae54c5df759e69f7d70dc19476359ceb1796fec7 (diff) | |
download | libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.tar.gz libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.tar.bz2 libspicy-f02932abbb29ccfc5f4ea4c540bc8d6a46cba1de.zip |
add rust build integration
-rw-r--r-- | .builds/arch.yml | 1 | ||||
-rw-r--r-- | .builds/freebsd.yml | 1 | ||||
-rw-r--r-- | makefile | 14 |
3 files changed, 12 insertions, 4 deletions
diff --git a/.builds/arch.yml b/.builds/arch.yml index 8414884..4007307 100644 --- a/.builds/arch.yml +++ b/.builds/arch.yml @@ -3,6 +3,7 @@ packages: - base-devel - llvm - clang + - rust sources: - https://git.sr.ht/~spicywolf/libspicy triggers: diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index ec54f40..ad96f2d 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -1,6 +1,7 @@ image: freebsd/latest packages: - gmake + - rust sources: - https://git.sr.ht/~spicywolf/libspicy triggers: 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 |