cbattery/Makefile

37 lines
953 B
Makefile

PREFIX ?= /usr/local
DESTDIR = $(PREFIX)/bin
INSTALL_PATH = $(DESTDIR)/cbattery
all: install
install: $(INSTALL_PATH)
$(INSTALL_PATH): cbattery
@echo "Installing cbattery to $(DESTDIR)"
@install -m 755 $< $(DESTDIR)
uninstall:
@echo "Removing cbattery from $(DESTDIR)"
@$(DESTDIR)/cbattery revert || (echo "Reverting cbattery configurations failed"; exit 1)
@rm -f $(INSTALL_PATH)
SUDOERSDIR = /private/etc/sudoers.d/cbattery
visudo: .visudo
@echo "Installing visudo file to $(SUDOERSDIR)"
@if ! test -d "$(SUDOERSDIR)"; then \
mkdir -p "$(SUDOERSDIR)"; \
fi
@cp $< $(SUDOERSDIR)/cbattery
@chmod 440 $(SUDOERSDIR)/cbattery
help:
@echo "Available targets:"
@echo " make install - Install cbattery to $(DESTDIR)"
@echo " make uninstall - Remove cbattery from $(DESTDIR)"
@echo " make visudo - Install visudo file to $(SUDOERSDIR)"
@echo " make help - Show this help message"
.PHONY: all install uninstall visudo help