1
0
forked from bonsai/harakit

GNUmakefile: bandaid solution to fallback sysexits.h not working with Rust

This commit is contained in:
Emma Tebibyte 2023-12-27 23:20:31 -07:00
parent 9ed70e9648
commit 5df9c33d70
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270

View File

@ -40,7 +40,9 @@ endif
build: build_dir false intcmp scrut str strcmp true
build_dir:
mkdir -p build/bin build/lib build/o
# keep build/include until bindgen(1) has stdin support
# https://github.com/rust-lang/rust-bindgen/issues/2703
mkdir -p build/bin build/include build/lib build/o
clean:
rm -rf build/
@ -58,8 +60,12 @@ test: build
tests/posix-compat.sh
sysexits: build_dir
# bandage solution until bindgen(1) gets stdin support
printf '#define EXIT_FAILURE 1\n' | cat - include/sysexits.h \
> build/include/sysexits.h
bindgen --default-macro-constant-type signed --use-core \
"$$(printf '#include <sysexits.h>\n' | cpp -M -idirafter include - \
"$$(printf '#include <sysexits.h>\n' \
| cpp -M -idirafter "$$PWD/build/include" - \
| sed 's/ /\n/g' | grep sysexits.h)" \
| $(RUSTC) $(RUSTCFLAGS) --crate-type lib -o build/o/libsysexits.rlib -