Makefile: DESTDIR

This commit is contained in:
Emma Tebibyte 2024-03-09 11:53:03 -07:00
parent 8193e471f0
commit 2ad7140e1e
Signed by untrusted user: emma
GPG Key ID: 06FA419A1698C270

View File

@ -8,9 +8,12 @@
# notice are preserved. This file is offered as-is, without any warranty. # notice are preserved. This file is offered as-is, without any warranty.
.POSIX: .POSIX:
# if using BSD make(1), remove these pragmas because they break it
.PRAGMA: posix_202x # future POSIX standard support à la pdpmake(1) .PRAGMA: posix_202x # future POSIX standard support à la pdpmake(1)
.PRAGMA: command_comment # breaks without this? .PRAGMA: command_comment # breaks without this?
DESTDIR=./dist
PREFIX=/usr/local PREFIX=/usr/local
CC?=cc CC?=cc
@ -32,14 +35,13 @@ clean:
rm -rf build/ dist/ rm -rf build/ dist/
dist: all dist: all
mkdir -p dist/bin dist/share/man/man1 mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
cp build/bin/* dist/bin/ cp build/bin/* $(DESTDIR)$(PREFIX)/bin/
cp docs/*.1 dist/share/man/man1/ cp docs/*.1 $(DESTDIR)$(PREFIX)/share/man/man1/
.PHONY: install .PHONY: install
install: dist install: dist
mkdir -p $(PREFIX) cp -r $(DESTDIR)/* /
cp -r dist/* $(PREFIX)/
.PHONY: test .PHONY: test
test: build test: build