From 2ad7140e1ea8fcc3151c7716805af62719519756 Mon Sep 17 00:00:00 2001 From: emma Date: Sat, 9 Mar 2024 11:53:03 -0700 Subject: [PATCH] Makefile: DESTDIR --- Makefile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d5203f5..66572fc 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,12 @@ # notice are preserved. This file is offered as-is, without any warranty. .POSIX: + +# if using BSD make(1), remove these pragmas because they break it .PRAGMA: posix_202x # future POSIX standard support à la pdpmake(1) .PRAGMA: command_comment # breaks without this? +DESTDIR=./dist PREFIX=/usr/local CC?=cc @@ -32,14 +35,13 @@ clean: rm -rf build/ dist/ dist: all - mkdir -p dist/bin dist/share/man/man1 - cp build/bin/* dist/bin/ - cp docs/*.1 dist/share/man/man1/ + mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1 + cp build/bin/* $(DESTDIR)$(PREFIX)/bin/ + cp docs/*.1 $(DESTDIR)$(PREFIX)/share/man/man1/ .PHONY: install install: dist - mkdir -p $(PREFIX) - cp -r dist/* $(PREFIX)/ + cp -r $(DESTDIR)/* / .PHONY: test test: build