Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix make uninstall is very destructive and make install with GNU coreutils for Darwin #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
.DEFAULT_GOAL := stub
#### Installation directories
bindir ?= ./build/bin
logdir ?= ./build/var/log

uname := $(shell uname -s)
coreutils := $(shell brew list coreutils 2>/dev/null)

clean: | uninstall

install: | stub
@rsync -a src/ ${bindir}/
ifeq (${uname}, Darwin)


ifeq (${uname}, Darwin)
ifndef coreutils
$(error The 'coreutils' package is required for this operation. https://www.gnu.org/software/coreutils/. \
Please install it. brew install coretutils));
endif
@$(eval _bindir := $(shell greadlink -f ${bindir}))
@$(eval _logdir := $(shell greadlink -f ${logdir}))
@sed -i '' "s|bindir=|bindir=${_bindir}|g" ${bindir}/somafm
Expand All @@ -32,7 +41,9 @@ test-unit: | install
@bats test/unit

uninstall:
@rm -rf ${bindir}
@rm -rf ${logdir}
@if test -f ${bindir}/somafm; then rm ${bindir}/somafm; fi
@if test -f ${logdir}/somafm.bats.logs; then rm ${logdir}/somafm.bats.logs; fi
@if [ "$(ls -A $bindir)" ]; then rm -rf ${bindir}; fi
@if [ "$(ls -A $logdir)" ]; then rm -rf ${logdir}; fi

.PHONY: clean install stub test test-integration test-unit uninstall
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $ somafm listen groovesalad
## Install
### Via Homebrew:
```console
$ brew install coreutils
$ brew tap rockymadden/rockymadden
$ brew install rockymadden/rockymadden/somafm-cli
```
Expand Down