summaryrefslogtreecommitdiff
path: root/Makefile
blob: 0a5b2b95a3b1afb2be3c8aabfbf17a80d2b3bfcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
PYTHON = python
SED = sed
SPHINX_BUILD = sphinx-build
ETAGS = etags
INCLUDE_DIR = /usr/include/
VERSION := $(shell $(PYTHON) setup.py --version)
TESTFLAGS = -v

define buildscript
import sys,sysconfig
print("build/lib.{}-{}.{}".format(sysconfig.get_platform(), *sys.version_info[:2]))
endef

builddir := $(shell $(PYTHON) -c '$(buildscript)')

all: build

build:
	$(PYTHON) setup.py build

install:
	$(PYTHON) setup.py install --skip-build $(if $(DESTDIR),--root $(DESTDIR))

dist:
	$(PYTHON) setup.py sdist

clean:
	rm -rf build systemd/*.so systemd/*.py[co] *.py[co] systemd/__pycache__

distclean: clean
	rm -rf dist MANIFEST systemd/id128-constants.h

SPHINXOPTS = -D version=$(VERSION) -D release=$(VERSION)
sphinx-%: build
	PYTHONPATH=$(builddir) $(SPHINX_BUILD) -b $* $(SPHINXOPTS) docs build/$*
	@echo Output has been generated in build/$*

check: build
	(cd $(builddir) && $(PYTHON) -m py.test . ../../docs $(TESTFLAGS))

TAGS: $(shell git ls-files systemd/*.[ch])
	$(ETAGS) $+

.PHONY: build install dist clean distclean TAGS