aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-16 18:40:29 +0200
committerMattias Andrée <maandree@kth.se>2021-09-16 18:40:29 +0200
commit8ec98c0d9ac5b42d9157cc1f2d5160a07fac16e8 (patch)
tree0af582bc09df319147f8bdc62f19745aaeb95a4c
parentFirst commit (diff)
downloadpython-arg-8ec98c0d9ac5b42d9157cc1f2d5160a07fac16e8.tar.gz
python-arg-8ec98c0d9ac5b42d9157cc1f2d5160a07fac16e8.tar.bz2
python-arg-8ec98c0d9ac5b42d9157cc1f2d5160a07fac16e8.tar.xz
Improve makefile1.0.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--Makefile13
-rw-r--r--config.mk9
2 files changed, 15 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 50ede37..7857bc4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,21 @@
.POSIX:
-PREFIX = /usr/local
+CONFIGFILE = config.mk
+include $(CONFIGFILE)
-PYTHON_MAJOR = $$(python --version 2>&1 | cut -d . -f 1 | cut -d ' ' -f 2)
-PYTHON_MINOR = $$(python$(PYTHON_MAJOR) --version 2>&1 | cut -d . -f 2)
all:
@true
check:
- python$(PYTHON_MAJOR) ./test.py
+ $(PYTHON) ./test.py
install:
- mkdir -p -- "$(DESTDIR)$(PREFIX)/lib/python$(PYTHON_MAJOR).$(PYTHON_MINOR)/site-packages"
- cp -- arg.py "$(DESTDIR)$(PREFIX)/lib/python$(PYTHON_MAJOR).$(PYTHON_MINOR)/site-packages/"
+ mkdir -p -- "$(DESTDIR)$(PYTHONPKGDIR)"
+ cp -- arg.py "$(DESTDIR)$(PYTHONPKGDIR)/"
uninstall:
- -rm -f -- "$(DESTDIR)$(PREFIX)/lib/python$(PYTHON_MAJOR).$(PYTHON_MINOR)/site-packages/arg.py"
+ -rm -f -- "$(DESTDIR)$(PYTHONPKGDIR)/arg.py"
clean:
-rm -rf -- *.pyc *.pyo __pycache__
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..08768f8
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,9 @@
+PREFIX = /usr
+PYTHONDIR = $(PREFIX)/lib/python$(PYTHON_VERSION)
+PYTHONPKGDIR = $(PYTHONDIR)/site-packages
+
+PYTHON_MAJOR = $$(python --version 2>&1 | cut -d . -f 1 | cut -d ' ' -f 2)
+PYTHON_MINOR = $$(python$(PYTHON_MAJOR) --version 2>&1 | cut -d . -f 2)
+PYTHON_VERSION = $(PYTHON_MAJOR).$(PYTHON_MINOR)
+
+PYTHON = python$(PYTHON_VERSION)