From 261c98ad1446c43e82076950eca0597274f9b211 Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 29 Jun 2024 08:24:11 -0600 Subject: [PATCH 1/3] Makefile: docs no longer builds every invocation, normalize PREFIX for setting man dir --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index fb9aa5d..99cda9f 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,10 @@ DESTDIR ?= dist PREFIX ?= /usr/local -MANDIR != [ $(PREFIX) = / ] && printf '/usr/share/man\n' \ +# normalized prefix +PREFIX_N != (test -d $(PREFIX) && [ '-' != $(PREFIX) ] \ + && CDPATH= cd -P -- $(PREFIX) && pwd -P) +MANDIR != [ $(PREFIX_N) = / ] && printf '/usr/share/man\n' \ || printf '/share/man\n' SYSEXITS != printf '\043include \n' | cpp -M - | sed 's/ /\n/g' \ | sed -n 's/sysexits\.h//p' || printf 'include\n' @@ -29,7 +32,7 @@ RUSTLIBS = --extern getopt=build/o/libgetopt.rlib \ CFLAGS += -I$(SYSEXITS) .PHONY: all -all: docs dj false fop hru intcmp mm npc rpn scrut str strcmp swab true +all: dj false fop hru intcmp mm npc rpn scrut str strcmp swab true # keep build/include until bindgen(1) has stdin support # https://github.com/rust-lang/rust-bindgen/issues/2703 @@ -40,7 +43,7 @@ build: clean: rm -rf build dist -dist: all +dist: all docs mkdir -p $(DESTDIR)/$(PREFIX)/bin $(DESTDIR)/$(PREFIX)/share/man/man1 cp build/bin/* $(DESTDIR)/$(PREFIX)/bin cp build/docs/*.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1 From e38ea5b35d74e79d427b0cc1c6d01f7a90eb7976 Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 29 Jun 2024 08:36:12 -0600 Subject: [PATCH 2/3] Makefile: fixes dist --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 99cda9f..581d2a1 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ clean: rm -rf build dist dist: all docs - mkdir -p $(DESTDIR)/$(PREFIX)/bin $(DESTDIR)/$(PREFIX)/share/man/man1 + mkdir -p $(DESTDIR)/$(PREFIX)/bin $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1 cp build/bin/* $(DESTDIR)/$(PREFIX)/bin cp build/docs/*.1 $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1 From 984c1c1f9a02033fcf6e6bf3782868aa75118dd2 Mon Sep 17 00:00:00 2001 From: emma Date: Sun, 30 Jun 2024 21:21:02 -0600 Subject: [PATCH 3/3] Makefile: fixes portability issue --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 581d2a1..5e2c70d 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ PREFIX_N != (test -d $(PREFIX) && [ '-' != $(PREFIX) ] \ && CDPATH= cd -P -- $(PREFIX) && pwd -P) MANDIR != [ $(PREFIX_N) = / ] && printf '/usr/share/man\n' \ || printf '/share/man\n' -SYSEXITS != printf '\043include \n' | cpp -M - | sed 's/ /\n/g' \ +SYSEXITS != printf '\043include \n' | cpp -M - | tr ' ' '\n' \ | sed -n 's/sysexits\.h//p' || printf 'include\n' CC ?= cc