GNUmakefile, fop(1): added sysexits support

This commit is contained in:
2023-12-27 22:42:50 -07:00
parent 5d9f6f3245
commit 3355cb3dc3
2 changed files with 27 additions and 12 deletions

View File

@@ -20,8 +20,9 @@ CC=cc
CFLAGS=-O3 -Lbuild/lib -idirafter include
RUSTC=rustc +nightly
RUSTCFLAGS=-Zlocation-detail=none -Copt-level=z -Ccodegen-units=1 -Cpanic=abort
-Clto=y -Cstrip=symbols -Ctarget-cpu=native
RUSTCFLAGS=-Zlocation-detail=none -Copt-level=z -Ccodegen-units=1 \
-Cpanic=abort -Clto=y -Cstrip=symbols -Ctarget-cpu=native \
--extern sysexits=build/o/libsysexits.rlib
ifeq ($(CC), gcc)
CFLAGS=-O3 -s -Wl,-z,noseparate-code,-z,nosectionheader -flto -Lbuild/lib \
@@ -39,7 +40,7 @@ endif
build: build_dir false intcmp scrut str strcmp true
build_dir:
mkdir -p build/o build/lib build/bin
mkdir -p build/bin build/lib build/o
clean:
rm -rf build/
@@ -56,10 +57,16 @@ test: build
tests/cc-compat.sh
tests/posix-compat.sh
sysexits: build_dir
bindgen --default-macro-constant-type signed \
"$$(printf '#include <sysexits.h>\n' | cpp -M -idirafter include - \
| sed 's/ /\n/g' | grep sysexits.h)" \
| $(RUSTC) $(RUSTCFLAGS) --crate-type lib -o build/o/libsysexits.rlib -
false: src/false.rs build_dir
$(RUSTC) $(RUSTCFLAGS) -o build/bin/false src/false.rs
fop: src/fop.rs build_dir
fop: src/fop.rs build_dir sysexits
$(RUSTC) $(RUSTCFLAGS) -o build/bin/fop src/fop.rs
intcmp: src/intcmp.c build_dir
@@ -76,4 +83,3 @@ strcmp: src/strcmp.c build_dir
true: src/true.rs build_dir
$(RUSTC) $(RUSTCFLAGS) -o build/bin/true src/true.rs