diff --git a/Makefile b/Makefile index 5786f8b..db881aa 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,17 @@ BINARY := bombadillo PREFIX := /usr/local -MANPREFIX := ${PREFIX}/share/man +EXEC_PREFIX := ${PREFIX} +BINDIR := ${EXEC_PREFIX}/bin +DATAROOTDIR := ${PREFIX}/share +MANDIR := ${DATAROOTDIR}/man +MAN1DIR := ${MANDIR}/man1 # Use a dateformat rather than -I flag since OSX # does not support -I. It also doesn't support # %:z - so settle for %z. BUILD_TIME := ${shell date "+%Y-%m-%dT%H:%M%z"} -# If VERSION is empty or not deffined use the contents of the VERSION file +# If VERSION is empty or not defined use the contents of the VERSION file VERSION := ${shell git describe --tags 2> /dev/null} ifndef VERSION VERSION := ${shell cat ./VERSION} @@ -25,13 +29,13 @@ install: install-bin install-man clean .PHONY: install-man install-man: bombadillo.1 gzip -k ./bombadillo.1 - install -d ${DESTDIR}${MANPREFIX}/man1 - install -m 0644 ./bombadillo.1.gz ${DESTDIR}${MANPREFIX}/man1 + install -d ${DESTDIR}${MAN1DIR} + install -m 0644 ./bombadillo.1.gz ${DESTDIR}${MAN1DIR} .PHONY: install-bin install-bin: build - install -d ${DESTDIR}${PREFIX}/bin - install -m 0755 ./${BINARY} ${DESTDIR}${PREFIX}/bin/${BINARY} + install -d ${DESTDIR}${BINDIR} + install -m 0755 ./${BINARY} ${DESTDIR}${BINDIR} .PHONY: clean clean: @@ -40,6 +44,5 @@ clean: .PHONY: uninstall uninstall: clean - rm -f ${DESTDIR}${MANPREFIX}/man1/bombadillo.1.gz - rm -f ${DESTDIR}${PREFIX}/bin/${BINARY} - + rm -f ${DESTDIR}${MAN1DIR}/bombadillo.1.gz + rm -f ${DESTDIR}${BINDIR}/${BINARY} diff --git a/README.md b/README.md index 854b608..72cd746 100644 --- a/README.md +++ b/README.md @@ -70,31 +70,28 @@ The installation location can be overridden at compile time, which can be very u ```shell git clone https://tildegit.org/sloum/bombadillo.git cd bombadillo -sudo make DESTDIR=/some/directory install +sudo make install PREFIX=/some/directory ``` There are two things to know about when using the above format: -1. The above would install Bombadillo to `/some/directory/usr/local/bin`, _not_ to `/some/directory`. So you will want to make sure your `$PATH` is set accordingly. -2. Using the above will install the man page to `/some/directory/usr/local/share/man`, rather than its usual location. You will want to update your `manpath` accordingly. +1. The above would install Bombadillo to `/some/directory/bin`, _not_ to `/some/directory`. So you will want to make sure your `$PATH` is set accordingly. +2. Using the above will install the man page to `/some/directory/share/man/man1`, rather than its usual location. You will want to update your `manpath` accordingly. + +There are other overrides available - please review the [Makefile](Makefile) for more information. #### Uninstall -If you used the makefile to install Bombadillo then uninstalling is very simple. From the Bombadillo source folder run: +If you used the Makefile to install Bombadillo then uninstalling is very simple. From the Bombadillo source folder run: ```shell sudo make uninstall ``` -If you used a custom `DESTDIR` value during install, you will need to supply it when uninstalling: +If you used a custom `PREFIX` value during install, you will need to supply it when uninstalling: + ```shell -sudo make DESTDIR=/some/directory uninstall +sudo make uninstall PREFIX=/some/directory ``` -make PREFIX=~ install -``` - -You can then add `~/bin` to your PATH environment variable, and `~/share/man` to your manpath. - -The `PREFIX` option can be used to install Bombadillo to any location different to `/usr/local`. Uninstall will clean up any build files, remove the installed binary, and remove the man page from the system. If will _not_ remove any directories created as a part of the installation, nor will it remove any Bombadillo user configuration files.