ref: bfcef01211b5cd95031db3f03771314b244852b0
parent: 07861b3b4ae1dca290fd89fb96fbee964ce28a01
author: Daniel Hauck <[email protected]>
date: Tue Apr 4 15:04:04 EDT 2017
Add DESTDIR to Makefile Allow separate definition of binary and manpage directory. Document Makefile changes in README.
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,8 @@
# User-defined variables
PREFIX = /usr/local
-BINPREFIX = ${PREFIX}/bin
-MANPREFIX = ${PREFIX}/man
+bindir = ${PREFIX}/bin
+mandir = ${PREFIX}/man
Q = @
STRIP = -s
BINMODE = 555
@@ -72,18 +72,18 @@
$Q${RM} src/link/lexer.c src/link/parser.c src/link/parser.h
install: all
- $Qmkdir -p ${BINPREFIX}
- $Qinstall ${STRIP} -m ${BINMODE} rgbasm ${BINPREFIX}/rgbasm
- $Qinstall ${STRIP} -m ${BINMODE} rgbfix ${BINPREFIX}/rgbfix
- $Qinstall ${STRIP} -m ${BINMODE} rgblink ${BINPREFIX}/rgblink
- $Qinstall ${STRIP} -m ${BINMODE} rgbgfx ${BINPREFIX}/rgbgfx
- $Qmkdir -p ${MANPREFIX}/man1 ${MANPREFIX}/man5 ${MANPREFIX}/man7
- $Qinstall -m ${MANMODE} src/rgbds.7 ${MANPREFIX}/man7/rgbds.7
- $Qinstall -m ${MANMODE} src/asm/rgbasm.1 ${MANPREFIX}/man1/rgbasm.1
- $Qinstall -m ${MANMODE} src/fix/rgbfix.1 ${MANPREFIX}/man1/rgbfix.1
- $Qinstall -m ${MANMODE} src/link/rgblink.1 ${MANPREFIX}/man1/rgblink.1
- $Qinstall -m ${MANMODE} src/link/rgblink.5 ${MANPREFIX}/man5/rgblink.5
- $Qinstall -m ${MANMODE} src/gfx/rgbgfx.1 ${MANPREFIX}/man1/rgbgfx.1
+ $Qmkdir -p ${DESTDIR}${bindir}
+ $Qinstall ${STRIP} -m ${BINMODE} rgbasm ${DESTDIR}${bindir}/rgbasm
+ $Qinstall ${STRIP} -m ${BINMODE} rgbfix ${DESTDIR}${bindir}/rgbfix
+ $Qinstall ${STRIP} -m ${BINMODE} rgblink ${DESTDIR}${bindir}/rgblink
+ $Qinstall ${STRIP} -m ${BINMODE} rgbgfx ${DESTDIR}${bindir}/rgbgfx
+ $Qmkdir -p ${DESTDIR}${mandir}/man1 ${DESTDIR}${mandir}/man5 ${DESTDIR}${mandir}/man7
+ $Qinstall -m ${MANMODE} src/rgbds.7 ${DESTDIR}${mandir}/man7/rgbds.7
+ $Qinstall -m ${MANMODE} src/asm/rgbasm.1 ${DESTDIR}${mandir}/man1/rgbasm.1
+ $Qinstall -m ${MANMODE} src/fix/rgbfix.1 ${DESTDIR}${mandir}/man1/rgbfix.1
+ $Qinstall -m ${MANMODE} src/link/rgblink.1 ${DESTDIR}${mandir}/man1/rgblink.1
+ $Qinstall -m ${MANMODE} src/link/rgblink.5 ${DESTDIR}${mandir}/man5/rgblink.5
+ $Qinstall -m ${MANMODE} src/gfx/rgbgfx.1 ${DESTDIR}${mandir}/man1/rgbgfx.1
rgbasm: ${rgbasm_obj}
$Q${CC} ${REALCFLAGS} -o $@ ${rgbasm_obj} -lm
--- a/README.md
+++ b/README.md
@@ -118,11 +118,12 @@
- `PREFIX`: Location where RGBDS will be installed. Defaults to `/usr/local`.
-- `BINPREFIX`: Location where the RGBDS programs will be installed. Defaults to
- `${PREFIX}/bin`.
+- `bindir`: Location where the binaries will be installed. Defaults to `${PREFIX}/bin`.
-- `MANPREFIX`: Location where the RGBDS man pages will be installed. Defaults to
- `${PREFIX}/man`.
+- `mandir`: Location where the manpages will be installed. Defaults to `${PREFIX}/man`.
+
+- `DESTDIR`: This is prepended to all paths during the installation. It is
+ mainly used for packaging.
- `Q`: Whether to quiet the build or not. To make the build more verbose, clear
this variable. Defaults to `@`.