Makefile: even more changes

This commit is contained in:
Emma Tebibyte 2024-03-09 22:02:19 -07:00
parent 2ad7140e1e
commit b2d56bbc9a
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270

View File

@ -16,11 +16,15 @@
DESTDIR=./dist
PREFIX=/usr/local
SYSEXITS!=printf '\043include <sysexits.h>\n' | cpp -M - | sed 's/ /\n/g' \
| sed -n 's/sysexits\.h//p' || printf 'include/\n'
CC?=cc
RUSTC?=rustc
RUSTLIBS=--extern getopt=build/o/libgetopt.rlib \
--extern sysexits=build/o/libsysexits.rlib \
--extern strerror=build/o/libstrerror.rlib
CFLAGS+=-I$(SYSEXITS)
.PHONY: all
all: dj false fop hru intcmp rpn scrut str strcmp true
@ -60,15 +64,12 @@ build/o/libstrerror.rlib: build src/strerror.rs
$(RUSTC) $(RUSTFLAGS) --crate-type=lib -o $@ \
src/strerror.rs
build/o/libsysexits.rlib: build include/sysexits.h
build/o/libsysexits.rlib: build $(SYSEXITS)sysexits.h
# bandage solution until bindgen(1) gets stdin support
printf '#define EXIT_FAILURE 1\n' | cat - include/sysexits.h \
printf '#define EXIT_FAILURE 1\n' | cat - $(SYSEXITS)sysexits.h \
> build/include/sysexits.h
bindgen --default-macro-constant-type signed --use-core --formatter=none \
"$$(printf '#include <sysexits.h>\n' \
| cpp -M -idirafter "build/include" - \
| sed 's/ /\n/g' | grep sysexits.h)" \
| $(RUSTC) $(RUSTFLAGS) --crate-type lib -o $@ -
build/include/sysexits.h | $(RUSTC) $(RUSTFLAGS) --crate-type lib -o $@ -
.PHONY: dj
dj: build/bin/dj