-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
56 lines (43 loc) · 1.03 KB
/
Makefile
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
PYTHON=python
PYTHON_VENV=venv/bin/python
COMPILER=gcc
LINKER=gcc
CLEAN_EXT=*.o *.c *.so
EXTENSION_FOLDER=kenbot
CFLAGS=-O9
PYTHON=$(PYTHON_VENV)
export PYTHONPATH=$PYTHONPATH:../kenbot-Trading
help:
@echo "kenbot Cython Makefile. Available tasks:"
@echo "build -> build the Cython extension module."
@echo "clean -> clean the Cython extension module."
@echo "debug -> debug the Cython extension module."
@echo "run -> run the Cython extension module."
all: build
.PHONY: build
build: clean
$(PYTHON) setup.py build_ext --inplace
.PHONY: clean
clean:
rm -rf build
rm -rf auditwheel
rm -rf dist
rm -rf .eggs
rm -rf *.egg-info
for i in $(CLEAN_EXT); do find $(EXTENSION_FOLDER) -name "$$i" -delete; done
.PHONY: debug
debug:
gdb -ex r --args $(PYTHON) start.py
.PHONY: run
run: build
$(PYTHON) start.py
# Suffix rules
.PRECIOUS: %.c
%: %.o
$(LINKER) -o $@ -L$(LIBRARY_DIR) -l$(PYTHON_LIB) $(SYSLIBS) $<
%.o: %.c
$(COMPILER) $(CFLAGS) -I$(INCLUDE_DIR) -c $< -o $@
%.c: %.py
cython -a --embed $<
%.c: %.pyx
cython -a --embed $<