aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: b451bca323ed7873be1b314a0ce1cce19c305c82 (plain) (blame)
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
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OS = linux
include mk/$(OS).mk


OBJ =\
	libgamma_native_error.o\
	libgamma_native_facade.o\
	libgamma_native_method.o

PYSRC =\
	libgamma.py\
	libgamma_error.py\
	libgamma_facade.py\
	libgamma_method.py

LIBFILES = $(OBJ:.o=.$(LIBEXT))
FILES = $(PYSRC) $(LIBFILES)


all: $(LIBFILES)

libgamma_native_error.pyx: libgamma_native_error.$(PLATFORM).pyx
	cp -- $< $@

.o.$(LIBEXT):
	$(CC) -o $@ $< -shared $(LDFLAGS)

.c.o:
	$(CC) -fPIC -c -o $@ $< $$(pkg-config --cflags $(PYTHON)) $(CFLAGS) $(CPPFLAGS)

.pyx.c:
	if ! $(CYTHON) -$(PYTHON_MAJOR) -v $< -o $@ ; then rm $@; false; fi

install: $(LIBFILES)
	mkdir -p -- "$(DESTDIR)$(PYTHON_DIR)"
	cp -- $(FILES) "$(DESTDIR)$(PYTHON_DIR)/"

uninstall:
	-cd -- "$(DESTDIR)$(PYTHON_DIR)" && rm -f -- $(FILES)

run-test: $(LIBFILES)
	./test.py

clean:
	-rm -rf -- *.$(LIBEXT) *.o *_native_*.c *.pyc *.pyo __pycache__ libgamma_native_error.pyx

.SUFFIXES:
.SUFFIXES: .$(LIBEXT) .o .c .pyx

.PHONY: all install uninstall check run-test clean