From 189ad13fcf1c8e264ef51f978dd86bdd108e3a1b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 16 Sep 2021 18:41:40 +0200 Subject: Improve makefile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 46e2a6e..8662f43 100644 --- a/Makefile +++ b/Makefile @@ -3,33 +3,30 @@ CONFIGFILE = config.mk include $(CONFIGFILE) -PY_MAJOR = $$(python --version 2>&1 | cut -d . -f 1 | cut -d ' ' -f 2) -PY_MINOR = $$(python$(PYTHON_MAJOR) --version 2>&1 | cut -d . -f 2) - all: native_bus.so -native_bus.so: native_bus.o - $(CC) -o $@ native_bus.o -shared $(LDFLAGS) +.o.so: + $(CC) -o $@ $< -shared $(LDFLAGS) .c.o: - $(CC) -fPIC -c -o $@ $< $$(pkg-config --cflags python$(PY_MAJOR)) $(CFLAGS) $(CPPFLAGS) + $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS) .pyx.c: if ! $(CYTHON) -$(PY_MAJOR) -v $< -o $@ ; then rm $@; false; fi install: native_bus.so - mkdir -p -- "$(DESTDIR)$(PYTHONDIR)/site-packages" - cp -- bus.py native_bus.so "$(DESTDIR)$(PYTHONDIR)/site-packages" + mkdir -p -- "$(DESTDIR)$(PYTHONPKGDIR)" + cp -- bus.py native_bus.so "$(DESTDIR)$(PYTHONPKGDIR)/" uninstall: - -rm -f -- "$(DESTDIR)$(PYTHONDIR)/site-packages/native_bus.so" - -rm -f -- "$(DESTDIR)$(PYTHONDIR)/site-packages/bus" + -rm -f -- "$(DESTDIR)$(PYTHONPKGDIR)/native_bus.so" + -rm -f -- "$(DESTDIR)$(PYTHONPKGDIR)/bus" clean: -rm -rf -- __pycache__ *.pyc *.pyo *.o *.so .SUFFIXES: -.SUFFIXES: .o .c .pyx +.SUFFIXES: .so .o .c .pyx .PHONY: all install uninstall clean -- cgit v1.2.3-70-g09d2