Makefile: Fix make install for mac os and add uninstall.

This commit is contained in:
Tyler Weaver 2018-04-02 08:20:52 -06:00 committed by poljar (Damir Jelić)
parent 508a80e981
commit d249e40687

View file

@ -1,4 +1,4 @@
.PHONY: install install-lib phony test .PHONY: install install-lib install-dir uninstall phony test
WEECHAT_HOME ?= $(HOME)/.weechat WEECHAT_HOME ?= $(HOME)/.weechat
PREFIX ?= $(WEECHAT_HOME) PREFIX ?= $(WEECHAT_HOME)
@ -7,15 +7,21 @@ PYTHON ?= python
lib := $(patsubst matrix/%.py, $(DESTDIR)$(PREFIX)/python/matrix/%.py, \ lib := $(patsubst matrix/%.py, $(DESTDIR)$(PREFIX)/python/matrix/%.py, \
$(wildcard matrix/*.py)) $(wildcard matrix/*.py))
install: install-lib install: install-dir install-lib
install -Dm644 main.py $(DESTDIR)$(PREFIX)/python/matrix.py install -m644 main.py $(DESTDIR)$(PREFIX)/python/matrix.py
install-lib: $(lib) install-lib: $(lib)
install-dir:
install -d $(DESTDIR)$(PREFIX)/python/matrix
uninstall:
rm $(DESTDIR)$(PREFIX)/python/matrix.py $(DESTDIR)$(PREFIX)/python/matrix/*
rmdir $(DESTDIR)$(PREFIX)/python/matrix
phony: phony:
$(DESTDIR)$(PREFIX)/python/matrix/%.py: matrix/%.py phony $(DESTDIR)$(PREFIX)/python/matrix/%.py: matrix/%.py phony
install -Dm644 $< $@ install -m644 $< $@
test: test:
python3 -m pytest python3 -m pytest