Makefile: DESTDIR

This commit is contained in:
Emma Tebibyte 2024-03-09 11:53:03 -07:00
parent 8193e471f0
commit 2ad7140e1e
Signed by: emma
GPG Key ID: 06FA419A1698C270
1 changed files with 7 additions and 5 deletions

View File

@ -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