45 lines
1.2 KiB
Makefile
45 lines
1.2 KiB
Makefile
PREFIX ?= /usr/local
|
|
DESTDIR = $(PREFIX)/bin
|
|
INSTALL_PATH = $(DESTDIR)/cbattery
|
|
SHAREDIR = $(PREFIX)/share/cbattery
|
|
DAEMON_PATH = $(SHAREDIR)/cbattery.plist
|
|
VISUDO_PATH = $(SHAREDIR)/.visudo
|
|
|
|
all: install
|
|
|
|
install: $(INSTALL_PATH) $(DAEMON_PATH) $(VISUDO_PATH)
|
|
|
|
$(INSTALL_PATH): cbattery
|
|
@echo "Installing cbattery to $(DESTDIR)"
|
|
@install -d $(DESTDIR)
|
|
@install -m 755 $< $(DESTDIR)
|
|
|
|
$(DAEMON_PATH): cbattery.plist
|
|
@echo "Installing cbattery.plist to $(DAEMON_PATH)"
|
|
@install -d $(SHAREDIR)
|
|
@install -m 644 $< $(DAEMON_PATH)
|
|
|
|
$(VISUDO_PATH): .visudo
|
|
@echo "Installing .visudo to $(VISUDO_PATH)"
|
|
@install -d $(SHAREDIR)
|
|
@install -m 644 $< $(VISUDO_PATH)
|
|
|
|
uninstall:
|
|
@echo "Removing cbattery from $(DESTDIR)"
|
|
@$(DESTDIR)/cbattery revert || (echo "Reverting cbattery configurations failed"; exit 1)
|
|
@rm -f $(INSTALL_PATH)
|
|
@echo "Removing cbattery.plist from $(DAEMON_PATH)"
|
|
@rm -f $(DAEMON_PATH)
|
|
@echo "Removing .visudo from $(VISUDO_PATH)"
|
|
@rm -f $(VISUDO_PATH)
|
|
@echo "Removing $(SHAREDIR)"
|
|
@rmdir $(SHAREDIR) || true
|
|
|
|
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
|