PREFIX ?= /usr/local DESTDIR = $(PREFIX)/bin INSTALL_PATH = $(DESTDIR)/cbattery all: install install: $(INSTALL_PATH) $(INSTALL_PATH): cbattery @echo "Installing cbattery to $(DESTDIR)" @install -d $(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) 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