Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
fix make uninstall is very destructive and coreutils

rockymadden#20 (comment)
  • Loading branch information
JavierRuano authored Jun 30, 2024
1 parent 58c6cba commit 751cb03
Showing 1 changed file with 14 additions and 3 deletions.
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

0 comments on commit 751cb03

Please sign in to comment.