diff --git a/Makefile b/Makefile index f378058..fa28272 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -DESTDIR = /usr/local/bin SUDOERSDIR = /private/etc/sudoers.d INSTALL_PATH_CBATTERY = $(DESTDIR)/cbattery INSTALL_PATH_VISUDO = $(SUDOERSDIR)/cbattery +PREFIX ?= /usr/local +DESTDIR = $(PREFIX)/bin all: install @@ -10,10 +11,10 @@ install: $(INSTALL_PATH_CBATTERY) $(INSTALL_PATH_VISUDO) $(INSTALL_PATH_VISUDO): .visudo @echo "Installing visudo file to $(SUDOERSDIR)" @if ! test -d "$(SUDOERSDIR)"; then \ - mkdir -p "$(SUDOERSDIR)"; \ + sudo mkdir -p "$(SUDOERSDIR)"; \ fi - @cp $< $(SUDOERSDIR)/cbattery - @chmod 440 $(SUDOERSDIR)/cbattery + @sudo cp $< $(SUDOERSDIR)/cbattery + @sudo chmod 440 $(SUDOERSDIR)/cbattery $(INSTALL_PATH_CBATTERY): cbattery @echo "Installing cbattery to $(DESTDIR)"