File: Makefile

package info (click to toggle)
py3c 1.4-1
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 344 kB
  • sloc: ansic: 881; python: 383; makefile: 207
file content (56 lines) | stat: -rw-r--r-- 1,421 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
all:
	echo "Available targets:"
	echo "    make test"
	echo "    make test-<interpreter>"
	echo "    make doc"
	echo "    make install"
	echo "    make clean"

prefix ?= /usr/local
includedir ?= $(prefix)/include
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
pkgconfigdir ?= ${datadir}/pkgconfig
testbuilddir ?= test/build

_testbuilddir_abs=$(abspath ${testbuilddir})

doc:
	cd doc && $(MAKE) html

test:
	$(MAKE) test-python2
	$(MAKE) test-python3
	$(MAKE) test-python2-cpp
	$(MAKE) test-python3-cpp

# TODO: A better way to build & use one-off extensions?

build-%:
	cd test; rm -rvf ${_testbuilddir_abs} ; $* setup.py build -b ${_testbuilddir_abs}

build-%-cpp:
	cd test; rm -rvf ${_testbuilddir_abs} ; TEST_USE_CPP=yes $* setup.py build -b ${_testbuilddir_abs}

test-%: build-%
	echo ${_testbuilddir_abs}
	PYTHONPATH=$(wildcard ${_testbuilddir_abs}/lib*) $* test -v

test-%-cpp: build-%-cpp
	TEST_USE_CPP=yes PYTHONPATH=$(wildcard ${_testbuilddir_abs}/lib*) $* test -v

py3c.pc: py3c.pc.in
	sed -e's:@includedir@:$(abspath $(includedir)):' $< > $@

install: py3c.pc
	mkdir -p -m 0755 $(DESTDIR)$(includedir)/py3c
	install -m 0644 include/py3c.h $(DESTDIR)$(includedir)/py3c.h
	install -m 0644 $(wildcard include/py3c/*.h) $(DESTDIR)$(includedir)/py3c/

	mkdir -p -m 0755 $(DESTDIR)$(pkgconfigdir)
	install -m 0644 py3c.pc $(DESTDIR)$(pkgconfigdir)/

clean:
	rm py3c.pc ||:

.PHONY: test doc clean install