34 lines
972 B
Makefile
34 lines
972 B
Makefile
DESTDIR = /usr/local/bin
|
|
SUDOERSDIR = /private/etc/sudoers.d
|
|
INSTALL_PATH_CBATTERY = $(DESTDIR)/cbattery
|
|
INSTALL_PATH_VISUDO = $(SUDOERSDIR)/cbattery
|
|
|
|
all: install
|
|
|
|
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)"; \
|
|
fi
|
|
@cp $< $(SUDOERSDIR)/cbattery
|
|
@chmod 440 $(SUDOERSDIR)/cbattery
|
|
|
|
$(INSTALL_PATH_CBATTERY): cbattery
|
|
@echo "Installing cbattery to $(DESTDIR)"
|
|
@install -m 755 $< $(DESTDIR)
|
|
|
|
uninstall:
|
|
@echo "Removing cbattery from $(DESTDIR)"
|
|
@cbattery uninstall || (echo "Uninstalling cbattery failed"; exit 1)
|
|
@rm -f $(INSTALL_PATH_CBATTERY) $(INSTALL_PATH_SMC)
|
|
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " make install - Install cbattery to $(DESTDIR)"
|
|
@echo " make uninstall - Remove cbattery from $(DESTDIR)"
|
|
@echo " make help - Show this help message"
|
|
|
|
.PHONY: all install uninstall help
|