Add makefile with install and uninstall script
This commit is contained in:
parent
267fb6130c
commit
9139620fe9
1 changed files with 25 additions and 0 deletions
25
makefile
Normal file
25
makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
DESTDIR ?= /
|
||||
PREFIX ?= /usr
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
LICENSEDIR ?= $(PREFIX)/share/licenses/ufetch
|
||||
DISTRO ?= $(shell [ -f /etc/os-release ] && . /etc/os-release && echo $$ID || echo unknown)
|
||||
DISTRO_FILE = ufetch-$(DISTRO)
|
||||
|
||||
install:
|
||||
@if [ -f "$(DISTRO_FILE)" ]; then \
|
||||
echo "Installing $(DISTRO_FILE)..."; \
|
||||
install -Dm755 "$(DISTRO_FILE)" "$(DESTDIR)$(BINDIR)/ufetch"; \
|
||||
install -Dm644 LICENSE "$(DESTDIR)$(LICENSEDIR)/LICENSE"; \
|
||||
else \
|
||||
echo "Error: $(DISTRO_FILE) not found!"; \
|
||||
echo "Please provide the correct DISTRO=your_distro option, or add the file for $(DISTRO)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
clean install: uninstall install
|
||||
|
||||
uninstall:
|
||||
rm -f "$(DESTDIR)$(BINDIR)/ufetch"
|
||||
rm -rf "$(DESTDIR)$(LICENSEDIR)"
|
||||
|
||||
.PHONY: install clean uninstall
|
Loading…
Add table
Add a link
Reference in a new issue