From b2d56bbc9abd4f8fc8a991bcd230b713a9575d9f Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 9 Mar 2024 22:02:19 -0700 Subject: [PATCH] Makefile: even more changes --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 66572fc..dd77985 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,15 @@ DESTDIR=./dist PREFIX=/usr/local +SYSEXITS!=printf '\043include \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 \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